import { GitCompare } from "lucide-react"; import { Button } from "@/components/ui/button"; import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from "@/components/ui/dropdown-menu"; import type { ReviewDiffScopeMode } from "@/lib/review-diff-scope"; import { cn } from "@/lib/utils"; type CommitOption = { hash: string; label: string; timestamp: string; message?: string; }; export function ReviewCommitScopeControl({ mode, commitOptions, selectedCommitHashes, isFetching, notice, onSetFullScope, onToggleCommitSelection, }: { mode: ReviewDiffScopeMode; commitOptions: CommitOption[]; selectedCommitHashes: string[]; isFetching: boolean; notice?: string | null; onSetFullScope: () => void; onToggleCommitSelection: (hash: string) => void; }) { const selectedSet = new Set(selectedCommitHashes); const selectedCount = selectedSet.size; const scopeLabel = mode === "full" ? "All Changes" : `Range (${selectedCount})`; const selectedIndices = commitOptions .map((option, index) => (selectedSet.has(option.hash) ? index : -1)) .filter((index) => index >= 0) .sort((a, b) => a - b); const rangeStart = selectedIndices[0] ?? -1; const rangeEnd = selectedIndices[selectedIndices.length - 1] ?? -1; return (