diff --git a/apps/code/src/renderer/features/task-detail/components/ChangesPanel.tsx b/apps/code/src/renderer/features/task-detail/components/ChangesPanel.tsx
index c5d9bcf1a..af6d93c7b 100644
--- a/apps/code/src/renderer/features/task-detail/components/ChangesPanel.tsx
+++ b/apps/code/src/renderer/features/task-detail/components/ChangesPanel.tsx
@@ -1,8 +1,13 @@
import { TreeFileRow } from "@components/TreeDirectoryRow";
import { PanelMessage } from "@components/ui/PanelMessage";
import { Tooltip } from "@components/ui/Tooltip";
+import { useEffectiveDiffSource } from "@features/code-review/hooks/useEffectiveDiffSource";
import { useExternalApps } from "@features/external-apps/hooks/useExternalApps";
-import { useGitQueries } from "@features/git-interaction/hooks/useGitQueries";
+import {
+ useGitQueries,
+ useLocalBranchChangedFiles,
+ usePrChangedFiles,
+} from "@features/git-interaction/hooks/useGitQueries";
import { makeFileKey } from "@features/git-interaction/utils/fileKey";
import { invalidateGitWorkingTreeQueries } from "@features/git-interaction/utils/gitCacheKeys";
import { partitionByStaged } from "@features/git-interaction/utils/partitionByStaged";
@@ -468,7 +473,32 @@ export function ChangesPanel({ taskId, task }: ChangesPanelProps) {
return ;
}
-function LocalChangesPanel({ taskId, task: _task }: ChangesPanelProps) {
+function LocalChangesPanel({ taskId, task }: ChangesPanelProps) {
+ const { effectiveSource, prUrl, linkedBranch } =
+ useEffectiveDiffSource(taskId);
+ const repoPath = useCwd(taskId);
+
+ if (effectiveSource === "branch") {
+ return (
+
+ );
+ }
+
+ if (effectiveSource === "pr") {
+ return ;
+ }
+
+ return ;
+}
+
+function LocalWorkingTreeChangesPanel({
+ taskId,
+ task: _task,
+}: ChangesPanelProps) {
const workspace = useWorkspace(taskId);
const repoPath = useCwd(taskId);
const queryClient = useQueryClient();
@@ -576,3 +606,108 @@ function LocalChangesPanel({ taskId, task: _task }: ChangesPanelProps) {
);
}
+
+interface RemoteChangesListProps {
+ taskId: string;
+ files: ChangedFile[];
+ isLoading: boolean;
+ emptyMessage: string;
+ panelId: string;
+}
+
+function RemoteChangesList({
+ taskId,
+ files,
+ isLoading,
+ emptyMessage,
+ panelId,
+}: RemoteChangesListProps) {
+ const activeFilePath = useReviewNavigationStore(
+ (s) => s.activeFilePaths[taskId] ?? null,
+ );
+
+ const renderFile = useCallback(
+ (file: ChangedFile, depth: number) => {
+ const key = makeFileKey(file.staged, file.path);
+ return (
+
+ );
+ },
+ [taskId, activeFilePath],
+ );
+
+ if (isLoading && files.length === 0) {
+ return Loading changes...;
+ }
+
+ if (files.length === 0) {
+ return {emptyMessage};
+ }
+
+ return (
+
+
+
+
+
+ );
+}
+
+function BranchChangesPanel({
+ taskId,
+ repoPath,
+ branch,
+}: {
+ taskId: string;
+ repoPath: string | undefined;
+ branch: string | null;
+}) {
+ const { data: files = [], isLoading } = useLocalBranchChangedFiles(
+ repoPath ?? null,
+ branch,
+ );
+
+ if (!repoPath || !branch) {
+ return No branch selected;
+ }
+
+ return (
+
+ );
+}
+
+function PrChangesPanel({
+ taskId,
+ prUrl,
+}: {
+ taskId: string;
+ prUrl: string | null;
+}) {
+ const { data: files = [], isLoading } = usePrChangedFiles(prUrl);
+
+ if (!prUrl) {
+ return No pull request linked;
+ }
+
+ return (
+
+ );
+}