qwen-code/packages/web-shell/client/components/artifacts/LineStats.tsx
ytahdn 0ef3a76bda
feat(web-shell): add artifact right panel (#6591)
* feat(web-shell): add artifact right panel

* fix(web-shell): address artifact panel review feedback

* fix(web-shell): handle artifact panel review edge cases

* fix(web-shell): tighten scheduled task parsing

* fix(web-shell): address artifact panel review followups

* fix(web-shell): guard large file diff stats

* fix(web-shell): address review panel suggestions

* test(webui): stabilize heartbeat prompt cleanup test

* fix(web-shell): address artifact review refresh issues

* test(web-shell): stabilize ChatPane artifact hook mock

* fix(web-shell): clear stale session artifacts while loading

* fix(web-shell): preserve artifact tabs during refresh

* fix(web-shell): address artifact review followups

* fix(web-shell): respect workspace cwd for artifact outputs

* fix(web-shell): scope artifact panel actions to pane

* fix(web-shell): resolve split pane merge conflict

* fix(web-shell): clear stale artifact panel state

* fix(web-shell): preserve leading turn outputs

* fix(web-shell): tighten turn output selectors

* fix(web-shell): harden artifact preview sanitizer

* fix(web-shell): address artifact panel review regressions

* fix(web-shell): reconcile split pane artifact snapshots

* fix(web-shell): clear pane artifacts on session switch

* fix(web-shell): clear stale right panel snapshots

* fix(web-shell): repair scheduled task hint string

---------

Co-authored-by: ytahdn <ytahdn@gmail.com>
Co-authored-by: qwen-code-dev-bot <qwen-code-dev-bot@users.noreply.github.com>
2026-07-11 00:13:49 +00:00

41 lines
1 KiB
TypeScript

import type { TurnOutputFileChange } from './TurnOutputs';
export function LineStats({
additions,
deletions,
className,
additionsClassName,
deletionsClassName,
}: {
additions: number | undefined;
deletions: number | undefined;
className: string;
additionsClassName: string;
deletionsClassName: string;
}) {
if (additions === undefined || deletions === undefined) return null;
return (
<span className={className}>
<span className={additionsClassName}>+{additions}</span>
<span className={deletionsClassName}>-{deletions}</span>
</span>
);
}
export function sumLineStats(changes: readonly TurnOutputFileChange[]) {
if (
changes.some(
(change) =>
change.additions === undefined || change.deletions === undefined,
)
) {
return undefined;
}
return changes.reduce(
(sum, change) => ({
additions: sum.additions + (change.additions ?? 0),
deletions: sum.deletions + (change.deletions ?? 0),
}),
{ additions: 0, deletions: 0 },
);
}