This commit is contained in:
Dax Raad 2025-10-23 17:43:21 -04:00
parent 754c264ea1
commit aeef21b2a8

View file

@ -9,20 +9,6 @@ export function Sidebar(props: { sessionID: string }) {
const session = createMemo(() => sync.session.get(props.sessionID)!)
const todo = createMemo(() => sync.data.todo[props.sessionID] ?? [])
const messages = createMemo(() => sync.data.message[props.sessionID] ?? [])
const files = createMemo(() => {
const result = new Set<string>()
for (const msg of messages()) {
const parts = sync.data.part[msg.id] ?? []
for (const part of parts) {
if (part.type === "patch") {
for (const file of part.files) {
result.add(file)
}
}
}
}
return [...result.values()].sort((a, b) => a.length - b.length)
})
const cost = createMemo(() => {
const total = messages().reduce((sum, x) => sum + (x.role === "assistant" ? x.cost : 0), 0)
@ -125,12 +111,22 @@ export function Sidebar(props: { sessionID: string }) {
</For>
</box>
</Show>
<Show when={files().length > 0}>
<Show when={session().summary?.diffs}>
<box>
<text>
<b>Modified Files</b>
</text>
<For each={files()}>{(file) => <text fg={Theme.textMuted}>{Locale.truncateMiddle(file, 40)}</text>}</For>
<For each={session().summary?.diffs || []}>
{(item) => (
<box flexDirection="row" gap={1} justifyContent="space-between">
<text fg={Theme.textMuted}>{Locale.truncateMiddle(item.file, 40)}</text>
<box flexDirection="row" gap={1}>
<text fg={Theme.diffAdded}>+{item.additions}</text>
<text fg={Theme.diffRemoved}>-{item.deletions}</text>
</box>
</box>
)}
</For>
</box>
</Show>
<Show when={todo().length > 0}>