Composer: left bar and element block, model line inside

This commit is contained in:
Callum Alpass committed 2026-11-03 00:17:20 +11:00
1 parent 071961ac5b
commit c8f7a48552
1 file changed
+43 -23
+43 -23
View File
@@ -41,6 +41,7 @@ import { useWorkspace } from "./useWorkspace.ts";
import { usePullRequests } from "./usePullRequests.ts"; import { usePullRequests } from "./usePullRequests.ts";
import { copyText, desktopNotify, ring } from "./terminalOut.ts"; import { copyText, desktopNotify, ring } from "./terminalOut.ts";
import { colors, statusColor } from "./theme.ts"; import { colors, statusColor } from "./theme.ts";
import { BAR, NO_BORDER } from "./edges.ts";
import { ThreadList } from "./ThreadList.tsx"; import { ThreadList } from "./ThreadList.tsx";
import { useTurns } from "./useTurns.ts"; import { useTurns } from "./useTurns.ts";
import { ThreadView, type ConversationMouse, type ConversationTarget } from "./ThreadView.tsx"; import { ThreadView, type ConversationMouse, type ConversationTarget } from "./ThreadView.tsx";
@@ -969,6 +970,7 @@ export function App(props: { readonly session: T3Session; readonly config: Tui3C
const listWidth = attached ? 0 : clampListWidth(listWidthPref ?? Math.min(46, Math.max(28, Math.floor(width * 0.3))), width); const listWidth = attached ? 0 : clampListWidth(listWidthPref ?? Math.min(46, Math.max(28, Math.floor(width * 0.3))), width);
const detailsColumn = panel.show && width - listWidth - DETAILS_WIDTH >= MIN_CONVERSATION_WIDTH; const detailsColumn = panel.show && width - listWidth - DETAILS_WIDTH >= MIN_CONVERSATION_WIDTH;
const detailsInPlace = panel.show && !detailsColumn; const detailsInPlace = panel.show && !detailsColumn;
// The block's height: a row of padding on top, the text, then the model line inside it.
const composerHeight = Math.min(MAX_COMPOSER_LINES, composerLines) + 2; const composerHeight = Math.min(MAX_COMPOSER_LINES, composerLines) + 2;
const placeholder = const placeholder =
mode !== "input" mode !== "input"
@@ -989,16 +991,16 @@ export function App(props: { readonly session: T3Session; readonly config: Tui3C
: "Steer the agent (alt+enter to queue instead)" : "Steer the agent (alt+enter to queue instead)"
: "Ask anything"; : "Ask anything";
// The model with its options, then the mode when it isn't full access; click or m to change. // The model with its options, then the mode when it isn't full access; click or m to change.
// The name reads quiet; the effort and mode after it are the parts worth a colour.
const pendingModel = draft ? undefined : models.pendingFor(threadShell?.id); const pendingModel = draft ? undefined : models.pendingFor(threadShell?.id);
const footer = const footerParts = ((): { readonly name: string; readonly rest: string } => {
currentModel && runtimeMode if (!currentModel || !runtimeMode) return { name: "", rest: "" };
? [ const summary = providerConfig ? modelSummary(providerConfig, currentModel) : currentModel.model === "default" ? "" : currentModel.model;
providerConfig ? modelSummary(providerConfig, currentModel) : currentModel.model === "default" ? "" : currentModel.model, const [name = "", ...options] = summary.split(" · ");
runtimeMode === "full-access" ? "" : (RUNTIME_MODE_LABELS[runtimeMode] ?? runtimeMode), const mode = runtimeMode === "full-access" ? "" : (RUNTIME_MODE_LABELS[runtimeMode] ?? runtimeMode);
] return { name, rest: [...options, mode].filter(Boolean).join(" · ") };
.filter(Boolean) })();
.join(" · ") const composerBarColor = mode === "input" ? colors.accent : colors.border;
: "";
const detailsPanel = (inPlace: boolean) => ( const detailsPanel = (inPlace: boolean) => (
<DetailsPanel <DetailsPanel
details={panel.details} details={panel.details}
@@ -1109,9 +1111,6 @@ export function App(props: { readonly session: T3Session; readonly config: Tui3C
) : threadId ? ( ) : threadId ? (
<ThreadView <ThreadView
key={watchedId} key={watchedId}
project={threadRow?.projectName ?? ""}
title={title}
detail={threadShell?.branch ?? ""}
timeline={current} timeline={current}
findQuery={find.open ? find.query.trim() : ""} findQuery={find.open ? find.query.trim() : ""}
findMatch={find.match} findMatch={find.match}
@@ -1169,26 +1168,31 @@ export function App(props: { readonly session: T3Session; readonly config: Tui3C
</box> </box>
) : null} ) : null}
{threadId || draft ? ( {threadId || draft ? (
<box flexDirection="column" flexShrink={0} marginLeft={1} marginRight={1}>
<box <box
border border={["left"]}
borderStyle="rounded" customBorderChars={BAR}
borderColor={mode === "input" ? colors.borderFocused : colors.border} borderColor={composerBarColor}
backgroundColor={colors.element}
height={composerHeight} height={composerHeight}
flexShrink={0} flexShrink={0}
marginLeft={1} flexDirection="column"
marginRight={1} paddingTop={1}
paddingLeft={1} paddingLeft={2}
paddingRight={1} paddingRight={2}
onMouseDown={() => setMode("input")} onMouseDown={() => setMode("input")}
> >
<textarea <textarea
key={composerKey} key={composerKey}
ref={composerRef} ref={composerRef}
focused={mode === "input"} focused={mode === "input"}
flexGrow={1}
initialValue={drafts.current.get(composerKey) ?? ""} initialValue={drafts.current.get(composerKey) ?? ""}
placeholder={placeholder} placeholder={placeholder}
placeholderColor={colors.faint} placeholderColor={colors.faint}
textColor={colors.text} textColor={colors.text}
backgroundColor={colors.element}
focusedBackgroundColor={colors.element}
wrapMode="word" wrapMode="word"
keyBindings={[...COMPOSER_KEYS[config.sendShortcut]]} keyBindings={[...COMPOSER_KEYS[config.sendShortcut]]}
onSubmit={() => submit()} onSubmit={() => submit()}
@@ -1204,13 +1208,29 @@ export function App(props: { readonly session: T3Session; readonly config: Tui3C
setComposerEmpty(text.trim() === ""); setComposerEmpty(text.trim() === "");
}} }}
/> />
</box> <box
flexDirection="row"
height={1}
flexShrink={0}
onMouseDown={(event: MouseEvent) => {
event.stopPropagation();
models.open();
}}
>
<text fg={colors.muted}>{footerParts.name}</text>
{footerParts.rest ? (
<>
<text fg={colors.muted}>{footerParts.name ? " · " : ""}</text>
<text fg={colors.warn}>{footerParts.rest}</text>
</>
) : null} ) : null}
{threadId || draft ? (
<box flexDirection="row" height={1} flexShrink={0} paddingLeft={2} paddingRight={2} onMouseDown={models.open}>
<text fg={colors.faint}>{footer}</text>
{pendingModel ? <text fg={colors.accent}>{" · next message"}</text> : null} {pendingModel ? <text fg={colors.accent}>{" · next message"}</text> : null}
</box> </box>
</box>
<box height={1} flexShrink={0} border={["left"]} borderColor={composerBarColor} customBorderChars={{ ...NO_BORDER, vertical: "╹" }}>
<box height={1} border={["bottom"]} borderColor={colors.element} customBorderChars={{ ...NO_BORDER, horizontal: "▀" }} />
</box>
</box>
) : null} ) : null}
</box> </box>
{detailsColumn ? detailsPanel(false) : null} {detailsColumn ? detailsPanel(false) : null}