refactor(ui): replace middle-dot separators with clearer hierarchy (#6087)

* refactor(ui): replace middle-dot separators with clearer hierarchy

* refactor(ui): use layout instead of punctuation separators
This commit is contained in:
chengyongru authored and GitHub committed 2026-10-07 15:19:55 +08:00
1 parent d6ddceed99
commit 7cb396788c
82 files changed
+433 -462

No files matched your search

+1 -1
View File
@@ -36,7 +36,7 @@ describe("ContextPanel", () => {
await setup.renderOnce()
const frame = setup.captureCharFrame()
expect(frame).toContain("~950 tokens · 8 replay · 0 archived")
expect(frame).toContain("~950 tokens 8 replay 0 archived")
expect(frame).not.toContain("Agent context")
expect(frame).not.toContain("no compacted summary")
})
+1 -1
View File
@@ -63,7 +63,7 @@ export class ContextPanel {
}
show(context: SessionContextSnapshot): void {
this.stats.content = `~${formatTokenCount(context.estimatedSessionTokens)} tokens · ${context.replayMessages} replay · ${context.archivedMessages} archived`
this.stats.content = `~${formatTokenCount(context.estimatedSessionTokens)} tokens ${context.replayMessages} replay ${context.archivedMessages} archived`
this.summary.content = context.archivedSummary ?? ""
this.root.visible = true
}
+9 -9
View File
@@ -124,7 +124,7 @@ export class DiffViewer {
})
this.header = new TextRenderable(renderer, {
id: "nanobot-tui-diff-header",
content: "Diff · Last turn",
content: "Last turn changes",
width: "100%",
height: 1,
flexShrink: 0,
@@ -160,7 +160,7 @@ export class DiffViewer {
hideScrollbars(this.scroll)
this.footer = new TextRenderable(renderer, {
id: "nanobot-tui-diff-footer",
content: "←/→ file · pgup/pgdn scroll · esc close",
content: "←/→ file pgup/pgdn scroll esc close",
width: "100%",
height: 1,
flexShrink: 0,
@@ -223,8 +223,8 @@ export class DiffViewer {
resize(width: number): void {
this.footer.content = width >= 58
? "←/→ file · pgup/pgdn scroll · home/end · esc close"
: "←/→ file · pgup/pgdn · esc"
? "←/→ file pgup/pgdn scroll home/end esc close"
: "←/→ file pgup/pgdn esc"
}
setTheme(theme: DiffViewerTheme): void {
@@ -256,8 +256,8 @@ export class DiffViewer {
const totalDeleted = this.items.reduce((sum, item) => sum + Math.max(0, item.edit.deleted || 0), 0)
const count = this.items.length
this.header.content = count
? `Diff · Last turn · ${count} ${count === 1 ? "change" : "changes"} · +${totalAdded} -${totalDeleted}`
: "Diff · Last turn"
? `Last turn changes ${count} ${count === 1 ? "change" : "changes"} +${totalAdded} -${totalDeleted}`
: "Last turn changes"
const item = this.items[this.selected]
if (!item) {
this.fileHeader.content = "No file changes in the last turn."
@@ -265,9 +265,9 @@ export class DiffViewer {
return
}
const edit = item.edit
const index = this.items.length > 1 ? `${this.selected + 1}/${this.items.length} · ` : ""
const state = edit.status === "editing" ? " · editing" : edit.status === "error" ? " · failed" : ""
this.fileHeader.content = `${index}${edit.path || "Unknown file"} · ${stat(edit)}${state}`
const index = this.items.length > 1 ? `${this.selected + 1}/${this.items.length} ` : ""
const state = edit.status === "editing" ? " editing" : edit.status === "error" ? " failed" : ""
this.fileHeader.content = `${index}${edit.path || "Unknown file"} ${stat(edit)}${state}`
const text = edit.diff?.format === "unified" ? edit.diff.text?.trimEnd() : ""
if (text) {
this.scroll.add(new DiffRenderable(this.renderer, {
+1 -1
View File
@@ -16,7 +16,7 @@ describe("footerHints", () => {
{ key: "ctrl+c", label: "stop", tone: "danger" },
], theme)
expect(result.chunks.map(({ text }) => text).join("")).toBe("enter steer · ctrl+c stop")
expect(result.chunks.map(({ text }) => text).join("")).toBe("enter steer ctrl+c stop")
expect(result.chunks[0]?.fg?.toInts().slice(0, 3)).toEqual([239, 142, 48])
expect(result.chunks[3]?.fg?.toInts().slice(0, 3)).toEqual([248, 113, 113])
})
+1 -1
View File
@@ -60,7 +60,7 @@ export function footerTelemetry(
export function footerHints(hints: readonly FooterHint[], theme: FooterHintTheme): StyledText {
const chunks: TextChunk[] = []
hints.forEach((hint, index) => {
if (index) chunks.push(chunk(" · ", theme.separator))
if (index) chunks.push(chunk(" ", theme.muted))
const color = hint.tone === "danger" ? theme.danger : theme.accent
chunks.push(chunk(hint.key, color, true))
chunks.push(chunk(` ${hint.label}`, theme.muted))
+6 -6
View File
@@ -35,9 +35,9 @@ describe("UsagePanel", () => {
const frame = setup.captureCharFrame()
expect(frame).toContain("Context 9k / 262k")
expect(frame).toContain("3%")
expect(frame).toContain("Input tokens · max 9k")
expect(frame).toContain("Round 3/3 · In 9,000 · Out 800")
expect(frame).toContain("Cache 67% · 1.5s · includes estimated usage")
expect(frame).toContain("Input tokens (max 9k)")
expect(frame).toContain("Round 3/3 In 9,000 Out 800")
expect(frame).toContain("Cache 67% 1.5s includes estimated usage")
expect(frame).toContain("Uncached")
expect(frame).toContain("Unknown cache")
expect(frame).toContain("███")
@@ -50,7 +50,7 @@ describe("UsagePanel", () => {
panel.move(-1)
panel.move(-1)
await setup.renderOnce()
expect(setup.captureCharFrame()).toContain("Round 1/3 · In 3,000 · Out 200")
expect(setup.captureCharFrame()).toContain("Round 1/3 In 3,000 Out 200")
expect(setup.captureCharFrame()).toContain("Cache ?")
})
@@ -189,7 +189,7 @@ describe("UsagePanel", () => {
const frame = setup.captureCharFrame()
expect(frame).toContain("Context 2k / 1k")
expect(frame).toContain("100%")
expect(frame).toContain("In 2,000 · Out ?")
expect(frame).toContain("In 2,000 Out ?")
expect(frame).toContain("Cache 100%")
})
@@ -235,7 +235,7 @@ describe("UsagePanel", () => {
panel.resize(80, 30)
panel.setTheme({ ...theme, text: "#18181B", border: "#D4D4D8" })
await setup.renderOnce()
expect(setup.captureCharFrame()).toContain("Round 3/3 · In 9,000 · Out 800")
expect(setup.captureCharFrame()).toContain("Round 3/3 In 9,000 Out 800")
panel.hide()
await setup.renderOnce()
expect(setup.captureCharFrame()).not.toContain("Context")
+4 -4
View File
@@ -148,7 +148,7 @@ export class UsagePanel {
if (!compact) line("")
const inputs = rounds.map((round) => round.prompt_tokens ?? 0)
const max = Math.max(1, ...inputs)
if (!tiny) heading(width < 48 ? "Rounds" : "Recent rounds", `Input tokens · max ${formatTokenCount(max)}`)
if (!tiny) heading(width < 48 ? "Rounds" : "Recent rounds", `Input tokens (max ${formatTokenCount(max)})`)
const chartHeight = Math.max(1, Math.min(6, this.height - 18))
const slot = Math.max(1, Math.floor(width / rounds.length))
const barWidth = Math.min(3, Math.max(1, slot - 1))
@@ -187,13 +187,13 @@ export class UsagePanel {
if (round && !tiny) {
const input = round.prompt_tokens ?? 0
const count = (value: number | undefined) => known(value) ? value.toLocaleString("en-US") : "?"
line(`${width < 48 ? "" : "Round "}${this.selected + 1}/${rounds.length} · In ${count(input)} · Out ${count(round.completion_tokens)}`)
line(`${width < 48 ? "" : "Round "}${this.selected + 1}/${rounds.length} In ${count(input)} Out ${count(round.completion_tokens)}`)
const cache = known(round.cached_tokens)
? `${Math.round(Math.min(input, round.cached_tokens) / input * 100)}%` : "?"
const time = known(round.generation_ms) ? ` · ${(round.generation_ms / 1000).toFixed(1)}s` : ""
const time = known(round.generation_ms) ? ` ${(round.generation_ms / 1000).toFixed(1)}s` : ""
if (!compact) {
const estimated = known(round.estimated_tokens) && round.estimated_tokens > 0
line(`Cache ${cache}${time}${estimated && width >= 48 ? " · includes estimated usage" : ""}`, theme.muted)
line(`Cache ${cache}${time}${estimated && width >= 48 ? " includes estimated usage" : ""}`, theme.muted)
if (estimated && width < 48) line("Includes estimated usage", theme.muted)
}
}