Skip to content

Commit 925fd2b

Browse files
authored
Refactor PR review sidebar into modular workflow panels (#485)
* Refactor PR review sidebar into modular workflow panels - Split review UI into dedicated banner, findings, action rail, and progress components - Add AI review, workflow, and rules tabs with keyboard and mutation hooks - Expand shared PR review contracts and state plumbing * Refine PR review UX and surface agent findings - Add PR review commands to the command palette - Tighten file comment validation and line entry UX - Show agent review and rule violation banners with inline findings
1 parent 704003b commit 925fd2b

20 files changed

+2712
-601
lines changed

apps/web/src/components/CommandPalette.tsx

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { ThreadId } from "@okcode/contracts";
2-
import { useNavigate, useParams } from "@tanstack/react-router";
2+
import { useNavigate, useParams, useRouterState } from "@tanstack/react-router";
33
import { useCallback, useMemo, useRef, useState } from "react";
44
import {
55
ArrowLeftIcon,
@@ -22,6 +22,9 @@ import type { LucideIcon } from "lucide-react";
2222
import { cn } from "~/lib/utils";
2323
import { useStore } from "~/store";
2424
import { useCommandPaletteStore } from "~/commandPaletteStore";
25+
import { usePrReviewCommands } from "~/components/pr-review/usePrReviewCommands";
26+
import { usePrReviewStore } from "~/prReviewStore";
27+
import { ensureNativeApi } from "~/nativeApi";
2528
import { useHandleNewThread } from "~/hooks/useHandleNewThread";
2629
import { useCurrentWorktreeCleanupCandidates } from "~/hooks/useCurrentWorktreeCleanupCandidates";
2730
import { useTheme } from "~/hooks/useTheme";
@@ -147,6 +150,25 @@ function CommandsView() {
147150
const mruThreadIds = useCommandPaletteStore((s) => s.mruThreadIds);
148151
const openWorktreeCleanupDialog = useWorktreeCleanupStore((s) => s.openDialog);
149152
const { hasCandidates: hasWorktreeCleanupCandidates } = useCurrentWorktreeCleanupCandidates();
153+
154+
// PR Review commands integration
155+
const currentPath = useRouterState({ select: (s) => s.location.pathname });
156+
const isPrReviewRoute = currentPath.includes("/pr-review");
157+
const prReviewDashboard = usePrReviewStore((s) => s.selectedPrNumber);
158+
const prReviewCommands = usePrReviewCommands({
159+
enabled: isPrReviewRoute,
160+
onStartAgentReview: () => {
161+
closePalette();
162+
const store = usePrReviewStore.getState();
163+
// Trigger is handled by the caller
164+
document.dispatchEvent(new CustomEvent("command-palette:start-agent-review"));
165+
},
166+
onOpenOnGitHub: () => {
167+
closePalette();
168+
document.dispatchEvent(new CustomEvent("command-palette:open-on-github"));
169+
},
170+
});
171+
150172
const routeThreadId = useParams({
151173
strict: false,
152174
select: (params) => (params.threadId ? ThreadId.makeUnsafe(params.threadId) : null),
@@ -371,6 +393,11 @@ function CommandsView() {
371393
},
372394
});
373395

396+
// ── PR Review (conditionally visible) ──
397+
for (const prCmd of prReviewCommands) {
398+
cmds.push(prCmd);
399+
}
400+
374401
return cmds.filter((cmd) => !cmd.hidden);
375402
}, [
376403
projects,
@@ -389,6 +416,7 @@ function CommandsView() {
389416
pushMruThread,
390417
openWorktreeCleanupDialog,
391418
hasWorktreeCleanupCandidates,
419+
prReviewCommands,
392420
]);
393421

394422
// Filter commands by query

0 commit comments

Comments
 (0)