diff options
| author | Adam <[email protected]> | 2026-03-11 12:24:51 -0500 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-03-11 12:24:51 -0500 |
| commit | bcc0d198678f9e88c1868bda2e7f6e54768117fe (patch) | |
| tree | c05a217ade3f40bd3059faaa73c57e4350cda2c0 /packages/app/src | |
| parent | 9c585bb58ba98826cd5f7bf596cb65f411d378a4 (diff) | |
| download | opencode-bcc0d198678f9e88c1868bda2e7f6e54768117fe.tar.gz opencode-bcc0d198678f9e88c1868bda2e7f6e54768117fe.zip | |
chore(app): simplify review pane (#17066)
Diffstat (limited to 'packages/app/src')
| -rw-r--r-- | packages/app/src/pages/session.tsx | 141 |
1 files changed, 49 insertions, 92 deletions
diff --git a/packages/app/src/pages/session.tsx b/packages/app/src/pages/session.tsx index 79c8d42f5..a5c7bf90b 100644 --- a/packages/app/src/pages/session.tsx +++ b/packages/app/src/pages/session.tsx @@ -862,6 +862,36 @@ export default function Page() { </div> ) + const reviewEmpty = (input: { loadingClass: string; emptyClass: string }) => { + if (store.changes === "turn") return emptyTurn() + + if (hasReview() && !diffsReady()) { + return <div class={input.loadingClass}>{language.t("session.review.loadingChanges")}</div> + } + + if (reviewEmptyKey() === "session.review.noVcs") { + return ( + <div class={input.emptyClass}> + <div class="flex flex-col gap-3"> + <div class="text-14-medium text-text-strong">Create a Git repository</div> + <div class="text-14-regular text-text-base max-w-md" style={{ "line-height": "var(--line-height-normal)" }}> + Track, review, and undo changes in this project + </div> + </div> + <Button size="large" disabled={ui.git} onClick={initGit}> + {ui.git ? "Creating Git repository..." : "Create Git repository"} + </Button> + </div> + ) + } + + return ( + <div class={input.emptyClass}> + <div class="text-14-regular text-text-weak max-w-56">{language.t(reviewEmptyKey())}</div> + </div> + ) + } + const reviewContent = (input: { diffStyle: DiffStyle onDiffStyleChange?: (style: DiffStyle) => void @@ -870,98 +900,25 @@ export default function Page() { emptyClass: string }) => ( <Show when={!store.deferRender}> - <Switch> - <Match when={store.changes === "turn" && !!params.id}> - <SessionReviewTab - title={changesTitle()} - empty={emptyTurn()} - diffs={reviewDiffs} - view={view} - diffStyle={input.diffStyle} - onDiffStyleChange={input.onDiffStyleChange} - onScrollRef={(el) => setTree("reviewScroll", el)} - focusedFile={tree.activeDiff} - onLineComment={(comment) => addCommentToContext({ ...comment, origin: "review" })} - onLineCommentUpdate={updateCommentInContext} - onLineCommentDelete={removeCommentFromContext} - lineCommentActions={reviewCommentActions()} - comments={comments.all()} - focusedComment={comments.focus()} - onFocusedCommentChange={comments.setFocus} - onViewFile={openReviewFile} - classes={input.classes} - /> - </Match> - <Match when={hasReview()}> - <Show - when={diffsReady()} - fallback={<div class={input.loadingClass}>{language.t("session.review.loadingChanges")}</div>} - > - <SessionReviewTab - title={changesTitle()} - diffs={reviewDiffs} - view={view} - diffStyle={input.diffStyle} - onDiffStyleChange={input.onDiffStyleChange} - onScrollRef={(el) => setTree("reviewScroll", el)} - focusedFile={tree.activeDiff} - onLineComment={(comment) => addCommentToContext({ ...comment, origin: "review" })} - onLineCommentUpdate={updateCommentInContext} - onLineCommentDelete={removeCommentFromContext} - lineCommentActions={reviewCommentActions()} - comments={comments.all()} - focusedComment={comments.focus()} - onFocusedCommentChange={comments.setFocus} - onViewFile={openReviewFile} - classes={input.classes} - /> - </Show> - </Match> - <Match when={true}> - <SessionReviewTab - title={changesTitle()} - empty={ - store.changes === "turn" ? ( - emptyTurn() - ) : reviewEmptyKey() === "session.review.noVcs" ? ( - <div class={input.emptyClass}> - <div class="flex flex-col gap-3"> - <div class="text-14-medium text-text-strong">Create a Git repository</div> - <div - class="text-14-regular text-text-base max-w-md" - style={{ "line-height": "var(--line-height-normal)" }} - > - Track, review, and undo changes in this project - </div> - </div> - <Button size="large" disabled={ui.git} onClick={initGit}> - {ui.git ? "Creating Git repository..." : "Create Git repository"} - </Button> - </div> - ) : ( - <div class={input.emptyClass}> - <div class="text-14-regular text-text-weak max-w-56">{language.t(reviewEmptyKey())}</div> - </div> - ) - } - diffs={reviewDiffs} - view={view} - diffStyle={input.diffStyle} - onDiffStyleChange={input.onDiffStyleChange} - onScrollRef={(el) => setTree("reviewScroll", el)} - focusedFile={tree.activeDiff} - onLineComment={(comment) => addCommentToContext({ ...comment, origin: "review" })} - onLineCommentUpdate={updateCommentInContext} - onLineCommentDelete={removeCommentFromContext} - lineCommentActions={reviewCommentActions()} - comments={comments.all()} - focusedComment={comments.focus()} - onFocusedCommentChange={comments.setFocus} - onViewFile={openReviewFile} - classes={input.classes} - /> - </Match> - </Switch> + <SessionReviewTab + title={changesTitle()} + empty={reviewEmpty(input)} + diffs={reviewDiffs} + view={view} + diffStyle={input.diffStyle} + onDiffStyleChange={input.onDiffStyleChange} + onScrollRef={(el) => setTree("reviewScroll", el)} + focusedFile={tree.activeDiff} + onLineComment={(comment) => addCommentToContext({ ...comment, origin: "review" })} + onLineCommentUpdate={updateCommentInContext} + onLineCommentDelete={removeCommentFromContext} + lineCommentActions={reviewCommentActions()} + comments={comments.all()} + focusedComment={comments.focus()} + onFocusedCommentChange={comments.setFocus} + onViewFile={openReviewFile} + classes={input.classes} + /> </Show> ) |
