From 1b824149940ac0ed720267046157f5f47cad2d4e Mon Sep 17 00:00:00 2001 From: Renfei Zhou Date: Wed, 18 Nov 2026 23:22:00 +0000 Subject: [PATCH] feat(fork): open the whiteboard as a right-panel tab and let browsers arrange the panel menu On a machine whose whiteboard config maps a hostname to "app", that hostname opens T3 Code itself, and the right panel's "+" menu and empty launcher offer Whiteboard: the project's board, framed from the board page's new board-only embed mode. The same config's rightPanelMenu sets the machine's defaults for hiding menu items and for their letters; Settings > Right panel lets each browser override them. Conflicts resolve silently. Without "app", run-t3.sh leaves the role off and T3 shows today's menus, page and bridge. Co-Authored-By: Claude Opus 5.5 --- README.md | 1 + .../src/environment/ServerEnvironment.ts | 2 + apps/server/src/fork/whiteboardPanel.test.ts | 53 +++++ apps/server/src/fork/whiteboardPanel.ts | 40 ++++ apps/web/src/closedViewStore.ts | 1 + apps/web/src/components/ChatMarkdown.tsx | 3 +- apps/web/src/components/RightPanelTabs.tsx | 38 +++- apps/web/src/components/chat/ChatComposer.tsx | 8 +- .../chat/RightPanelSurfaceContent.tsx | 3 + .../settings/SettingsScopeSentence.tsx | 1 + .../settings/SettingsSidebarNav.tsx | 6 +- .../settings/settingsSearch.test.ts | 1 + .../src/components/settings/settingsSearch.ts | 16 +- .../useAvailableSettingsSearchItems.ts | 3 + .../src/fork/dashboard/dashboardSurface.ts | 67 ++++-- apps/web/src/fork/forkCopy.ts | 16 ++ .../rightPanelMenu/RightPanelMenuSettings.tsx | 210 ++++++++++++++++++ .../fork/rightPanelMenu/menu.logic.test.ts | 138 ++++++++++++ .../web/src/fork/rightPanelMenu/menu.logic.ts | 99 +++++++++ .../fork/rightPanelMenu/rightPanelMenu.tsx | 65 ++++++ .../src/fork/whiteboard/WhiteboardPanel.tsx | 54 +++++ .../whiteboard/boardChannel.logic.test.ts | 105 +++++++++ .../src/fork/whiteboard/boardChannel.logic.ts | 101 +++++++++ apps/web/src/fork/whiteboard/boardChannel.ts | 175 +++++++++++++++ .../fork/whiteboard/markdown-whiteboard.ts | 8 +- apps/web/src/fork/whiteboard/role.ts | 84 +++++++ .../fork/whiteboard/useWhiteboardInsertRef.ts | 59 +++-- apps/web/src/rightPanelStore.ts | 6 +- apps/web/src/routeTree.gen.ts | 21 ++ .../src/routes/_chat.settings.right-panel.tsx | 7 + fork/whiteboard/README.md | 8 +- fork/whiteboard/package.json | 2 +- fork/whiteboard/run-t3.md | 3 +- fork/whiteboard/run-t3.sh | 17 ++ fork/whiteboard/server/config.mjs | 2 +- fork/whiteboard/vite.config.ts | 24 +- fork/whiteboard/web/bridge.ts | 10 + fork/whiteboard/web/main.tsx | 75 +++++-- fork/whiteboard/web/pageMode.check.ts | 60 +++++ fork/whiteboard/web/pageMode.ts | 36 +++ fork/whiteboard/web/panelHost.ts | 51 +++++ fork/whiteboard/web/refs.tsx | 17 +- packages/contracts/src/environment.ts | 3 + .../contracts/src/fork/rightPanelMenu.test.ts | 16 ++ packages/contracts/src/fork/rightPanelMenu.ts | 36 +++ packages/contracts/src/index.ts | 1 + packages/contracts/src/settings.ts | 6 + 47 files changed, 1671 insertions(+), 87 deletions(-) create mode 100644 apps/server/src/fork/whiteboardPanel.test.ts create mode 100644 apps/server/src/fork/whiteboardPanel.ts create mode 100644 apps/web/src/fork/rightPanelMenu/RightPanelMenuSettings.tsx create mode 100644 apps/web/src/fork/rightPanelMenu/menu.logic.test.ts create mode 100644 apps/web/src/fork/rightPanelMenu/menu.logic.ts create mode 100644 apps/web/src/fork/rightPanelMenu/rightPanelMenu.tsx create mode 100644 apps/web/src/fork/whiteboard/WhiteboardPanel.tsx create mode 100644 apps/web/src/fork/whiteboard/boardChannel.logic.test.ts create mode 100644 apps/web/src/fork/whiteboard/boardChannel.logic.ts create mode 100644 apps/web/src/fork/whiteboard/boardChannel.ts create mode 100644 apps/web/src/fork/whiteboard/role.ts create mode 100644 apps/web/src/routes/_chat.settings.right-panel.tsx create mode 100644 fork/whiteboard/web/pageMode.check.ts create mode 100644 fork/whiteboard/web/pageMode.ts create mode 100644 fork/whiteboard/web/panelHost.ts create mode 100644 packages/contracts/src/fork/rightPanelMenu.test.ts create mode 100644 packages/contracts/src/fork/rightPanelMenu.ts diff --git a/README.md b/README.md index 7854e0248a89a..df529a9a1ca7e 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ This is a fork of T3 Code that integrates a few additional features, including: - **Whiteboard:** A tldraw whiteboard that sits side-by-side with T3 Code, allowing users to interact with agents (or other users) by editing and pointing to the whiteboard. Both the user and the agents can conveniently write links that point to a rectangular region on the whiteboard. Agents can also draw Mermaid diagrams on it, such as flowcharts and statecharts. + - When the whiteboard's config maps T3 Code's hostname to `"app"`, that hostname opens T3 Code itself, and the project's board opens as a Whiteboard tab in its right panel (+ → Whiteboard). There, Settings → Right panel lets each browser hide items of the + menu or change their letters, over machine defaults set in the whiteboard's config. - **Better support for manually switching accounts mid-session:** - After hitting the usage limit of an account, the thread now retries after 2 minutes and 30 minutes in addition to the default retry behavior of T3 Code. This allows the thread to recover earlier if the user manually switches the account. - New Codex/Antigravity logins are picked up mid-session without a full restart. diff --git a/apps/server/src/environment/ServerEnvironment.ts b/apps/server/src/environment/ServerEnvironment.ts index a22abf194aa22..4cb94fadc9d6b 100644 --- a/apps/server/src/environment/ServerEnvironment.ts +++ b/apps/server/src/environment/ServerEnvironment.ts @@ -24,6 +24,7 @@ import { databaseMigrationHead } from "../persistence/databaseMigrationHead.ts"; import * as ProcessRunner from "../processRunner.ts"; import { isSpeechPlatformSupported } from "../speech/platform.ts"; import { fastCheckoutCapabilities } from "../fork/reflinkWorktrees/fastCheckoutSetting.ts"; +import { whiteboardPanelCapabilities } from "../fork/whiteboardPanel.ts"; import { resolveServerEnvironmentLabel } from "./ServerEnvironmentLabel.ts"; import { detectServerEnvironmentMachineKind } from "./ServerEnvironmentMachine.ts"; @@ -303,6 +304,7 @@ export const make = Effect.gen(function* () { mcpHostedApproval: true, shellThreadFamilies: true, shellOlderSettled: true, + ...(yield* whiteboardPanelCapabilities()), }, }; diff --git a/apps/server/src/fork/whiteboardPanel.test.ts b/apps/server/src/fork/whiteboardPanel.test.ts new file mode 100644 index 0000000000000..ddd87ad5982ff --- /dev/null +++ b/apps/server/src/fork/whiteboardPanel.test.ts @@ -0,0 +1,53 @@ +import { expect, it } from "@effect/vitest"; +import * as HostProcess from "@t3tools/shared/HostProcess"; +import * as Effect from "effect/Effect"; + +import { parseWhiteboardPanel, whiteboardPanelCapabilities } from "./whiteboardPanel.ts"; + +it.each([ + { raw: "not json", expected: undefined }, + { raw: "[]", expected: undefined }, + { raw: "null", expected: undefined }, + { raw: '"app"', expected: undefined }, + { raw: "{}", expected: { menu: {} } }, + { raw: '{"menu":"browser"}', expected: { menu: {} } }, + { + raw: JSON.stringify({ + menu: { + browser: { hidden: true, key: "x" }, + files: { hidden: "yes", key: "" }, + diff: { key: "DD" }, + device: { key: "é" }, + terminal: "hidden", + whiteboard: [], + "future-item": { key: "7", extra: 1 }, + }, + }), + expected: { + menu: { + browser: { hidden: true, key: "X" }, + files: { key: "" }, + diff: {}, + device: {}, + "future-item": { key: "7" }, + }, + }, + }, +])("parses $raw leniently", ({ raw, expected }) => { + expect(parseWhiteboardPanel(raw)).toEqual(expected); +}); + +it.effect("advertises the board host only while the variable holds an object", () => + Effect.gen(function* () { + const capabilities = (environment: NodeJS.ProcessEnv) => + whiteboardPanelCapabilities().pipe( + Effect.provideService(HostProcess.Environment, environment), + ); + + expect(yield* capabilities({})).toEqual({}); + expect(yield* capabilities({ T3CODE_WHITEBOARD_PANEL: "{oops" })).toEqual({}); + expect( + yield* capabilities({ T3CODE_WHITEBOARD_PANEL: '{"menu":{"files":{"hidden":true}}}' }), + ).toEqual({ whiteboardPanel: { menu: { files: { hidden: true } } } }); + }), +); diff --git a/apps/server/src/fork/whiteboardPanel.ts b/apps/server/src/fork/whiteboardPanel.ts new file mode 100644 index 0000000000000..ad57532e894ed --- /dev/null +++ b/apps/server/src/fork/whiteboardPanel.ts @@ -0,0 +1,40 @@ +import { parseRightPanelMenuChoice, type WhiteboardPanelCapability } from "@t3tools/contracts"; +import * as HostProcess from "@t3tools/shared/HostProcess"; +import * as Effect from "effect/Effect"; + +const isRecord = (value: unknown): value is Record => + typeof value === "object" && value !== null && !Array.isArray(value); + +/** The value of `T3CODE_WHITEBOARD_PANEL`; undefined unless it is a JSON object. */ +export function parseWhiteboardPanel(raw: string): WhiteboardPanelCapability | undefined { + let value: unknown; + try { + value = JSON.parse(raw); + } catch { + return undefined; + } + if (!isRecord(value)) return undefined; + const menu = isRecord(value.menu) ? value.menu : {}; + return { + menu: Object.fromEntries( + Object.entries(menu).flatMap(([id, entry]) => { + const choice = parseRightPanelMenuChoice(entry); + return choice === undefined ? [] : [[id, choice]]; + }), + ), + }; +} + +// The whiteboard's run-t3.sh sets the variable only on a board host, from its deploy-time config. +export const whiteboardPanelCapabilities = Effect.fn("whiteboardPanel.capabilities")(function* () { + const raw = (yield* HostProcess.Environment).T3CODE_WHITEBOARD_PANEL; + if (raw === undefined) return {}; + const whiteboardPanel = parseWhiteboardPanel(raw); + if (whiteboardPanel === undefined) { + yield* Effect.logWarning( + "T3CODE_WHITEBOARD_PANEL is not a JSON object; the board panel is off", + ); + return {}; + } + return { whiteboardPanel }; +}); diff --git a/apps/web/src/closedViewStore.ts b/apps/web/src/closedViewStore.ts index 8a5c541c0e6c0..1e9e7dabf5422 100644 --- a/apps/web/src/closedViewStore.ts +++ b/apps/web/src/closedViewStore.ts @@ -65,6 +65,7 @@ const isClosedViewEntry = (entry: unknown): entry is ClosedViewEntry => { case "pull-requests": case "dashboard": case "replies": + case "whiteboard": return surface.id === surface.kind; case "preview": return surface.resourceId === null || typeof surface.resourceId === "string"; diff --git a/apps/web/src/components/ChatMarkdown.tsx b/apps/web/src/components/ChatMarkdown.tsx index 6fe01f92a4999..ef7d40b71ff32 100644 --- a/apps/web/src/components/ChatMarkdown.tsx +++ b/apps/web/src/components/ChatMarkdown.tsx @@ -99,6 +99,7 @@ import type { } from "react-markdown"; import { createIncrementalMarkdownPlugin } from "../markdown-incremental"; import { postWhiteboardHover, remarkWhiteboardLinks } from "../fork/whiteboard/markdown-whiteboard"; +import { showBoardRef } from "../fork/whiteboard/boardChannel"; import { remarkEndLinksAtCjkPunctuation } from "../fork/cjkLinkEnd"; import type { Pluggable, PluggableList } from "unified"; import { defaultUrlTransform } from "react-markdown"; @@ -1307,7 +1308,7 @@ const CHAT_MARKDOWN_COMPONENTS = { onClick?.(event); if (isWhiteboardLink && href) { event.preventDefault(); - window.parent.postMessage({ type: "wb-highlight", ref: href }, "*"); + showBoardRef(href, threadRef); return; } if (isSameDocumentLink && href) { diff --git a/apps/web/src/components/RightPanelTabs.tsx b/apps/web/src/components/RightPanelTabs.tsx index adb48c3d92651..f6734ad67a883 100644 --- a/apps/web/src/components/RightPanelTabs.tsx +++ b/apps/web/src/components/RightPanelTabs.tsx @@ -32,6 +32,10 @@ import { ModeSurfaceIcon, modeSurfaceLabel, } from "~/fork/dashboard/dashboardSurface"; +import { + AllMenuItemsHidden, + useArrangedSurfaceActions, +} from "~/fork/rightPanelMenu/rightPanelMenu"; import type { SplitMenuAction } from "~/fork/rightPanelSplit/splitLayout.logic"; import { SplitPaneFrame, @@ -359,8 +363,9 @@ function RightPanelEmptyState(props: { const messages = useMessages(); const [highlight, setHighlight] = useState(-1); - const actions = [ + const actions = useArrangedSurfaceActions([ { + id: "browser", label: msg("Browser"), icon: Globe2, shortcut: "B", @@ -369,6 +374,7 @@ function RightPanelEmptyState(props: { onClick: props.onAddBrowser, }, { + id: "terminal", label: msg("Terminal"), icon: TerminalSquare, shortcut: "T", @@ -377,6 +383,7 @@ function RightPanelEmptyState(props: { onClick: props.onAddTerminal, }, { + id: "files", label: msg("Files"), icon: Files, shortcut: "F", @@ -385,6 +392,7 @@ function RightPanelEmptyState(props: { onClick: props.onAddFiles, }, { + id: "diff", label: msg("Diff"), icon: FileDiff, shortcut: "D", @@ -393,6 +401,7 @@ function RightPanelEmptyState(props: { onClick: props.onAddDiff, }, { + id: "pull-request", label: msg("Pull request"), icon: PullRequestGlyph.pullRequest, shortcut: "P", @@ -401,6 +410,7 @@ function RightPanelEmptyState(props: { onClick: props.onAddPullRequest, }, { + id: "pull-requests", label: msg("Linked pull requests"), icon: PullRequestGlyph.link, shortcut: "L", @@ -409,6 +419,7 @@ function RightPanelEmptyState(props: { onClick: props.onAddPullRequests, }, { + id: "device", label: msg("Device"), description: msg("Watch an iOS Simulator or Android Emulator."), icon: Smartphone, @@ -420,6 +431,7 @@ function RightPanelEmptyState(props: { ...(props.onAddSideChat ? [ { + id: "side-chat" as const, label: msg("Side chat"), description: msg("Ask a side question while this thread keeps working."), icon: MessagesSquare, @@ -432,7 +444,7 @@ function RightPanelEmptyState(props: { ] : []), ...(props.modeSurfaceActions ?? []), - ] as const; + ] as const); type SurfaceAction = (typeof actions)[number]; @@ -512,6 +524,7 @@ function RightPanelEmptyState(props: { Open a surface
+ {actions.length === 0 ? : null} {actions.map((action) => action.available ? (
; case "dashboard": case "replies": + case "whiteboard": return ; case "device": return surface.target?.platform === "ios" ? ( @@ -1205,8 +1220,9 @@ export function RightPanelTabs(props: RightPanelTabsProps) { }); }; - const addSurfaceActions = [ + const addSurfaceActions = useArrangedSurfaceActions([ { + id: "browser", label: msg("Browser"), icon: Globe2, shortcut: "B", @@ -1215,6 +1231,7 @@ export function RightPanelTabs(props: RightPanelTabsProps) { onClick: props.onAddBrowser, }, { + id: "terminal", label: msg("Terminal"), icon: TerminalSquare, shortcut: "T", @@ -1223,6 +1240,7 @@ export function RightPanelTabs(props: RightPanelTabsProps) { onClick: props.onAddTerminal, }, { + id: "files", label: msg("Files"), icon: Files, shortcut: "F", @@ -1231,6 +1249,7 @@ export function RightPanelTabs(props: RightPanelTabsProps) { onClick: props.onAddFiles, }, { + id: "diff", label: msg("Diff"), icon: FileDiff, shortcut: "D", @@ -1239,6 +1258,7 @@ export function RightPanelTabs(props: RightPanelTabsProps) { onClick: props.onAddDiff, }, { + id: "pull-request", label: msg("Pull request"), icon: PullRequestGlyph.pullRequest, shortcut: "P", @@ -1247,6 +1267,7 @@ export function RightPanelTabs(props: RightPanelTabsProps) { onClick: props.onAddPullRequest, }, { + id: "pull-requests", label: msg("Linked pull requests"), icon: PullRequestGlyph.link, shortcut: "L", @@ -1255,6 +1276,7 @@ export function RightPanelTabs(props: RightPanelTabsProps) { onClick: props.onAddPullRequests, }, { + id: "device", label: msg("Device"), icon: Smartphone, shortcut: "M", @@ -1265,6 +1287,7 @@ export function RightPanelTabs(props: RightPanelTabsProps) { ...(props.onAddSideChat ? [ { + id: "side-chat" as const, label: msg("Side chat"), icon: MessagesSquare, shortcut: "S", @@ -1276,7 +1299,7 @@ export function RightPanelTabs(props: RightPanelTabsProps) { ] : []), ...(props.modeSurfaceActions ?? []), - ] as const; + ] as const); const handleAddSurfaceMenuKeyDown = (event: ReactKeyboardEvent) => { const action = surfaceShortcutActionForKey(addSurfaceActions, event.nativeEvent); @@ -1563,6 +1586,7 @@ export function RightPanelTabs(props: RightPanelTabsProps) { sideOffset={6} onKeyDownCapture={handleAddSurfaceMenuKeyDown} > + {addSurfaceActions.length === 0 ? : null} {addSurfaceActions.map((action) => { const Icon = action.icon; if (action.label === "Browser" && action.available) { @@ -1570,7 +1594,7 @@ export function RightPanelTabs(props: RightPanelTabsProps) { { const pointerType = "pointerType" in event.nativeEvent && @@ -1585,7 +1609,9 @@ export function RightPanelTabs(props: RightPanelTabsProps) { > {messages(action.label)} - {action.shortcut} + {action.shortcut ? ( + {action.shortcut} + ) : null} {browserProfiles.map((profile) => ( diff --git a/apps/web/src/components/chat/ChatComposer.tsx b/apps/web/src/components/chat/ChatComposer.tsx index 2e9a110e83b00..04cd1987d9e86 100644 --- a/apps/web/src/components/chat/ChatComposer.tsx +++ b/apps/web/src/components/chat/ChatComposer.tsx @@ -1832,7 +1832,13 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps) return true; }; const applyPromptReplacementStable = useStableCallback(applyPromptReplacement); - useWhiteboardInsertRef(composerEditorRef, promptRef, applyPromptReplacementStable); + useWhiteboardInsertRef( + composerEditorRef, + promptRef, + applyPromptReplacementStable, + composerFormRef, + routeThreadRef, + ); const readComposerSnapshot = (): { value: string; diff --git a/apps/web/src/components/chat/RightPanelSurfaceContent.tsx b/apps/web/src/components/chat/RightPanelSurfaceContent.tsx index f42448c75c3de..93c63812375f5 100644 --- a/apps/web/src/components/chat/RightPanelSurfaceContent.tsx +++ b/apps/web/src/components/chat/RightPanelSurfaceContent.tsx @@ -16,6 +16,7 @@ import SideChatPane from "./SideChatPane"; import { ThreadDashboardPanel } from "../../fork/dashboard/ThreadDashboardPanel"; import type { CiteAssistantText } from "../../fork/dashboard/dashboardCitation"; import { SubThreadsPanel } from "../../fork/subThreads/SubThreadsPanel"; +import { WhiteboardPanel } from "../../fork/whiteboard/WhiteboardPanel"; import type { ComposerImageAttachment, DraftId } from "../../composerDraftStore"; import type { ShortcutMatchContext } from "../../keybindings"; import type { SideChatParentPanel } from "../../lib/sideChatPane"; @@ -233,6 +234,8 @@ export function RightPanelSurfaceContent(props: { parentPanel={props.sideChatParentPanel} /> ); + case "whiteboard": + return ; case "side-chat": // Not lazy: revealing a suspended tiptap editor tears down its view and crashes the composer. return ( diff --git a/apps/web/src/components/settings/SettingsScopeSentence.tsx b/apps/web/src/components/settings/SettingsScopeSentence.tsx index 0cf63419806e8..33fe09470b219 100644 --- a/apps/web/src/components/settings/SettingsScopeSentence.tsx +++ b/apps/web/src/components/settings/SettingsScopeSentence.tsx @@ -53,6 +53,7 @@ export const SETTINGS_DEVICE_ONLY_PATHS: ReadonlySet = new Set([ "/settings/appearance", "/settings/chat", "/settings/diffs", + "/settings/right-panel", "/settings/snap-shot", "/settings/connections", // Access picks its environment on the page itself. diff --git a/apps/web/src/components/settings/SettingsSidebarNav.tsx b/apps/web/src/components/settings/SettingsSidebarNav.tsx index 174a80bfd3b67..fc9d9abf3881b 100644 --- a/apps/web/src/components/settings/SettingsSidebarNav.tsx +++ b/apps/web/src/components/settings/SettingsSidebarNav.tsx @@ -25,6 +25,7 @@ import { KeyRoundIcon, MicIcon, PaletteIcon, + PanelRightIcon, SearchIcon, ServerIcon, Settings2Icon, @@ -62,6 +63,7 @@ import { import { useAvailableSettingsSearchItems } from "./useAvailableSettingsSearchItems"; import { handleSettingsSectionKeyDown } from "./settingsSectionNavigation"; import { workspaceAreaProps } from "../../lib/workspaceFocus"; +import { useForkSettingsNavGroups } from "../../fork/rightPanelMenu/rightPanelMenu"; const SnapShotIcon = createLucideIcon("snap-shot", [ [ @@ -97,6 +99,7 @@ const SETTINGS_SECTION_ICONS: Readonly< "/settings/diffs": FileDiffIcon, "/settings/projects": PanelsTopLeftIcon, "/settings/keybindings": KeyboardIcon, + "/settings/right-panel": PanelRightIcon, "/settings/snap-shot": SnapShotIcon, "/settings/providers": BotIcon, "/settings/threads": MessagesSquareIcon, @@ -143,6 +146,7 @@ export function SettingsSidebarNav({ pathname }: { pathname: string }) { const [compactSearchOpen, setCompactSearchOpen] = useState(false); const [activeResultIndex, setActiveResultIndex] = useState(0); const searchableItems = useAvailableSettingsSearchItems(); + const navGroups = useForkSettingsNavGroups(SETTINGS_NAV_GROUPS); const results = searchSettings(query, searchableItems, m); const isSearching = query.trim().length > 0; const hasResults = results.length > 0; @@ -379,7 +383,7 @@ export function SettingsSidebarNav({ pathname }: { pathname: string }) { )}
- {SETTINGS_NAV_GROUPS.map((group, index) => ( + {navGroups.map((group, index) => (
{ "days-before-auto-settle", "linked-environments", "worktree-reflink", + "right-panel-menu", ]); expect(available.map((item) => item.id).filter((id) => gatedIds.has(id))).toEqual([]); }); diff --git a/apps/web/src/components/settings/settingsSearch.ts b/apps/web/src/components/settings/settingsSearch.ts index 9f7d6c8a81b22..4add4488e9fb3 100644 --- a/apps/web/src/components/settings/settingsSearch.ts +++ b/apps/web/src/components/settings/settingsSearch.ts @@ -27,6 +27,7 @@ export type SettingsPath = | "/settings/chat" | "/settings/diffs" | "/settings/keybindings" + | "/settings/right-panel" | "/settings/snap-shot" | "/settings/providers" | "/settings/threads" @@ -75,6 +76,7 @@ export interface SettingsSearchItem { readonly fastWorktreeCheckoutOnly?: boolean; readonly reflinkWorktreesOnly?: boolean; readonly textGeneratorsOnly?: boolean; + readonly rightPanelMenuOnly?: boolean; readonly secondary?: boolean; readonly requiresThreadAutoSettlement?: boolean; } @@ -94,6 +96,8 @@ export interface SettingsSearchAvailability { /** An environment without a provider allow-list, which hides text generators. */ readonly hasTextGeneratorsEnvironment?: boolean; readonly hasPrimaryEnvironment?: boolean; + /** A whiteboard board host, the only place the right panel's menu settings exist. */ + readonly hasRightPanelMenu?: boolean; } export const SETTINGS_SECTION_LABELS: Readonly> = { @@ -104,6 +108,7 @@ export const SETTINGS_SECTION_LABELS: Readonly> = { "/settings/chat": msg("Chat"), "/settings/diffs": msg("Diffs & pull requests"), "/settings/keybindings": msg("Keybindings"), + "/settings/right-panel": FORK_SETTING_TITLES.rightPanel, "/settings/snap-shot": msg("SnapShots"), "/settings/providers": msg("Providers"), "/settings/threads": msg("Threads"), @@ -1007,6 +1012,13 @@ export const SETTINGS_SEARCH_ITEMS = [ searchTerms: [msg("keyboard shortcuts hotkeys commands bindings json")], }, ...KEYBINDING_SEARCH_ITEMS, + { + id: "right-panel-menu", + title: FORK_SETTING_TITLES.rightPanel, + to: "/settings/right-panel", + rightPanelMenuOnly: true, + searchTerms: ["plus menu launcher surface whiteboard board hide show letter shortcut key"], + }, { id: "snap-shot-enabled", title: msg("SnapShots"), @@ -1496,6 +1508,7 @@ const SETTINGS_CATEGORY_SCOPES: Readonly; + +type ForkSurfaceKind = keyof typeof FORK_SURFACES; -const MODE_SURFACES = { - dashboard: { label: "Dashboard", icon: LayoutDashboard }, - replies: { label: "Replies", icon: MessageSquareReply }, -} as const satisfies Record; - -/** The right panel's "+" item that opens one tab of the thread's display. */ -const modeSurfaceAction = (kind: ModeSurfaceKind, onClick: () => void) => ({ - ...MODE_SURFACES[kind], - // No key: an empty shortcut matches no key press and renders no hint. - shortcut: "", - available: true, - disabledReason: "", +/** The right panel's "+" and launcher item that opens the fork tab `kind`. */ +const forkSurfaceAction = (kind: ForkSurfaceKind, available: boolean, onClick: () => void) => ({ + id: kind, + label: FORK_SURFACES[kind].label, + icon: FORK_SURFACES[kind].icon, + shortcut: FORK_SURFACES[kind].shortcut as string, + available, + disabledReason: kind === "whiteboard" ? "Available in a project thread on this machine." : "", onClick, }); -export type ModeSurfaceAction = ReturnType; +export type ModeSurfaceAction = ReturnType; -export const modeSurfaceLabel = (kind: ModeSurfaceKind) => MODE_SURFACES[kind].label; +export const modeSurfaceLabel = (kind: ForkSurfaceKind) => FORK_SURFACES[kind].label; -export const ModeSurfaceIcon = (props: { readonly kind: ModeSurfaceKind }) => - createElement(MODE_SURFACES[props.kind].icon, { className: "size-3 shrink-0" }); +export const ModeSurfaceIcon = (props: { readonly kind: ForkSurfaceKind }) => + createElement(FORK_SURFACES[props.kind].icon, { className: "size-3 shrink-0" }); -/** Whether the thread's display has the tab `kind`, read outside React. Other tabs need no display. */ +/** Whether the thread offers the tab `kind`, read outside React. Upstream tabs always pass. */ export function threadHasModeSurface(threadRef: ScopedThreadRef, kind: string): boolean { - if (!(kind in MODE_SURFACES)) return true; + if (kind === "whiteboard") return boardOfferedFor(threadRef, readThreadProjectRoot(threadRef)); + if (!(kind in FORK_SURFACES)) return true; return modeSurfaces(readThreadDisplay(threadRef)).some((surface) => surface === kind); } -/** The "+" items that open the tabs of the thread's display: Replies, Dashboard, both or none. */ +/** The fork's "+" items: the display's Replies and Dashboard, then Whiteboard on a board host. */ export function useModeSurfaceActions( threadRef: ScopedThreadRef | null, ): ReadonlyArray { const display = useThreadDisplay(threadRef); - const open = useStableCallback((kind: ModeSurfaceKind) => { + const boardPanel = isBoardHost(useBoardHostRole()) && isTopWindow(); + const projectRoot = useThreadProjectRoot(boardPanel ? threadRef : null); + const boardOffered = useBoardOfferedFor(threadRef, projectRoot); + const open = useStableCallback((kind: ForkSurfaceKind) => { if (threadRef !== null) useRightPanelStore.getState().open(threadRef, kind); }); - return modeSurfaces(display).map((kind) => modeSurfaceAction(kind, () => open(kind))); + return [ + ...modeSurfaces(display).map((kind) => forkSurfaceAction(kind, true, () => open(kind))), + ...(boardPanel + ? [forkSurfaceAction("whiteboard", boardOffered, () => open("whiteboard"))] + : []), + ]; } diff --git a/apps/web/src/fork/forkCopy.ts b/apps/web/src/fork/forkCopy.ts index 19b59edf40175..6fdecc5af03a1 100644 --- a/apps/web/src/fork/forkCopy.ts +++ b/apps/web/src/fork/forkCopy.ts @@ -4,6 +4,7 @@ export const FORK_SETTING_TITLES = { worktreeReflink: "Reflink worktrees", newThreadDisplayMode: "Display mode", previewBrowserMode: "Preview browser", + rightPanel: "Right panel", }; export const COMPACT_WHEN_IDLE_LABEL = "Compact when idle"; @@ -11,3 +12,18 @@ export const COMPACT_IDLE_THREADS_DESCRIPTION = "When to compact a large idle Claude thread: after you return, just before its prompt cache expires, when idle, or never. Each Claude provider can override this."; export const OLD_READING_LABEL = "As of"; + +export const RIGHT_PANEL_SETTINGS_COPY = { + intro: + "These choices apply to this browser and override this machine's defaults. Letters work while the + menu or an empty panel is open.", + section: "Menu items", + resetAll: "Reset all", + shown: "Shown", + hidden: "Hidden", + noLetter: "No letter", + none: "none", + byDefault: (value: string) => `Default (${value})`, + resetItem: (label: string) => `Reset ${label} to default`, + visibilityOf: (label: string) => `${label}: shown or hidden`, + letterOf: (label: string) => `${label}: menu letter`, +}; diff --git a/apps/web/src/fork/rightPanelMenu/RightPanelMenuSettings.tsx b/apps/web/src/fork/rightPanelMenu/RightPanelMenuSettings.tsx new file mode 100644 index 0000000000000..b01ea066094a6 --- /dev/null +++ b/apps/web/src/fork/rightPanelMenu/RightPanelMenuSettings.tsx @@ -0,0 +1,210 @@ +import type { RightPanelMenuChoice } from "@t3tools/contracts"; +import { Navigate } from "@tanstack/react-router"; +import { FileDiff, Files, Globe2, MessagesSquare, Smartphone, TerminalSquare } from "lucide-react"; +import type { ComponentType } from "react"; + +import { PullRequestGlyph } from "../../components/pullRequest/pullRequestIcons"; +import { + SettingResetButton, + SettingsPageContainer, + SettingsRow, + SettingsSection, +} from "../../components/settings/settingsLayout"; +import { Button } from "../../components/ui/button"; +import { + Select, + SelectItem, + SelectPopup, + SelectTrigger, + SelectValue, +} from "../../components/ui/select"; +import { + getClientSettings, + updateClientSettings, + useClientSettings, +} from "../../hooks/useSettings"; +import { FORK_SURFACES } from "../dashboard/dashboardSurface"; +import { RIGHT_PANEL_SETTINGS_COPY as COPY } from "../forkCopy"; +import { isBoardHost, useBoardHostRole } from "../whiteboard/role"; +import { + parseMenuLayer, + RIGHT_PANEL_MENU_ITEM_IDS, + type RightPanelMenuItemId, + setMenuChoice, +} from "./menu.logic"; + +interface MenuItemRow { + readonly id: RightPanelMenuItemId; + readonly label: string; + readonly icon: ComponentType<{ className?: string }>; + readonly builtInKey: string; +} + +const forkRow = (kind: keyof typeof FORK_SURFACES) => ({ + label: FORK_SURFACES[kind].label, + icon: FORK_SURFACES[kind].icon, + builtInKey: FORK_SURFACES[kind].shortcut as string, +}); + +// One row per menu id (the type fails without one). The launchers read upstream letters from +// their own items; these copies only name this page's defaults, so keep them equal. +const MENU_ITEM_ROWS = { + browser: { label: "Browser", icon: Globe2, builtInKey: "B" }, + terminal: { label: "Terminal", icon: TerminalSquare, builtInKey: "T" }, + files: { label: "Files", icon: Files, builtInKey: "F" }, + diff: { label: "Diff", icon: FileDiff, builtInKey: "D" }, + "pull-request": { label: "Pull request", icon: PullRequestGlyph.pullRequest, builtInKey: "P" }, + "pull-requests": { label: "Linked pull requests", icon: PullRequestGlyph.link, builtInKey: "L" }, + device: { label: "Device", icon: Smartphone, builtInKey: "M" }, + "side-chat": { label: "Side chat", icon: MessagesSquare, builtInKey: "S" }, + replies: forkRow("replies"), + dashboard: forkRow("dashboard"), + whiteboard: forkRow("whiteboard"), +} satisfies Record>; + +const MENU_ITEMS: ReadonlyArray = RIGHT_PANEL_MENU_ITEM_IDS.map((id) => ({ + id, + ...MENU_ITEM_ROWS[id], +})); + +const LETTERS = [..."ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"]; + +function writeChoice(id: RightPanelMenuItemId, choice: RightPanelMenuChoice) { + void updateClientSettings({ + rightPanelMenuOverrides: setMenuChoice(getClientSettings().rightPanelMenuOverrides, id, choice), + }); +} + +function MenuItemSettingsRow(props: { + readonly item: MenuItemRow; + readonly machine: RightPanelMenuChoice | undefined; + readonly browser: RightPanelMenuChoice; +}) { + const { item, browser } = props; + const { hidden, key } = browser; + const defaultKey = props.machine?.key ?? item.builtInKey; + const visibility = hidden === undefined ? "default" : hidden ? "hidden" : "shown"; + const letter = key === undefined ? "default" : key === "" ? "none" : key; + const visibilityLabel = (value: string | null) => + value === "hidden" + ? COPY.hidden + : value === "shown" + ? COPY.shown + : COPY.byDefault(props.machine?.hidden === true ? COPY.hidden : COPY.shown); + const letterLabel = (value: string | null) => + value === "none" + ? COPY.noLetter + : value === null || value === "default" + ? COPY.byDefault(defaultKey || COPY.none) + : value; + const Icon = item.icon; + return ( + + + {item.label} + + } + resetAction={ + hidden === undefined && key === undefined ? null : ( + writeChoice(item.id, {})} + /> + ) + } + control={ +
+ + +
+ } + /> + ); +} + +export function RightPanelMenuSettingsPanel() { + const role = useBoardHostRole(); + const overrides = useClientSettings((settings) => settings.rightPanelMenuOverrides); + if (role === "unknown") return null; + if (!isBoardHost(role)) return ; + const machine = parseMenuLayer(role.menu); + const browser = parseMenuLayer(overrides); + return ( + +

{COPY.intro}

+ void updateClientSettings({ rightPanelMenuOverrides: {} })} + > + {COPY.resetAll} + + } + > + {MENU_ITEMS.map((item) => ( + + ))} + +
+ ); +} diff --git a/apps/web/src/fork/rightPanelMenu/menu.logic.test.ts b/apps/web/src/fork/rightPanelMenu/menu.logic.test.ts new file mode 100644 index 0000000000000..31f0a10997b48 --- /dev/null +++ b/apps/web/src/fork/rightPanelMenu/menu.logic.test.ts @@ -0,0 +1,138 @@ +import { describe, expect, it } from "vite-plus/test"; + +import { + arrangeSurfaceActions, + parseMenuLayer, + type RightPanelMenuItemId, + setMenuChoice, +} from "./menu.logic"; + +// Today's menu: the upstream items' own letters, then the fork's Replies, Dashboard and Whiteboard. +const TODAY: ReadonlyArray = [ + ["browser", "B"], + ["terminal", "T"], + ["files", "F"], + ["diff", "D"], + ["pull-request", "P"], + ["pull-requests", "L"], + ["device", "M"], + ["side-chat", "S"], + ["replies", ""], + ["dashboard", ""], + ["whiteboard", "W"], +]; + +const actions = (disabled: ReadonlyArray) => + TODAY.map(([id, shortcut]) => ({ + id, + shortcut, + available: !disabled.includes(id), + label: `${id} label`, + })); + +describe("arrangeSurfaceActions", () => { + it.each<{ + name: string; + machine?: Record; + browser?: Record; + disabled?: ReadonlyArray; + letters?: Partial>; + hidden?: ReadonlyArray; + }>([ + { name: "empty layers keep today's letters" }, + { + name: "empty layers keep today's letters on disabled items", + disabled: ["browser", "diff", "side-chat", "whiteboard"], + }, + { + name: "unknown ids and fields that do not parse change nothing", + machine: { future: { hidden: true, key: "B" }, files: "hidden", diff: [] }, + browser: { browser: { hidden: "yes", key: "BB" }, terminal: { key: "é" } }, + }, + { + name: "the machine hides items and the browser shows one again", + machine: { files: { hidden: true }, diff: { hidden: true } }, + browser: { diff: { hidden: false } }, + hidden: ["files"], + }, + { + name: "no letter is a choice, not inheritance", + machine: { terminal: { key: "X" } }, + browser: { terminal: { key: "" } }, + letters: { terminal: "" }, + }, + { + name: "a browser letter, upper-cased, beats a built-in one", + browser: { whiteboard: { key: "f" } }, + letters: { whiteboard: "F", files: "" }, + }, + { + name: "a machine letter beats a built-in one", + machine: { dashboard: { key: "B" } }, + letters: { dashboard: "B", browser: "" }, + }, + { + name: "a browser letter beats a machine one", + machine: { dashboard: { key: "Q" } }, + browser: { replies: { key: "Q" } }, + letters: { replies: "Q" }, + }, + { + name: "the earlier item wins a tie within a layer", + browser: { dashboard: { key: "Q" }, replies: { key: "Q" } }, + letters: { replies: "Q" }, + }, + { + name: "an available item keeps its letter over a disabled item's browser choice", + browser: { whiteboard: { key: "B" } }, + disabled: ["whiteboard"], + letters: { whiteboard: "" }, + }, + { + name: "among disabled items the layer that set the letter wins", + machine: { device: { key: "D" } }, + disabled: ["diff", "device"], + letters: { device: "D", diff: "" }, + }, + { + name: "an item gets its letter back where the winner is hidden", + browser: { whiteboard: { key: "F", hidden: true } }, + hidden: ["whiteboard"], + }, + { + name: "every item can be hidden", + machine: Object.fromEntries(TODAY.map(([id]) => [id, { hidden: true }])), + hidden: TODAY.map(([id]) => id), + }, + ])("$name", ({ machine = {}, browser = {}, disabled = [], letters = {}, hidden = [] }) => { + const input = actions(disabled); + const expected = input + .filter((action) => !hidden.includes(action.id)) + .map((action) => ({ ...action, shortcut: letters[action.id] ?? action.shortcut })); + + expect(arrangeSurfaceActions(input, parseMenuLayer(machine), parseMenuLayer(browser))).toEqual( + expected, + ); + }); +}); + +describe("setMenuChoice", () => { + it("replaces one item's choice, removes an empty one and keeps unknown ids", () => { + const layer = { files: { hidden: true, key: "Q" }, future: { key: "Z" } }; + expect(setMenuChoice(layer, "files", { key: "Q" })).toEqual({ + files: { key: "Q" }, + future: { key: "Z" }, + }); + expect(setMenuChoice(layer, "files", {})).toEqual({ future: { key: "Z" } }); + }); + + it("starts a new layer when the stored one is malformed", () => { + expect(setMenuChoice(null, "files", { hidden: true })).toEqual({ files: { hidden: true } }); + }); +}); + +describe("parseMenuLayer", () => { + it.each([null, "files", 3, ["files"]])("reads a malformed stored layer %j as empty", (raw) => { + expect(parseMenuLayer(raw)).toEqual({}); + }); +}); diff --git a/apps/web/src/fork/rightPanelMenu/menu.logic.ts b/apps/web/src/fork/rightPanelMenu/menu.logic.ts new file mode 100644 index 0000000000000..502962ecafee7 --- /dev/null +++ b/apps/web/src/fork/rightPanelMenu/menu.logic.ts @@ -0,0 +1,99 @@ +import { parseRightPanelMenuChoice, type RightPanelMenuChoice } from "@t3tools/contracts"; + +/** The "+" menu's and launcher's items, in order. Choices are stored by id: never rename one. */ +export const RIGHT_PANEL_MENU_ITEM_IDS = [ + "browser", + "terminal", + "files", + "diff", + "pull-request", + "pull-requests", + "device", + "side-chat", + "replies", + "dashboard", + "whiteboard", +] as const; +export type RightPanelMenuItemId = (typeof RIGHT_PANEL_MENU_ITEM_IDS)[number]; + +type MenuLayer = Readonly>>; + +const isRecord = (value: unknown): value is Readonly> => + typeof value === "object" && value !== null && !Array.isArray(value); + +const isMenuItemId = (id: string): id is RightPanelMenuItemId => + (RIGHT_PANEL_MENU_ITEM_IDS as ReadonlyArray).includes(id); + +/** Drops unknown ids and fields that do not parse, so those fall through to the layer below. */ +export function parseMenuLayer(raw: unknown): MenuLayer { + const layer: Partial> = {}; + if (!isRecord(raw)) return layer; + for (const [id, value] of Object.entries(raw)) { + if (!isMenuItemId(id)) continue; + const choice = parseRightPanelMenuChoice(value); + if (choice !== undefined) layer[id] = choice; + } + return layer; +} + +/** `layer` with `id`'s choice replaced; an empty choice removes the entry. Unknown ids survive. */ +export function setMenuChoice( + layer: unknown, + id: RightPanelMenuItemId, + choice: RightPanelMenuChoice, +): Record { + const { [id]: _previous, ...rest } = isRecord(layer) ? layer : {}; + return Object.keys(choice).length === 0 ? rest : { ...rest, [id]: choice }; +} + +export interface MenuAction { + readonly id: RightPanelMenuItemId; + readonly shortcut: string; + readonly available: boolean; +} + +/** The action with its letter decided here, so no longer the literal it was built with. */ +export type ArrangedAction = { [K in keyof A]: K extends "shortcut" ? string : A[K] }; + +const BUILT_IN = 0; +const MACHINE = 1; +const BROWSER = 2; + +/** + * Per item and field: browser, else machine, else the action's own letter. Hidden items drop out. + * A letter goes to available items before disabled ones; within each, the layer that set it wins, + * then menu order. Items that lose show no letter. + */ +export function arrangeSurfaceActions( + actions: ReadonlyArray, + machine: MenuLayer, + browser: MenuLayer, +): Array> { + const shown = actions.flatMap((action, order) => { + if (browser[action.id]?.hidden ?? machine[action.id]?.hidden ?? false) return []; + const browserKey = browser[action.id]?.key; + const machineKey = machine[action.id]?.key; + const [key, layer] = + browserKey !== undefined + ? [browserKey, BROWSER] + : machineKey !== undefined + ? [machineKey, MACHINE] + : [action.shortcut.toUpperCase(), BUILT_IN]; + return [{ action, order, key, layer }]; + }); + const letters = new Map<(typeof shown)[number], string>(); + const taken = new Set(); + for (const available of [true, false]) { + const claims = shown + .filter((item) => item.action.available === available && item.key !== "") + .toSorted((left, right) => right.layer - left.layer || left.order - right.order); + for (const claim of claims) { + if (taken.has(claim.key)) continue; + taken.add(claim.key); + letters.set(claim, claim.key); + } + } + return shown.map( + (item) => ({ ...item.action, shortcut: letters.get(item) ?? "" }) as ArrangedAction, + ); +} diff --git a/apps/web/src/fork/rightPanelMenu/rightPanelMenu.tsx b/apps/web/src/fork/rightPanelMenu/rightPanelMenu.tsx new file mode 100644 index 0000000000000..7b1582ef82aa4 --- /dev/null +++ b/apps/web/src/fork/rightPanelMenu/rightPanelMenu.tsx @@ -0,0 +1,65 @@ +import { Link } from "@tanstack/react-router"; + +import { Button } from "../../components/ui/button"; +import { MenuItem } from "../../components/ui/menu"; +import type { SettingsPath } from "../../components/settings/settingsSearch"; +import { useClientSettings } from "../../hooks/useSettings"; +import { isBoardHost, useBoardHostRole } from "../whiteboard/role"; +import { + type ArrangedAction, + arrangeSurfaceActions, + type MenuAction, + parseMenuLayer, +} from "./menu.logic"; + +const RIGHT_PANEL_SETTINGS_PATH = "/settings/right-panel" satisfies SettingsPath; + +/** The "+" menu or launcher items after the machine's and this browser's menu choices. */ +export function useArrangedSurfaceActions( + actions: ReadonlyArray, +): ReadonlyArray> { + const role = useBoardHostRole(); + const browser = useClientSettings((settings) => settings.rightPanelMenuOverrides); + // Off a board host the menu is exactly upstream's. + if (!isBoardHost(role)) return actions as ReadonlyArray>; + return arrangeSurfaceActions(actions, parseMenuLayer(role.menu), parseMenuLayer(browser)); +} + +/** Settings > Right panel exists only on a board host; its nav, search and palette entries too. */ +export const useRightPanelSettingsOffered = (): boolean => isBoardHost(useBoardHostRole()); + +/** The settings nav with Right panel after Keybindings, on a board host only. */ +export function useForkSettingsNavGroups< + Group extends { readonly paths: ReadonlyArray }, +>(groups: ReadonlyArray): ReadonlyArray { + const offered = useRightPanelSettingsOffered(); + if (!offered) return groups; + return groups.map((group) => ({ + ...group, + paths: group.paths.flatMap((path) => + path === "/settings/keybindings" ? [path, RIGHT_PANEL_SETTINGS_PATH] : [path], + ), + })); +} + +const ALL_HIDDEN = "All items are hidden."; +const OPEN_SETTINGS = "Settings > Right panel"; + +/** Shown in place of a launcher or "+" menu whose items are all hidden. */ +export function AllMenuItemsHidden(props: { readonly in: "launcher" | "menu" }) { + if (props.in === "menu") { + return ( + }> + {ALL_HIDDEN} {OPEN_SETTINGS} + + ); + } + return ( +

+ {ALL_HIDDEN}{" "} + +

+ ); +} diff --git a/apps/web/src/fork/whiteboard/WhiteboardPanel.tsx b/apps/web/src/fork/whiteboard/WhiteboardPanel.tsx new file mode 100644 index 0000000000000..b0dfb6bb196ce --- /dev/null +++ b/apps/web/src/fork/whiteboard/WhiteboardPanel.tsx @@ -0,0 +1,54 @@ +import { scopedThreadKey } from "@t3tools/client-runtime/environment"; +import type { ScopedThreadRef } from "@t3tools/contracts"; +import { useState } from "react"; + +import { registerBoardFrame } from "./boardChannel"; +import { useBoardHostRole, useBoardOfferedFor, useThreadProjectRoot } from "./role"; + +/** The right panel's Whiteboard tab: the project's board, framed from the board page. */ +export function WhiteboardPanel(props: { readonly threadRef: ScopedThreadRef }) { + const role = useBoardHostRole(); + const projectRoot = useThreadProjectRoot(props.threadRef); + const offered = useBoardOfferedFor(props.threadRef, projectRoot); + if (role === "unknown") return null; + if (!offered || projectRoot === null) { + return ( +

+ The whiteboard is not available here. +

+ ); + } + return ( + + ); +} + +function BoardFrame(props: { readonly threadKey: string; readonly projectRoot: string }) { + const [ready, setReady] = useState(false); + // The React Compiler keeps this callback stable, so a re-render does not unregister the frame + // (which drops a click still waiting for it). + const registerFrame = (element: HTMLIFrameElement | null) => + element === null + ? undefined + : registerBoardFrame(element, props.threadKey, () => setReady(true)); + return ( +
+ {ready ? null : ( +

+ Loading board... +

+ )} + {/* oxlint-disable-next-line react/iframe-missing-sandbox -- the board is this origin's own page; it needs scripts and same-origin storage, which together make a sandbox moot. */} +