From 35350b1d25a56665cf065eba68929fc00617fdd2 Mon Sep 17 00:00:00 2001 From: Shoubhit Dash Date: Fri, 3 Apr 2026 20:24:57 +0530 Subject: feat: restore git-backed review modes (#20845) --- packages/ui/src/components/session-review.tsx | 35 +++++++++++++-------------- packages/ui/src/i18n/en.ts | 2 ++ 2 files changed, 19 insertions(+), 18 deletions(-) (limited to 'packages/ui/src') diff --git a/packages/ui/src/components/session-review.tsx b/packages/ui/src/components/session-review.tsx index 1040aa292..3b582d66f 100644 --- a/packages/ui/src/components/session-review.tsx +++ b/packages/ui/src/components/session-review.tsx @@ -359,11 +359,10 @@ export const SessionReview = (props: SessionReviewProps) => {
- - {(file) => { + + {(diff) => { let wrapper: HTMLDivElement | undefined - - const item = createMemo(() => diffs().get(file)!) + const file = diff.file const expanded = createMemo(() => open().includes(file)) const mounted = createMemo(() => expanded() && (!!store.visible[file] || pinned(file))) @@ -372,9 +371,9 @@ export const SessionReview = (props: SessionReviewProps) => { const comments = createMemo(() => grouped().get(file) ?? []) const commentedLines = createMemo(() => comments().map((c) => c.selection)) - const beforeText = () => (typeof item().before === "string" ? item().before : "") - const afterText = () => (typeof item().after === "string" ? item().after : "") - const changedLines = () => item().additions + item().deletions + const beforeText = () => (typeof diff.before === "string" ? diff.before : "") + const afterText = () => (typeof diff.after === "string" ? diff.after : "") + const changedLines = () => diff.additions + diff.deletions const mediaKind = createMemo(() => mediaKindFromPath(file)) const tooLarge = createMemo(() => { @@ -385,9 +384,9 @@ export const SessionReview = (props: SessionReviewProps) => { }) const isAdded = () => - item().status === "added" || (beforeText().length === 0 && afterText().length > 0) + diff.status === "added" || (beforeText().length === 0 && afterText().length > 0) const isDeleted = () => - item().status === "deleted" || (afterText().length === 0 && beforeText().length > 0) + diff.status === "deleted" || (afterText().length === 0 && beforeText().length > 0) const selectedLines = createMemo(() => { const current = selection() @@ -425,7 +424,7 @@ export const SessionReview = (props: SessionReviewProps) => { file, selection, comment, - preview: selectionPreview(item(), selection), + preview: selectionPreview(diff, selection), }) }, onUpdate: ({ id, comment, selection }) => { @@ -434,7 +433,7 @@ export const SessionReview = (props: SessionReviewProps) => { file, selection, comment, - preview: selectionPreview(item(), selection), + preview: selectionPreview(diff, selection), }) }, onDelete: (comment) => { @@ -513,7 +512,7 @@ export const SessionReview = (props: SessionReviewProps) => { {i18n.t("ui.sessionReview.change.added")} - +
@@ -527,7 +526,7 @@ export const SessionReview = (props: SessionReviewProps) => { - + @@ -582,7 +581,7 @@ export const SessionReview = (props: SessionReviewProps) => { { props.onDiffRendered?.() @@ -599,17 +598,17 @@ export const SessionReview = (props: SessionReviewProps) => { commentedLines={commentedLines()} before={{ name: file, - contents: typeof item().before === "string" ? item().before : "", + contents: typeof diff.before === "string" ? diff.before : "", }} after={{ name: file, - contents: typeof item().after === "string" ? item().after : "", + contents: typeof diff.after === "string" ? diff.after : "", }} media={{ mode: "auto", path: file, - before: item().before, - after: item().after, + before: diff.before, + after: diff.after, readFile: props.readFile, }} /> diff --git a/packages/ui/src/i18n/en.ts b/packages/ui/src/i18n/en.ts index e66b55092..837fd5afc 100644 --- a/packages/ui/src/i18n/en.ts +++ b/packages/ui/src/i18n/en.ts @@ -1,5 +1,7 @@ export const dict: Record = { "ui.sessionReview.title": "Session changes", + "ui.sessionReview.title.git": "Git changes", + "ui.sessionReview.title.branch": "Branch changes", "ui.sessionReview.title.lastTurn": "Last turn changes", "ui.sessionReview.diffStyle.unified": "Unified", "ui.sessionReview.diffStyle.split": "Split", -- cgit v1.2.3