fix(desktop): max height on message diffs, session stats
This commit is contained in:
parent
05ae99a09b
commit
c59ec71918
4 changed files with 17 additions and 17 deletions
|
|
@ -1,18 +1,20 @@
|
|||
import type { FileDiff } from "@opencode-ai/sdk"
|
||||
import { createMemo, For, Match, Show, Switch } from "solid-js"
|
||||
|
||||
export function DiffChanges(props: { diff: FileDiff | FileDiff[]; variant?: "default" | "bars" }) {
|
||||
export function DiffChanges(props: {
|
||||
changes: { additions: number; deletions: number } | { additions: number; deletions: number }[]
|
||||
variant?: "default" | "bars"
|
||||
}) {
|
||||
const variant = () => props.variant ?? "default"
|
||||
|
||||
const additions = createMemo(() =>
|
||||
Array.isArray(props.diff)
|
||||
? props.diff.reduce((acc, diff) => acc + (diff.additions ?? 0), 0)
|
||||
: props.diff.additions,
|
||||
Array.isArray(props.changes)
|
||||
? props.changes.reduce((acc, diff) => acc + (diff.additions ?? 0), 0)
|
||||
: props.changes.additions,
|
||||
)
|
||||
const deletions = createMemo(() =>
|
||||
Array.isArray(props.diff)
|
||||
? props.diff.reduce((acc, diff) => acc + (diff.deletions ?? 0), 0)
|
||||
: props.diff.deletions,
|
||||
Array.isArray(props.changes)
|
||||
? props.changes.reduce((acc, diff) => acc + (diff.deletions ?? 0), 0)
|
||||
: props.changes.deletions,
|
||||
)
|
||||
const total = createMemo(() => (additions() ?? 0) + (deletions() ?? 0))
|
||||
|
||||
|
|
|
|||
|
|
@ -364,7 +364,7 @@ ToolRegistry.register({
|
|||
</div>
|
||||
<div data-slot="actions">
|
||||
<Show when={props.metadata.filediff}>
|
||||
<DiffChanges diff={props.metadata.filediff} />
|
||||
<DiffChanges changes={props.metadata.filediff} />
|
||||
</Show>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue