From 71930621fdfeb8f3d2b3baf956cd690cd699101a Mon Sep 17 00:00:00 2001 From: Daniel Polito Date: Fri, 6 Feb 2026 18:01:40 -0300 Subject: feat(desktop): Session Review Images (#12360) --- packages/ui/src/components/session-review.css | 4 ++ packages/ui/src/components/session-review.tsx | 78 ++++++++++++++++++--------- 2 files changed, 58 insertions(+), 24 deletions(-) (limited to 'packages/ui/src/components') diff --git a/packages/ui/src/components/session-review.css b/packages/ui/src/components/session-review.css index df6df4649..30bfe3b71 100644 --- a/packages/ui/src/components/session-review.css +++ b/packages/ui/src/components/session-review.css @@ -166,6 +166,10 @@ color: var(--icon-diff-delete-base); } + [data-slot="session-review-change"][data-type="modified"] { + color: var(--icon-diff-modified-base); + } + [data-slot="session-review-file-container"] { padding: 0; } diff --git a/packages/ui/src/components/session-review.tsx b/packages/ui/src/components/session-review.tsx index 70d9fe802..fe2475548 100644 --- a/packages/ui/src/components/session-review.tsx +++ b/packages/ui/src/components/session-review.tsx @@ -332,8 +332,9 @@ export const SessionReview = (props: SessionReviewProps) => { const beforeText = () => (typeof diff.before === "string" ? diff.before : "") const afterText = () => (typeof diff.after === "string" ? diff.after : "") - const isAdded = () => beforeText().length === 0 && afterText().length > 0 - const isDeleted = () => afterText().length === 0 && beforeText().length > 0 + const isAdded = () => diff.status === "added" || (beforeText().length === 0 && afterText().length > 0) + const isDeleted = () => + diff.status === "deleted" || (afterText().length === 0 && beforeText().length > 0) const isImage = () => isImageFile(diff.file) const isAudio = () => isAudioFile(diff.file) @@ -422,6 +423,7 @@ export const SessionReview = (props: SessionReviewProps) => { if (!isImage()) return if (imageSrc()) return if (imageStatus() !== "idle") return + if (isDeleted()) return const reader = props.readFile if (!reader) return @@ -546,6 +548,11 @@ export const SessionReview = (props: SessionReviewProps) => { {i18n.t("ui.sessionReview.change.removed")} + + + {i18n.t("ui.sessionReview.change.modified")} + + @@ -564,28 +571,51 @@ export const SessionReview = (props: SessionReviewProps) => { scheduleAnchors() }} > - { - props.onDiffRendered?.() - scheduleAnchors() - }} - enableLineSelection={props.onLineComment != null} - onLineSelected={handleLineSelected} - onLineSelectionEnd={handleLineSelectionEnd} - selectedLines={selectedLines()} - commentedLines={commentedLines()} - before={{ - name: diff.file!, - contents: typeof diff.before === "string" ? diff.before : "", - }} - after={{ - name: diff.file!, - contents: typeof diff.after === "string" ? diff.after : "", - }} - /> + + +
+ {diff.file} +
+
+ +
+ + {i18n.t("ui.sessionReview.change.removed")} + +
+
+ +
+ + {imageStatus() === "loading" ? "Loading..." : "Image"} + +
+
+ + { + props.onDiffRendered?.() + scheduleAnchors() + }} + enableLineSelection={props.onLineComment != null} + onLineSelected={handleLineSelected} + onLineSelectionEnd={handleLineSelectionEnd} + selectedLines={selectedLines()} + commentedLines={commentedLines()} + before={{ + name: diff.file!, + contents: typeof diff.before === "string" ? diff.before : "", + }} + after={{ + name: diff.file!, + contents: typeof diff.after === "string" ? diff.after : "", + }} + /> + +
{(comment) => ( -- cgit v1.2.3