Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
696fc929c6 | ||
|
|
dfb5004326 | ||
|
|
0824700e4e | ||
|
|
d08cc9b543 | ||
|
|
6c00bd9ffa | ||
|
|
3816155b91 | ||
|
|
aefc84441c |
@@ -318,6 +318,20 @@ Suite-side work items to finish the link (NOT in this repo), copy-paste ready:
|
|||||||
(automations/assistant); those still resolve per-user BYO first, then the
|
(automations/assistant); those still resolve per-user BYO first, then the
|
||||||
plan-gated `AI_*` server env key.
|
plan-gated `AI_*` server env key.
|
||||||
|
|
||||||
|
**Executed on erwin (federatedcomputer.ai) 2026-11-05, superbrain 1.2.4.**
|
||||||
|
Verified: hub lists all 14 tools; read call OK; bad id propagates the Go
|
||||||
|
404 as a tool error; pdns records added. Interim gateway image
|
||||||
|
`federatedcomputer/mcpserver-superbrain:1.8.8` (Dockerfile:
|
||||||
|
`deploy/federated/mcpserver-superbrain.Dockerfile` = upstream 1.8.8 + pipx
|
||||||
|
superbrain-mcp + apps_registry entry; built because upstream ships neither)
|
||||||
|
— the core's mcpserver service `CONTAINER` points at it. Local-only suite
|
||||||
|
edits on erwin (unpushable from here; upstream TODOs): `superbrain` in
|
||||||
|
`MCPSERVER_APPS`, the `mcpserver_app_env_var` case, and the compose render's
|
||||||
|
image repo in `lib/mcpserver.sh`. Retire all three when upstream bakes
|
||||||
|
superbrain in. Gotcha hit: `pipx install` inside the gateway resolves
|
||||||
|
`mcp` 2.x unless pinned `<2` (FastMCP→MCPServer rename breaks the venv at
|
||||||
|
import) — pinned in `mcp/pyproject.toml`.
|
||||||
|
|
||||||
### Incident 2026-11-03: the auto-upgrader took superbrain down (and the fix)
|
### Incident 2026-11-03: the auto-upgrader took superbrain down (and the fix)
|
||||||
|
|
||||||
`upgrade-federated.timer` (daily ~10:06, runs `/federated/bin/upgrade` with no
|
`upgrade-federated.timer` (daily ~10:06, runs `/federated/bin/upgrade` with no
|
||||||
@@ -355,6 +369,23 @@ Fix layers, outermost first:
|
|||||||
the Core maintainer (the `update-superbrain` branch convention is the
|
the Core maintainer (the `update-superbrain` branch convention is the
|
||||||
house landing path for suite-side app changes).
|
house landing path for suite-side app changes).
|
||||||
|
|
||||||
|
Release-publish note (2026-11-05): 1.2.3 was published manually from the
|
||||||
|
dev host with README Option B (multi-arch, tag + latest) using a Docker Hub
|
||||||
|
PAT for `aserwin73` after the org write-scope was corrected — the first
|
||||||
|
successful publish of any release. CI `publish` remains untested end-to-end:
|
||||||
|
the Gitea repo secrets `DOCKERHUB_USERNAME`/`DOCKERHUB_TOKEN` are still unset
|
||||||
|
(andrew's account gets 403 on the repo secrets API; an org owner must set
|
||||||
|
them) — until then every release needs a manual Option B push.
|
||||||
|
|
||||||
|
**1.2.3 is defective for updates — use 1.2.4+:** its migrate image's
|
||||||
|
`/deploy/lib-superbrain.sh` carries unescaped backticks inside the unquoted
|
||||||
|
`render_superbrain_compose` heredoc (command substitution). A re-render while
|
||||||
|
the stack is running injects `docker container inspect` JSON into the compose
|
||||||
|
file; update.sh's parse guard aborts (safely, leaving the old compose
|
||||||
|
replaced by the broken render — restore by re-rendering from a fixed lib).
|
||||||
|
Fixed in 1.2.4 by rewording; rule: no backticks or unescaped `$` inside that
|
||||||
|
heredoc, ever.
|
||||||
|
|
||||||
### Not applicable
|
### Not applicable
|
||||||
|
|
||||||
- `email_superbrain`: since the notification engine (2026-10-26) the app
|
- `email_superbrain`: since the notification engine (2026-10-26) the app
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ SUPERBRAIN_APP_IP="192.168.0.94"
|
|||||||
SUPERBRAIN_MIGRATE_IP="192.168.0.95"
|
SUPERBRAIN_MIGRATE_IP="192.168.0.95"
|
||||||
# Release to install; the generic `upgrade` flow keeps .env in step with the
|
# Release to install; the generic `upgrade` flow keeps .env in step with the
|
||||||
# service file's VERSION afterwards.
|
# service file's VERSION afterwards.
|
||||||
SUPERBRAIN_IMAGE_VERSION="1.2.3"
|
SUPERBRAIN_IMAGE_VERSION="1.2.5"
|
||||||
|
|
||||||
# render_superbrain_compose writes the app-dir compose file. Called by
|
# render_superbrain_compose writes the app-dir compose file. Called by
|
||||||
# config_superbrain (install) and by deploy/federated/update.sh after a lib
|
# config_superbrain (install) and by deploy/federated/update.sh after a lib
|
||||||
@@ -84,8 +84,11 @@ services:
|
|||||||
web:
|
web:
|
||||||
image: federatedcomputer/superbrain-web:\${IMAGE_VERSION}
|
image: federatedcomputer/superbrain-web:\${IMAGE_VERSION}
|
||||||
# MUST be named exactly "superbrain": upgrade_app() probes
|
# MUST be named exactly "superbrain": upgrade_app() probes
|
||||||
# `docker container inspect superbrain` and skips apps whose primary
|
# "docker container inspect superbrain" and skips apps whose primary
|
||||||
# container it cannot find under the app name.
|
# container it cannot find under the app name. (No backticks in this
|
||||||
|
# heredoc: it is unquoted, so they would become command substitution —
|
||||||
|
# hit in production 2026-11-05 when a re-render with the container
|
||||||
|
# running injected inspect JSON into the compose file.)
|
||||||
container_name: superbrain
|
container_name: superbrain
|
||||||
hostname: superbrain.$DOMAIN
|
hostname: superbrain.$DOMAIN
|
||||||
restart: always
|
restart: always
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
# Interim MCP gateway image: upstream federatedcomputer/mcpserver PLUS the
|
||||||
|
# superbrain MCP server, until the mcpserver repo bakes it in officially
|
||||||
|
# (apps_registry.py entry + package install in its own Dockerfile).
|
||||||
|
#
|
||||||
|
# Build from the repo root:
|
||||||
|
# docker buildx build --platform linux/amd64,linux/arm64 --push \
|
||||||
|
# -f deploy/federated/mcpserver-superbrain.Dockerfile \
|
||||||
|
# -t federatedcomputer/mcpserver-superbrain:1.8.8 .
|
||||||
|
#
|
||||||
|
# The suite's mcpserver service file then uses
|
||||||
|
# CONTAINER=federatedcomputer/mcpserver-superbrain (VERSION_RX stays
|
||||||
|
# digits-only: 1.8.8). Published 2026-11-05 for the erwin attach; delete
|
||||||
|
# once upstream ships superbrain support and the service CONTAINER moves
|
||||||
|
# back to federatedcomputer/mcpserver.
|
||||||
|
FROM federatedcomputer/mcpserver:1.8.8
|
||||||
|
|
||||||
|
COPY mcp/ /src/superbrain-mcp/
|
||||||
|
RUN pipx install /src/superbrain-mcp \
|
||||||
|
&& rm -rf /src/superbrain-mcp \
|
||||||
|
&& python3 - <<'PY'
|
||||||
|
p = "/app/apps_registry.py"
|
||||||
|
s = open(p).read()
|
||||||
|
entry = ''' "superbrain": {
|
||||||
|
"required_env": "SUPERBRAIN_API_URL",
|
||||||
|
"command": "superbrain-mcp",
|
||||||
|
"args": [],
|
||||||
|
},
|
||||||
|
'''
|
||||||
|
assert '"superbrain"' not in s, "registry already has superbrain"
|
||||||
|
assert s.count(' "plausible": {') == 1
|
||||||
|
s = s.replace(' "plausible": {', entry + ' "plausible": {', 1)
|
||||||
|
open(p, "w").write(s)
|
||||||
|
print("apps_registry patched: superbrain entry added")
|
||||||
|
PY
|
||||||
@@ -2,7 +2,7 @@ NAME=superbrain
|
|||||||
DESCRIPTION="Bookmark & Knowledge Base"
|
DESCRIPTION="Bookmark & Knowledge Base"
|
||||||
DOCS=https://github.com/andrew/superbrain
|
DOCS=https://github.com/andrew/superbrain
|
||||||
CONTAINER=federatedcomputer/superbrain-app
|
CONTAINER=federatedcomputer/superbrain-app
|
||||||
VERSION=1.2.3
|
VERSION=1.2.5
|
||||||
INTERNAL_IP=192.168.0.93
|
INTERNAL_IP=192.168.0.93
|
||||||
DEPENDS="postgresql"
|
DEPENDS="postgresql"
|
||||||
PORTS=3000
|
PORTS=3000
|
||||||
|
|||||||
+5
-2
@@ -7,13 +7,16 @@ name = "superbrain-mcp"
|
|||||||
# Versioned in lockstep with the Superbrain release it speaks to (house
|
# Versioned in lockstep with the Superbrain release it speaks to (house
|
||||||
# tooling tracks one version per app); the federated mcpserver gateway
|
# tooling tracks one version per app); the federated mcpserver gateway
|
||||||
# installs this package and spawns `superbrain-mcp` per linked instance.
|
# installs this package and spawns `superbrain-mcp` per linked instance.
|
||||||
version = "1.2.3"
|
version = "1.2.5"
|
||||||
description = "MCP server for Superbrain — bookmarks, tags and pages over the Superbrain REST API"
|
description = "MCP server for Superbrain — bookmarks, tags and pages over the Superbrain REST API"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
requires-python = ">=3.10"
|
requires-python = ">=3.10"
|
||||||
license = { text = "MIT" }
|
license = { text = "MIT" }
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"mcp>=1.2",
|
# Pinned to the 1.x line: the federated gateway ecosystem (mcp-proxy,
|
||||||
|
# hub_entrypoint, every sibling server) uses the v1 FastMCP API; mcp 2.x
|
||||||
|
# renamed it to MCPServer and breaks at import inside the gateway venv.
|
||||||
|
"mcp>=1.2,<2",
|
||||||
"httpx>=0.27",
|
"httpx>=0.27",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
"""Superbrain MCP server — bookmarks, tags and pages for AI tooling."""
|
"""Superbrain MCP server — bookmarks, tags and pages for AI tooling."""
|
||||||
|
|
||||||
__version__ = "1.2.3"
|
__version__ = "1.2.5"
|
||||||
|
|||||||
+10
-10
@@ -439,24 +439,24 @@ try {
|
|||||||
await inboxColumn.locator('[data-bookmark-id="bookmark-3"]').waitFor()
|
await inboxColumn.locator('[data-bookmark-id="bookmark-3"]').waitFor()
|
||||||
console.log('PASS: kanban drag reorders within a column and moves cards between columns')
|
console.log('PASS: kanban drag reorders within a column and moves cards between columns')
|
||||||
|
|
||||||
// Page tabs share the persisted position with the sidebar; dragging a tab
|
// The sidebar persists the complete order permutation (PUT /api/pages);
|
||||||
// issues the complete order permutation and both surfaces reload. Reset the
|
// drag b above a. Reset the pin from the earlier metadata test so both
|
||||||
// pin from the earlier metadata test so both pages are in one reorder group.
|
// pages are in one reorder group.
|
||||||
pages.get('a').pinned = false
|
pages.get('a').pinned = false
|
||||||
await page.goto(`${base}/pages`)
|
await page.goto(`${base}/pages`)
|
||||||
await page.locator('[data-page-tab="a"]').waitFor()
|
await page.locator('[data-page-id="a"]').waitFor()
|
||||||
await page.locator('[data-page-tab="b"] [data-page-tab-drag]').dragTo(
|
await page.locator('[data-page-id="b"] [data-page-drag-handle]').dragTo(
|
||||||
page.locator('[data-page-tab="a"]'),
|
page.locator('[data-page-id="a"]'),
|
||||||
{ targetPosition: { x: 5, y: 5 } },
|
{ targetPosition: { x: 10, y: 5 } },
|
||||||
)
|
)
|
||||||
await eventually(() => pages.get('b')?.position === 0 && pages.get('a')?.position === 1, 'Page tab drag did not reorder')
|
await eventually(() => pages.get('b')?.position === 0 && pages.get('a')?.position === 1, 'Sidebar page drag did not reorder')
|
||||||
// The sidebar uses the same complete order permutation; drag a back above b.
|
// And drag a back above b.
|
||||||
await page.locator('[data-page-id="a"] [data-page-drag-handle]').dragTo(
|
await page.locator('[data-page-id="a"] [data-page-drag-handle]').dragTo(
|
||||||
page.locator('[data-page-id="b"]'),
|
page.locator('[data-page-id="b"]'),
|
||||||
{ targetPosition: { x: 10, y: 5 } },
|
{ targetPosition: { x: 10, y: 5 } },
|
||||||
)
|
)
|
||||||
await eventually(() => pages.get('a')?.position === 0 && pages.get('b')?.position === 1, 'Sidebar page drag did not reorder')
|
await eventually(() => pages.get('a')?.position === 0 && pages.get('b')?.position === 1, 'Sidebar page drag did not reorder')
|
||||||
console.log('PASS: page tabs and sidebar persist drag reordering')
|
console.log('PASS: sidebar persists drag reordering')
|
||||||
|
|
||||||
// Revocation failure path (review CR-02): when Go's revocation fails, the
|
// Revocation failure path (review CR-02): when Go's revocation fails, the
|
||||||
// local sign-out still completes, but the UI must say so — local cookie
|
// local sign-out still completes, but the UI must say so — local cookie
|
||||||
|
|||||||
@@ -7,9 +7,9 @@ import ReactMarkdown from 'react-markdown'
|
|||||||
import remarkGfm from 'remark-gfm'
|
import remarkGfm from 'remark-gfm'
|
||||||
import { toast } from 'sonner'
|
import { toast } from 'sonner'
|
||||||
import {
|
import {
|
||||||
ChevronLeft, ChevronRight, Code, CornerUpLeft, Download, Eye, FileText, GripVertical,
|
Code, CornerUpLeft, Download, Eye, FileText,
|
||||||
Heading1, Heading2, Heading3, History, Layers, Link2, List, ListOrdered, ListTodo, Minus, Pencil,
|
Heading1, Heading2, Heading3, History, Layers, Link2, List, ListOrdered, ListTodo, Minus, Pencil,
|
||||||
Pin, PinOff, Plus, Quote, RotateCcw, Search, Trash2, Type, X,
|
Pin, PinOff, Plus, Quote, RotateCcw, Trash2, Type, X,
|
||||||
} from 'lucide-react'
|
} from 'lucide-react'
|
||||||
import { Button } from '@/components/ui/button'
|
import { Button } from '@/components/ui/button'
|
||||||
import { Input } from '@/components/ui/input'
|
import { Input } from '@/components/ui/input'
|
||||||
@@ -23,7 +23,6 @@ import {
|
|||||||
PAGES_CHANGED, collectionEmbedMarkdown, descendantPageIds, internalPageId, nextUntitledTitle,
|
PAGES_CHANGED, collectionEmbedMarkdown, descendantPageIds, internalPageId, nextUntitledTitle,
|
||||||
notifyActivePage, notifyPagesChanged, pageLinkMarkdown, parsePageEmbed, type PageSummary,
|
notifyActivePage, notifyPagesChanged, pageLinkMarkdown, parsePageEmbed, type PageSummary,
|
||||||
} from '@/lib/pages'
|
} from '@/lib/pages'
|
||||||
import { reorderPages } from '@/lib/page-order'
|
|
||||||
import { fetchLinkPreview } from '@/lib/link-preview'
|
import { fetchLinkPreview } from '@/lib/link-preview'
|
||||||
import { LinkPreviewCard } from '@/components/link-preview-card'
|
import { LinkPreviewCard } from '@/components/link-preview-card'
|
||||||
import type { Element, ElementContent } from 'hast'
|
import type { Element, ElementContent } from 'hast'
|
||||||
@@ -184,7 +183,6 @@ export function PagesClient({ initialId }: { initialId: string | null }) {
|
|||||||
const [pages, setPages] = useState<PageSummary[]>([])
|
const [pages, setPages] = useState<PageSummary[]>([])
|
||||||
const [activeId, setActiveId] = useState<string | null>(initialId)
|
const [activeId, setActiveId] = useState<string | null>(initialId)
|
||||||
const [page, setPage] = useState<PageDetail | null>(null)
|
const [page, setPage] = useState<PageDetail | null>(null)
|
||||||
const [filter, setFilter] = useState('')
|
|
||||||
const [mode, setMode] = useState<'edit' | 'preview'>('preview')
|
const [mode, setMode] = useState<'edit' | 'preview'>('preview')
|
||||||
const [title, setTitle] = useState('')
|
const [title, setTitle] = useState('')
|
||||||
const [content, setContent] = useState('')
|
const [content, setContent] = useState('')
|
||||||
@@ -202,11 +200,8 @@ export function PagesClient({ initialId }: { initialId: string | null }) {
|
|||||||
const [historyBusy, setHistoryBusy] = useState<string | null>(null)
|
const [historyBusy, setHistoryBusy] = useState<string | null>(null)
|
||||||
const [slash, setSlash] = useState<{ query: string; start: number } | null>(null)
|
const [slash, setSlash] = useState<{ query: string; start: number } | null>(null)
|
||||||
const [slashIndex, setSlashIndex] = useState(0)
|
const [slashIndex, setSlashIndex] = useState(0)
|
||||||
const [tabDrop, setTabDrop] = useState<{ id: string; after: boolean } | null>(null)
|
|
||||||
const textareaRef = useRef<HTMLTextAreaElement>(null)
|
const textareaRef = useRef<HTMLTextAreaElement>(null)
|
||||||
const pendingCaret = useRef<number | null>(null)
|
const pendingCaret = useRef<number | null>(null)
|
||||||
const suppressTabClick = useRef(false)
|
|
||||||
const draggedTabRef = useRef<string | null>(null)
|
|
||||||
const activePage = useRef(initialId)
|
const activePage = useRef(initialId)
|
||||||
const loadSequence = useRef(0)
|
const loadSequence = useRef(0)
|
||||||
const selectionSequence = useRef(0)
|
const selectionSequence = useRef(0)
|
||||||
@@ -504,34 +499,6 @@ export function PagesClient({ initialId }: { initialId: string | null }) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const move = async (dir: -1 | 1) => {
|
|
||||||
if (!activeId) return
|
|
||||||
const idx = pages.findIndex((p) => p.id === activeId)
|
|
||||||
const target = pages[idx + dir]
|
|
||||||
if (idx < 0 || !target) return
|
|
||||||
const next = reorderPages(pages, activeId, target.id, dir > 0)
|
|
||||||
if (next === 'blocked') { toast.error('Pinned and unpinned pages keep separate groups'); return }
|
|
||||||
if (next) await savePageOrder(next)
|
|
||||||
}
|
|
||||||
|
|
||||||
const savePageOrder = async (next: PageSummary[]) => {
|
|
||||||
setPages(next)
|
|
||||||
const res = await fetch('/api/pages', { method: 'PUT', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ order: next.map((p) => p.id) }) })
|
|
||||||
if (!res.ok) { toast.error('Could not reorder pages'); await loadPages(); return }
|
|
||||||
await loadPages()
|
|
||||||
notify()
|
|
||||||
}
|
|
||||||
|
|
||||||
const dropTab = (target: PageSummary, after: boolean) => {
|
|
||||||
const source = draggedTabRef.current
|
|
||||||
draggedTabRef.current = null
|
|
||||||
setTabDrop(null)
|
|
||||||
if (!source) return
|
|
||||||
const next = reorderPages(pages, source, target.id, after)
|
|
||||||
if (next === 'blocked') { toast.error('Pinned and unpinned pages keep separate groups'); return }
|
|
||||||
if (next) void savePageOrder(next)
|
|
||||||
}
|
|
||||||
|
|
||||||
const download = async () => {
|
const download = async () => {
|
||||||
if (!activeId) return
|
if (!activeId) return
|
||||||
// A paused conflict can never flush; exporting the server copy is still
|
// A paused conflict can never flush; exporting the server copy is still
|
||||||
@@ -658,7 +625,6 @@ export function PagesClient({ initialId }: { initialId: string | null }) {
|
|||||||
if (/^https?:\/\/\S+$/i.test(text)) offerTitleForPastedUrl(text)
|
if (/^https?:\/\/\S+$/i.test(text)) offerTitleForPastedUrl(text)
|
||||||
}
|
}
|
||||||
|
|
||||||
const visible = pages.filter((p) => p.title.toLowerCase().includes(filter.toLowerCase()))
|
|
||||||
const looksLikeUrl = /^(https?:\/\/)?[\w-]+(\.[\w-]+)+/i.test(linkQuery.trim())
|
const looksLikeUrl = /^(https?:\/\/)?[\w-]+(\.[\w-]+)+/i.test(linkQuery.trim())
|
||||||
// A page may move under any page except itself or one of its descendants
|
// A page may move under any page except itself or one of its descendants
|
||||||
// (the server rejects that cycle even if a stale client tries it).
|
// (the server rejects that cycle even if a stale client tries it).
|
||||||
@@ -670,74 +636,6 @@ export function PagesClient({ initialId }: { initialId: string | null }) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex h-full flex-col">
|
<div className="flex h-full flex-col">
|
||||||
<div className="flex items-center gap-2 border-b border-border/60 px-4 py-2">
|
|
||||||
<div className="relative w-40 shrink-0">
|
|
||||||
<Search className="absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground" />
|
|
||||||
<Input value={filter} onChange={(e) => setFilter(e.target.value)} placeholder="Filter pages" className="h-8 pl-7 text-sm" />
|
|
||||||
</div>
|
|
||||||
<div className="flex flex-1 items-center gap-1 overflow-x-auto">
|
|
||||||
{visible.map((p) => (
|
|
||||||
<div
|
|
||||||
key={p.id}
|
|
||||||
data-page-tab={p.id}
|
|
||||||
onDragOver={(e) => {
|
|
||||||
if (!draggedTabRef.current || draggedTabRef.current === p.id) return
|
|
||||||
e.preventDefault()
|
|
||||||
e.dataTransfer.dropEffect = 'move'
|
|
||||||
const rect = e.currentTarget.getBoundingClientRect()
|
|
||||||
setTabDrop({ id: p.id, after: e.clientX > rect.left + rect.width / 2 })
|
|
||||||
}}
|
|
||||||
onDragLeave={(e) => {
|
|
||||||
if (!e.currentTarget.contains(e.relatedTarget as Node | null)) setTabDrop(null)
|
|
||||||
}}
|
|
||||||
onDrop={(e) => {
|
|
||||||
e.preventDefault()
|
|
||||||
const rect = e.currentTarget.getBoundingClientRect()
|
|
||||||
dropTab(p, e.clientX > rect.left + rect.width / 2)
|
|
||||||
}}
|
|
||||||
title={filter.trim() ? 'Clear the filter to reorder pages' : 'Drag the grip to reorder page'}
|
|
||||||
className={cn(
|
|
||||||
'group/tab flex shrink-0 items-center gap-1 rounded-md px-2 py-1.5 text-sm transition-colors',
|
|
||||||
p.id === activeId ? 'bg-primary/10 font-medium text-primary' : 'text-muted-foreground hover:bg-muted hover:text-foreground',
|
|
||||||
tabDrop?.id === p.id && 'ring-1 ring-primary/50',
|
|
||||||
)}
|
|
||||||
>
|
|
||||||
{!filter.trim() && (
|
|
||||||
<span
|
|
||||||
data-page-tab-drag
|
|
||||||
draggable
|
|
||||||
onDragStart={(e) => {
|
|
||||||
suppressTabClick.current = true
|
|
||||||
draggedTabRef.current = p.id
|
|
||||||
e.dataTransfer.effectAllowed = 'move'
|
|
||||||
e.dataTransfer.setData('text/plain', p.id)
|
|
||||||
}}
|
|
||||||
onDragEnd={() => {
|
|
||||||
draggedTabRef.current = null
|
|
||||||
setTabDrop(null)
|
|
||||||
setTimeout(() => { suppressTabClick.current = false }, 0)
|
|
||||||
}}
|
|
||||||
className="cursor-grab text-muted-foreground/40 opacity-0 transition-opacity hover:text-muted-foreground active:cursor-grabbing group-hover/tab:opacity-100"
|
|
||||||
aria-label={`Drag page ${p.title}`}
|
|
||||||
>
|
|
||||||
<GripVertical className="h-3 w-3" />
|
|
||||||
</span>
|
|
||||||
)}
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
onClick={() => { if (!suppressTabClick.current) select(p.id) }}
|
|
||||||
aria-label={p.title}
|
|
||||||
className="flex min-w-0 items-center gap-1.5"
|
|
||||||
>
|
|
||||||
{p.pinned ? <Pin className="h-3 w-3" /> : <FileText className="h-3 w-3" />}
|
|
||||||
<span className="max-w-[10rem] truncate">{p.title}</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
<Button size="sm" onClick={createPage}><Plus className="mr-1 h-4 w-4" />New page</Button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{!page || page.id !== activeId ? (
|
{!page || page.id !== activeId ? (
|
||||||
<div className="flex flex-1 flex-col items-center justify-center gap-3 p-10 text-center">
|
<div className="flex flex-1 flex-col items-center justify-center gap-3 p-10 text-center">
|
||||||
<FileText className="h-10 w-10 text-muted-foreground" />
|
<FileText className="h-10 w-10 text-muted-foreground" />
|
||||||
@@ -753,8 +651,6 @@ export function PagesClient({ initialId }: { initialId: string | null }) {
|
|||||||
{saveState === 'dirty' && <Button size="sm" variant="outline" onClick={() => autosave.flush(page.id)}>Save now</Button>}
|
{saveState === 'dirty' && <Button size="sm" variant="outline" onClick={() => autosave.flush(page.id)}>Save now</Button>}
|
||||||
<Button variant="ghost" size="icon-sm" title={mode === 'edit' ? 'Preview' : 'Edit'} onClick={() => { setMode(mode === 'edit' ? 'preview' : 'edit'); setSlash(null) }}>{mode === 'edit' ? <Eye className="h-4 w-4" /> : <Pencil className="h-4 w-4" />}</Button>
|
<Button variant="ghost" size="icon-sm" title={mode === 'edit' ? 'Preview' : 'Edit'} onClick={() => { setMode(mode === 'edit' ? 'preview' : 'edit'); setSlash(null) }}>{mode === 'edit' ? <Eye className="h-4 w-4" /> : <Pencil className="h-4 w-4" />}</Button>
|
||||||
<Button variant="ghost" size="icon-sm" title={page.pinned ? 'Unpin' : 'Pin to sidebar'} onClick={togglePin}>{page.pinned ? <PinOff className="h-4 w-4" /> : <Pin className="h-4 w-4" />}</Button>
|
<Button variant="ghost" size="icon-sm" title={page.pinned ? 'Unpin' : 'Pin to sidebar'} onClick={togglePin}>{page.pinned ? <PinOff className="h-4 w-4" /> : <Pin className="h-4 w-4" />}</Button>
|
||||||
<Button variant="ghost" size="icon-sm" title="Move tab left" onClick={() => move(-1)}><ChevronLeft className="h-4 w-4" /></Button>
|
|
||||||
<Button variant="ghost" size="icon-sm" title="Move tab right" onClick={() => move(1)}><ChevronRight className="h-4 w-4" /></Button>
|
|
||||||
<Button variant="ghost" size="icon-sm" title="Download .md" onClick={download}><Download className="h-4 w-4" /></Button>
|
<Button variant="ghost" size="icon-sm" title="Download .md" onClick={download}><Download className="h-4 w-4" /></Button>
|
||||||
<Button variant="ghost" size="icon-sm" title="Version history" onClick={() => void openHistory()}><History className="h-4 w-4" /></Button>
|
<Button variant="ghost" size="icon-sm" title="Version history" onClick={() => void openHistory()}><History className="h-4 w-4" /></Button>
|
||||||
<Button variant="ghost" size="icon-sm" title="Move to trash" onClick={remove}><Trash2 className="h-4 w-4 text-destructive" /></Button>
|
<Button variant="ghost" size="icon-sm" title="Move to trash" onClick={remove}><Trash2 className="h-4 w-4 text-destructive" /></Button>
|
||||||
|
|||||||
Reference in New Issue
Block a user