wip: desktop work

This commit is contained in:
Adam
2025-10-30 07:26:06 -05:00
parent 3541fdcb20
commit 30f4c2cf4c
17 changed files with 427 additions and 789 deletions

View File

@@ -0,0 +1,24 @@
import type { FileDiff } from "@opencode-ai/sdk"
import { createMemo, Show } from "solid-js"
export function DiffChanges(props: { diff: FileDiff | FileDiff[] }) {
const additions = createMemo(() =>
Array.isArray(props.diff)
? props.diff.reduce((acc, diff) => acc + (diff.additions ?? 0), 0)
: props.diff.additions,
)
const deletions = createMemo(() =>
Array.isArray(props.diff)
? props.diff.reduce((acc, diff) => acc + (diff.deletions ?? 0), 0)
: props.diff.deletions,
)
const total = createMemo(() => (additions() ?? 0) + (deletions() ?? 0))
return (
<Show when={total() > 0}>
<div data-component="diff-changes">
<span data-slot="additions">{`+${additions()}`}</span>
<span data-slot="deletions">{`-${deletions()}`}</span>
</div>
</Show>
)
}