diff --git a/src/renderer/src/assets/main.css b/src/renderer/src/assets/main.css index 572f0cc90..cf049abc6 100644 --- a/src/renderer/src/assets/main.css +++ b/src/renderer/src/assets/main.css @@ -723,6 +723,8 @@ .editor-header-path { display: block; + min-width: 0; + flex: 0 1 auto; padding: 0; max-width: 100%; border: none; diff --git a/src/renderer/src/components/editor/CombinedDiffViewer.tsx b/src/renderer/src/components/editor/CombinedDiffViewer.tsx index 2b0ea7981..d9fe3ba6e 100644 --- a/src/renderer/src/components/editor/CombinedDiffViewer.tsx +++ b/src/renderer/src/components/editor/CombinedDiffViewer.tsx @@ -40,7 +40,7 @@ import type { GitDiffResult, GitStatusEntry } from '../../../../shared/types' -import { Check, Copy, MessageSquare, PanelLeftOpen, Trash2 } from 'lucide-react' +import { Check, Copy, MessageSquare, PanelLeftOpen, Sparkles, Trash2 } from 'lucide-react' import { toast } from 'sonner' import { DiffSectionItem } from './DiffSectionItem' import { DiffNotesSendMenu } from './DiffNotesSendMenu' @@ -1055,17 +1055,19 @@ export default function CombinedDiffViewer({ {isCommitMode && commitCompare ? ` in ${commitCompare.compareRef}` : ''} {diffCommentCount > 0 && ( -
+
@@ -1082,7 +1084,8 @@ export default function CombinedDiffViewer({ worktreeId={file.worktreeId} groupId={activeGroupId ?? file.worktreeId} comments={diffCommentsForWorktree} - triggerClassName="h-7 rounded-none border-l border-border/60 px-2" + actionLabel="Send" + triggerClassName="h-6 gap-1 rounded-none border-l border-border/70 px-2 text-[11px] font-medium leading-none text-foreground/80 hover:bg-accent hover:text-foreground" iconClassName="size-3" />
diff --git a/src/renderer/src/components/editor/DiffNotesSendMenu.tsx b/src/renderer/src/components/editor/DiffNotesSendMenu.tsx index c5e315459..e7833952c 100644 --- a/src/renderer/src/components/editor/DiffNotesSendMenu.tsx +++ b/src/renderer/src/components/editor/DiffNotesSendMenu.tsx @@ -1,5 +1,5 @@ import React, { useMemo } from 'react' -import { Send } from 'lucide-react' +import { Send, Sparkles } from 'lucide-react' import type { DiffComment } from '../../../../shared/types' import { useAppStore } from '@/store' import { @@ -24,6 +24,9 @@ export function DiffNotesSendMenu({ filePath, showFileScope = false, triggerClassName, + triggerLabel, + triggerCount, + actionLabel, iconClassName = 'size-3.5', align = 'end' }: { @@ -33,6 +36,9 @@ export function DiffNotesSendMenu({ filePath?: string showFileScope?: boolean triggerClassName?: string + triggerLabel?: string + triggerCount?: number + actionLabel?: string iconClassName?: string align?: 'start' | 'center' | 'end' }): React.JSX.Element { @@ -65,10 +71,25 @@ export function DiffNotesSendMenu({ triggerClassName )} disabled={!hasUnsentNotes} - aria-label="Send notes to a new agent" + aria-label={ + triggerLabel ? `Send ${triggerLabel} to a new agent` : 'Send notes to a new agent' + } onClick={(event) => event.stopPropagation()} > + {triggerLabel ? ( + <> + + {triggerLabel} + {triggerCount !== undefined ? ( + + {triggerCount} + + ) : null} + + + ) : null} + {actionLabel ? {actionLabel} : null} @@ -81,11 +102,11 @@ export function DiffNotesSendMenu({ <> Send notes - - This file - - {unsentFileNotes.length} - + + - - All unsent notes - - {unsentNotes.length} - + + ) } + +function NoteScopeMenuRow({ label, count }: { label: string; count: number }): React.JSX.Element { + return ( + + {label} + {count} + + ) +} diff --git a/src/renderer/src/components/editor/EditorPanelHeader.tsx b/src/renderer/src/components/editor/EditorPanelHeader.tsx index efd2c4cb5..35da844ef 100644 --- a/src/renderer/src/components/editor/EditorPanelHeader.tsx +++ b/src/renderer/src/components/editor/EditorPanelHeader.tsx @@ -1,4 +1,4 @@ -import { useEffect, useState } from 'react' +import { useEffect, useMemo, useState } from 'react' import { Columns2, Copy, @@ -108,6 +108,10 @@ export function EditorPanelHeader({ const headerCopyState = getEditorHeaderCopyState(activeFile) const diffComments = useAppStore((s) => s.getDiffComments(activeFile.worktreeId)) const activeGroupId = useAppStore((s) => s.activeGroupIdByWorktree[activeFile.worktreeId]) + const fileDiffComments = useMemo( + () => diffComments.filter((comment) => comment.filePath === activeFile.relativePath), + [activeFile.relativePath, diffComments] + ) useEffect(() => { const closeMenu = (): void => setPathMenuOpen(false) @@ -208,14 +212,17 @@ export function EditorPanelHeader({ )} - {isSingleDiff && diffComments.length > 0 && ( + {isSingleDiff && fileDiffComments.length > 0 && ( )} {canOpenPreviewToSide && (