diff --git a/packages/tui/src/component/dialog-highlights.tsx b/packages/tui/src/component/dialog-highlights.tsx index d0ab5ad47ec..7c6765ee68e 100644 --- a/packages/tui/src/component/dialog-highlights.tsx +++ b/packages/tui/src/component/dialog-highlights.tsx @@ -5,7 +5,7 @@ import { useConfig } from "../config" import { Keymap } from "../context/keymap" import type { TuiHighlight } from "../context/runtime" import { useTheme } from "../context/theme" -import { DIALOG_INSET, DialogHeader, useDialog } from "../ui/dialog" +import { DIALOG_INSET, DialogBleed, DialogHeader, DialogLayout, useDialog } from "../ui/dialog" import { getScrollAcceleration } from "../util/scroll" export function DialogHighlights(props: { version: string; items: ReadonlyArray }) { @@ -33,56 +33,55 @@ export function DialogHighlights(props: { version: string; items: ReadonlyArray< })) return ( - - - {/* The band owns the vertical padding so it stays visible while the highlights scroll. */} - - (scroll = element)} - maxHeight={maxHeight()} - contentOptions={{ minHeight: 0 }} - backgroundColor={overlay.background.raised.high} - scrollbarOptions={{ visible: false }} - scrollAcceleration={getScrollAcceleration(config)} - > - - - {(item) => ( - - - {item.title} - - {/* Backticks mark code spans, which stand out from the muted description. */} - - - {(part, index) => - index() % 2 === 1 ? {part} : part - } - - - - )} - + } + footer={ + + ↑/↓ scroll + dialog.clear()} + > + ok - - - - ↑/↓ scroll - dialog.clear()} - > - ok - - + } + > + {/* The band owns the vertical padding so it stays visible while the highlights scroll. */} + + + (scroll = element)} + maxHeight={maxHeight()} + contentOptions={{ minHeight: 0 }} + backgroundColor={overlay.background.raised.high} + scrollbarOptions={{ visible: false }} + scrollAcceleration={getScrollAcceleration(config)} + > + + + {(item) => ( + + + {item.title} + + {/* Backticks mark code spans, which stand out from the muted description. */} + + + {(part, index) => + index() % 2 === 1 ? {part} : part + } + + + + )} + + + + + + ) } diff --git a/packages/tui/src/component/dialog-integration.tsx b/packages/tui/src/component/dialog-integration.tsx index 4f810ccf492..258f2e821af 100644 --- a/packages/tui/src/component/dialog-integration.tsx +++ b/packages/tui/src/component/dialog-integration.tsx @@ -21,7 +21,15 @@ import { useClient } from "../context/client" import { Keymap } from "../context/keymap" import { useLocation } from "../context/location" import { useTheme } from "../context/theme" -import { DIALOG_INSET, DIALOG_LIST_INSET, DialogFooter, DialogHeader, useDialog } from "../ui/dialog" +import { + DIALOG_INSET, + DIALOG_LIST_INSET, + DialogBleed, + DialogFooter, + DialogHeader, + DialogLayout, + useDialog, +} from "../ui/dialog" import { DialogPrompt } from "../ui/dialog-prompt" import { DialogSelect } from "../ui/dialog-select" import { Link } from "../ui/link" @@ -509,21 +517,22 @@ function CommandView(props: { title: string; output: string; message: string }) const overlayTheme = useTheme() onMount(() => dialog.setSize("large")) return ( - - - - {props.output.trim()} - - + }> + + + + {props.output.trim()} + + {props.message} - + ) } diff --git a/packages/tui/src/component/dialog-workspace-file-changes.tsx b/packages/tui/src/component/dialog-workspace-file-changes.tsx index 10119461369..957e085a038 100644 --- a/packages/tui/src/component/dialog-workspace-file-changes.tsx +++ b/packages/tui/src/component/dialog-workspace-file-changes.tsx @@ -5,7 +5,7 @@ import { createStore } from "solid-js/store" import { FilePath } from "../ui/file-path" import { useTheme } from "../context/theme" import { useConfig } from "../config" -import { DIALOG_INSET, DialogHeader, useDialog, type DialogContext } from "../ui/dialog" +import { DIALOG_INSET, DialogBleed, DialogHeader, DialogLayout, useDialog, type DialogContext } from "../ui/dialog" import { getScrollAcceleration } from "../util/scroll" const options = ["no", "yes"] as const @@ -72,71 +72,72 @@ export function DialogWorkspaceFileChanges(props: { }) return ( - - - + } + footer={ + + + {(item) => ( + { + setStore("active", item) + props.onSelect(item) + dialog.clear() + }} + > + {item} + + )} + + + } + > + {props.message ?? "Do you want to move these changes with the session?"} - - - - {(item) => ( - - - - {statusLabel(item.status)} + + + + {(item) => ( + + + + {statusLabel(item.status)} + + + + + + {" "} + {item.additions ? ( + +{item.additions} + ) : null} + {item.deletions ? ( + -{item.deletions} + ) : null} + + - - - - - {" "} - {item.additions ? +{item.additions} : null} - {item.deletions ? ( - -{item.deletions} - ) : null} - - - - )} - - - - - {(item) => ( - { - setStore("active", item) - props.onSelect(item) - dialog.clear() - }} - > - {item} - - )} - + )} + + + - + ) } diff --git a/packages/tui/src/feature-plugins/prompt/btw.tsx b/packages/tui/src/feature-plugins/prompt/btw.tsx index 221159af591..5cf4c20ffe0 100644 --- a/packages/tui/src/feature-plugins/prompt/btw.tsx +++ b/packages/tui/src/feature-plugins/prompt/btw.tsx @@ -8,7 +8,7 @@ import { useClipboard } from "../../context/clipboard" import { Keymap } from "../../context/keymap" import { useTheme, useThemes } from "../../context/theme" import { usePlugin } from "../../plugin/context" -import { DIALOG_INSET, DialogFooter, DialogHeader } from "../../ui/dialog" +import { DIALOG_INSET, DialogBleed, DialogFooter, DialogHeader, DialogLayout } from "../../ui/dialog" import { useToast } from "../../ui/toast" import { getScrollAcceleration } from "../../util/scroll" @@ -124,50 +124,55 @@ export function Answer(props: { }) return ( - - - /btw + + /btw + + } + > + + {props.question.replace(/\s+/g, " ")} - } - > - - {props.question.replace(/\s+/g, " ")} - - - (scroll = element)} - maxHeight={maxHeight()} - contentOptions={{ minHeight: 0 }} - backgroundColor={overlay.background.raised.high} - scrollbarOptions={{ visible: false }} - scrollAcceleration={getScrollAcceleration(config)} - > - - - - - - + + } + footer={ + + } + > + + (scroll = element)} + maxHeight={maxHeight()} + contentOptions={{ minHeight: 0 }} + backgroundColor={overlay.background.raised.high} + scrollbarOptions={{ visible: false }} + scrollAcceleration={getScrollAcceleration(config)} + > + + + + + + ) } diff --git a/packages/tui/src/feature-plugins/system/diff-viewer.tsx b/packages/tui/src/feature-plugins/system/diff-viewer.tsx index 85e8212da20..ff66c831940 100644 --- a/packages/tui/src/feature-plugins/system/diff-viewer.tsx +++ b/packages/tui/src/feature-plugins/system/diff-viewer.tsx @@ -17,7 +17,7 @@ import { createEffect, createMemo, createResource, createSignal, For, Match, onC import { DiffViewerFileTree } from "./diff-viewer-file-tree" import { DiffFileMenu } from "./diff-viewer-file-menu" import { DiffViewerImage, isDiffImageFile } from "./diff-viewer-image" -import { DIALOG_INSET, DIALOG_LIST_INSET } from "../../ui/dialog" +import { DIALOG_LIST_INSET, DialogHeader, DialogLayout } from "../../ui/dialog" import { DialogSelect } from "../../ui/dialog-select" import { EmptyBorder } from "../../ui/border" import { SESSION_PANEL_SPLIT_MIN_WIDTH } from "../../ui/layout" @@ -1256,15 +1256,11 @@ function DiffViewerHelpDialog(props: { context: Plugin.Context; single: boolean; ] return ( - - - - Diff shortcuts - - props.context.ui.dialog.clear()}> - esc close - - + props.context.ui.dialog.clear()} /> + } + > - + ) } diff --git a/packages/tui/src/routes/session/dialog-execute.tsx b/packages/tui/src/routes/session/dialog-execute.tsx index 0616450b047..00a0123eeb9 100644 --- a/packages/tui/src/routes/session/dialog-execute.tsx +++ b/packages/tui/src/routes/session/dialog-execute.tsx @@ -8,7 +8,15 @@ import { useConfig } from "../../config" import { useClipboard } from "../../context/clipboard" import { Keymap } from "../../context/keymap" import { useTheme, useThemes } from "../../context/theme" -import { DIALOG_INSET, DialogFooter, DialogHeader, dialogWidth, useDialog } from "../../ui/dialog" +import { + DIALOG_INSET, + DialogBleed, + DialogFooter, + DialogHeader, + DialogLayout, + dialogWidth, + useDialog, +} from "../../ui/dialog" import { useToast } from "../../ui/toast" import { Locale } from "../../util/locale" import { getScrollAcceleration } from "../../util/scroll" @@ -92,92 +100,97 @@ export function DialogExecute(props: { part: SessionMessageAssistantTool }) { })) return ( - - - execute - - } - > - {status()} - - (scroll = value)} - height={height()} - contentOptions={{ minHeight: 0 }} - backgroundColor={contentTheme.background.raised.high} - scrollbarOptions={{ visible: false }} - scrollAcceleration={getScrollAcceleration(config)} - > - - - - Code + + execute - Waiting for code…}> - {(value) => } - + } + > + {status()} + + } + footer={ + copy("code") } + : { title: "copy code", key: "c", onTrigger: () => copy("code") }, + copied() === "output" + ? { title: "✓ copied", color: theme.text.feedback.success.base, onTrigger: () => copy("output") } + : { title: "copy output", key: "o", onTrigger: () => copy("output") }, + { title: "back", key: "esc", onTrigger: () => dialog.clear() }, + ]} + /> + } + > + + (scroll = value)} + height={height()} + contentOptions={{ minHeight: 0 }} + backgroundColor={contentTheme.background.raised.high} + scrollbarOptions={{ visible: false }} + scrollAcceleration={getScrollAcceleration(config)} + > + + + + Code + + Waiting for code…}> + {(value) => } + + + + + Output + + + {text() ?? (props.part.state.status === "completed" ? "No output" : "Waiting for output…")} + + } + > + {(body) => ( + <> + + + {(rest) => ( + + + {rest()} + + + )} + + + )} + + - - - Output - - - {text() ?? (props.part.state.status === "completed" ? "No output" : "Waiting for output…")} - - } - > - {(body) => ( - <> - - - {(rest) => ( - - - {rest()} - - - )} - - - )} - - - - - copy("code") } - : { title: "copy code", key: "c", onTrigger: () => copy("code") }, - copied() === "output" - ? { title: "✓ copied", color: theme.text.feedback.success.base, onTrigger: () => copy("output") } - : { title: "copy output", key: "o", onTrigger: () => copy("output") }, - { title: "back", key: "esc", onTrigger: () => dialog.clear() }, - ]} - /> - + + + ) } diff --git a/packages/tui/src/routes/session/dialog-fork.tsx b/packages/tui/src/routes/session/dialog-fork.tsx index c280b5640d4..d6fc9857269 100644 --- a/packages/tui/src/routes/session/dialog-fork.tsx +++ b/packages/tui/src/routes/session/dialog-fork.tsx @@ -4,7 +4,7 @@ import { useRoute } from "../../context/route" import { useClient } from "../../context/client" import { Spinner } from "../../component/spinner" import { DialogSelect, type DialogSelectOption } from "../../ui/dialog-select" -import { DIALOG_INSET, useDialog } from "../../ui/dialog" +import { DialogHeader, DialogLayout, useDialog } from "../../ui/dialog" import { useToast } from "../../ui/toast" import { errorMessage } from "../../util/error" import { Locale } from "../../util/locale" @@ -74,9 +74,9 @@ export function DialogFork(props: { sessionID: string; messageID?: string; onMov + }> Forking session… - + } > props.onMove?.(option.value)} title="Fork session" options={options()} /> diff --git a/packages/tui/src/ui/dialog.tsx b/packages/tui/src/ui/dialog.tsx index 6f1269fd302..b50e3004194 100644 --- a/packages/tui/src/ui/dialog.tsx +++ b/packages/tui/src/ui/dialog.tsx @@ -145,6 +145,15 @@ export function DialogLayout( ) } +/** Stretches a raised band inside a `DialogLayout` across the side padding; its content re-applies `DIALOG_INSET`. */ +export function DialogBleed(props: ParentProps) { + return ( + + {props.children} + + ) +} + export type DialogFooterAction = { title: string /** Literal key label, e.g. "enter". */