From 2653209b14f7e6b88dd803a7f63dd44aa0fd8b17 Mon Sep 17 00:00:00 2001 From: Callum Alpass Date: Mon, 2 Nov 2026 23:58:19 +1100 Subject: [PATCH] Details, palette and settings in the same treatment Panels without dividers or rounded borders: bold titles, muted bodies, the selected row's accent bar over the full width. The in-place details panel now takes its column's height instead of spilling over the composer. --- src/ui/DetailsPanel.tsx | 35 ++++++++++++++++++++++------------- src/ui/Palette.tsx | 23 ++++++++++++----------- src/ui/SettingsView.tsx | 23 ++++++++++++++++------- 3 files changed, 50 insertions(+), 31 deletions(-) diff --git a/src/ui/DetailsPanel.tsx b/src/ui/DetailsPanel.tsx index e336715..fbb75f2 100644 --- a/src/ui/DetailsPanel.tsx +++ b/src/ui/DetailsPanel.tsx @@ -25,16 +25,20 @@ export function DetailsPanel(props: { readonly empty?: string; }) { const { details } = props; - // In place of the conversation it sits beside the thread list's border and needs none of its own. const width = props.inPlace ? Math.min(props.width, IN_PLACE_MAX_WIDTH) : props.width; - const inner = Math.max(10, width - (props.inPlace ? 3 : 4)); + // A column of padding on each side, and one more for the scrollbox's scrollbar. + const inner = Math.max(10, width - 3); return ( {!details ? {props.empty ?? "No thread selected."} : } @@ -55,7 +59,7 @@ function Sections({ details, inner, loading, selected, onActivate }: { readonly return ( <>
- {startTruncate(workspace.path, inner)} + {startTruncate(workspace.path, inner)} {workspace.worktree ? worktree : null} {truncate(workspace.model, inner)} {workspace.mode ? {truncate(workspace.mode, inner)} : null} @@ -64,14 +68,14 @@ function Sections({ details, inner, loading, selected, onActivate }: { readonly {branch ? (
- {truncate(branch.name, inner - (branch.upstream?.length ?? 0) - 1)} + {truncate(branch.name, inner - (branch.upstream?.length ?? 0) - 1)} {branch.upstream ?? ""} {branch.pullRequest ? ( <> - {`PR #${branch.pullRequest.number} `} + {`PR #${branch.pullRequest.number} `} {branch.pullRequest.state} {branch.pullRequest.checks ? {branch.pullRequest.checks.text} : null} @@ -135,7 +139,7 @@ function Sections({ details, inner, loading, selected, onActivate }: { readonly {details.automations.map((automation) => ( - {truncate(automation.task.title, inner)} + {truncate(automation.task.title, inner)} {truncate(automation.schedule, inner - automation.status.length - 1)} @@ -157,7 +161,7 @@ function Sections({ details, inner, loading, selected, onActivate }: { readonly {details.goal ? (
- {details.goal.objective} + {details.goal.objective} {details.goal.status}
) : null} @@ -165,12 +169,17 @@ function Sections({ details, inner, loading, selected, onActivate }: { readonly ); } -/** A line that does something: highlighted when selected, activated by a click. */ +/** + * A line that does something: highlighted when selected, activated by a click. The negative + * margins pull the row over the panel's padding, so the selection bar sits at the panel's + * edge and its background runs the full width, as in the thread list. + */ function Selectable(props: LineProps & { readonly id: DetailsAction["id"]; readonly inner: number; readonly text?: string; readonly color?: string; readonly children?: ReactNode }) { const active = props.selected === props.id; return ( - props.onActivate(props.id)}> - {props.children ?? {truncate(props.text ?? "", props.inner)}} + props.onActivate(props.id)}> + {active ? "▌" : " "} + {props.children ? {props.children} : {truncate(props.text ?? "", props.inner)}} ); } @@ -179,7 +188,7 @@ function Section(props: { readonly title: string; readonly right?: ReactNode; re return ( - + {props.title} diff --git a/src/ui/Palette.tsx b/src/ui/Palette.tsx index e2b2515..7fbd967 100644 --- a/src/ui/Palette.tsx +++ b/src/ui/Palette.tsx @@ -2,6 +2,7 @@ import type { PaletteEntry, PaletteGroup } from "../model/palette.ts"; import type { MouseEvent } from "@opentui/core"; import { ClickRow, wheelStep } from "./Button.tsx"; +import { BAR } from "./edges.ts"; import { truncate } from "./text.ts"; import { colors } from "./theme.ts"; @@ -35,20 +36,19 @@ export function Palette(props: { } const selectedRow = rows.findIndex((row) => row.kind === "entry" && row.index === props.selected); const start = Math.max(0, Math.min(selectedRow - Math.floor(listHeight / 2), rows.length - listHeight)); - const inner = width - 4; + const inner = width - 3; return ( - - - {"› "} - for commands only)"} value={props.query} onInput={props.onQuery} onSubmit={props.onSubmit} backgroundColor={colors.panel} focusedBackgroundColor={colors.panel} /> + + + for commands only)"} value={props.query} onInput={props.onQuery} onSubmit={props.onSubmit} backgroundColor={colors.element} focusedBackgroundColor={colors.element} /> - {props.status ? {props.status} : null} - { const step = wheelStep(event); if (step) props.onMove(step); }}> - {rows.length === 0 ? No matches : null} + {props.status ? {props.status} : null} + { const step = wheelStep(event); if (step) props.onMove(step); }}> + {rows.length === 0 ? No matches : null} {rows.slice(start, start + listHeight).map((row) => row.kind === "header" ? ( - - {row.label} + + {row.label} ) : ( props.onPick(row.index)} /> @@ -64,7 +64,8 @@ function Row(props: { readonly entry: PaletteEntry; readonly selected: boolean; const right = entry.kind === "command" ? (entry.command.shortcut ?? "") : entry.project; const title = entry.kind === "command" ? entry.command.title : `${entry.subagent ? "↳ " : ""}${entry.snippet ? truncate(entry.title, Math.max(12, Math.floor(props.inner / 3))) : entry.title}${entry.snippet ? ` — ${entry.snippet}` : ""}`; return ( - + + {props.selected ? "▌" : " "} {truncate(title, props.inner - right.length - 2)} {right} diff --git a/src/ui/SettingsView.tsx b/src/ui/SettingsView.tsx index 346ac11..f6242ba 100644 --- a/src/ui/SettingsView.tsx +++ b/src/ui/SettingsView.tsx @@ -24,31 +24,40 @@ export function SettingsView(props: { esc close - {`tui3 · ${props.path}`} + + {`tui3 · ${props.path}`} + {props.rows.map((row, index) => { const selected = index === props.selected; return ( props.onCycle(index)}> - {`${selected ? "▸ " : " "}${row.label.padEnd(labelWidth)}`} - {row.value} + {selected ? "▌" : " "} + {` ${row.label.padEnd(labelWidth)}`} + {row.value} {` ${row.help}`} ); })} - T3 Code · change these in the app + + T3 Code · change these in the app + {props.serverStatus === "loading" ? Loading… : null} {props.serverStatus === "error" ? Could not read the server's settings. : null} {props.server.map((line) => ( {` ${line.label.padEnd(labelWidth)}`} - {line.value} + {line.value} ))} - {usage.length > 0 ? Usage : null} + {usage.length > 0 ? ( + + Usage + + ) : null} {usage.map((line) => ( {` ${line.label.padEnd(labelWidth)}`} - {line.value} + {line.value} ))}