Skip to content

feat(code): add diff stats to convo view#2065

Open
adboio wants to merge 1 commit intomainfrom
05-06-feat_code_add_diff_stats_to_convo_view
Open

feat(code): add diff stats to convo view#2065
adboio wants to merge 1 commit intomainfrom
05-06-feat_code_add_diff_stats_to_convo_view

Conversation

@adboio
Copy link
Copy Markdown
Contributor

@adboio adboio commented May 6, 2026

Problem

there's no way to see number of files changed without opening + expanding review panel

Changes

adds a lil diff indicator by the context indicator

Screenshot 2026-05-06 at 10.02.10 AM.png

clicking will open the review panel in expanded mode

How did you test this?

manually

Publish to changelog?

yes

Copy link
Copy Markdown
Contributor Author

adboio commented May 6, 2026

@adboio adboio requested a review from a team May 6, 2026 17:32
@adboio adboio marked this pull request as ready for review May 6, 2026 17:32
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 6, 2026

Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
apps/code/src/renderer/features/sessions/components/DiffStatsChip.tsx:16-57
**Logic duplicated between `DiffStatsChip` and `DiffStatsBadge`**

Both components share the same `useTaskDiffStats` call, `useReviewNavigationStore` subscription pattern, `handleClick` toggle logic, `GitDiff` icon, and Tooltip with the same keyboard shortcut. The only real differences are the wrapping element (`Flex` vs `Button`), tooltip side (`top` vs `bottom`), and the review mode opened (`"expanded"` vs `"split"`). Consider extracting the shared state/callback logic into a shared hook (e.g. `useDiffStatsToggle`) to satisfy OnceAndOnlyOnce.

Reviews (1): Last reviewed commit: "feat(code): add diff stats to convo view" | Re-trigger Greptile

Comment on lines +16 to +57
export function DiffStatsChip({ task }: DiffStatsChipProps) {
const taskId = task.id;
const { filesChanged, linesAdded, linesRemoved } = useTaskDiffStats(task);

const reviewMode = useReviewNavigationStore(
(s) => s.reviewModes[taskId] ?? "closed",
);
const setReviewMode = useReviewNavigationStore((s) => s.setReviewMode);

if (filesChanged === 0) return null;

const isOpen = reviewMode !== "closed";

const handleClick = () => {
setReviewMode(taskId, isOpen ? "closed" : "expanded");
};

return (
<Tooltip
content={isOpen ? "Close review" : "Open review"}
shortcut={formatHotkey(SHORTCUTS.TOGGLE_REVIEW_PANEL)}
side="top"
>
<Flex
align="center"
gap="1"
onClick={handleClick}
className="cursor-pointer select-none text-[13px] text-gray-10 tabular-nums hover:text-gray-12"
>
<GitDiff size={12} className="shrink-0" />
<Text className="text-[13px]">
{filesChanged} {filesChanged === 1 ? "file" : "files"}
</Text>
{linesAdded > 0 && (
<Text className="text-(--green-9) text-[13px]">+{linesAdded}</Text>
)}
{linesRemoved > 0 && (
<Text className="text-(--red-9) text-[13px]">-{linesRemoved}</Text>
)}
</Flex>
</Tooltip>
);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Logic duplicated between DiffStatsChip and DiffStatsBadge

Both components share the same useTaskDiffStats call, useReviewNavigationStore subscription pattern, handleClick toggle logic, GitDiff icon, and Tooltip with the same keyboard shortcut. The only real differences are the wrapping element (Flex vs Button), tooltip side (top vs bottom), and the review mode opened ("expanded" vs "split"). Consider extracting the shared state/callback logic into a shared hook (e.g. useDiffStatsToggle) to satisfy OnceAndOnlyOnce.

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/code/src/renderer/features/sessions/components/DiffStatsChip.tsx
Line: 16-57

Comment:
**Logic duplicated between `DiffStatsChip` and `DiffStatsBadge`**

Both components share the same `useTaskDiffStats` call, `useReviewNavigationStore` subscription pattern, `handleClick` toggle logic, `GitDiff` icon, and Tooltip with the same keyboard shortcut. The only real differences are the wrapping element (`Flex` vs `Button`), tooltip side (`top` vs `bottom`), and the review mode opened (`"expanded"` vs `"split"`). Consider extracting the shared state/callback logic into a shared hook (e.g. `useDiffStatsToggle`) to satisfy OnceAndOnlyOnce.

How can I resolve this? If you propose a fix, please make it concise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant