1import { InfoIcon, RotateCwIcon } from "lucide-react";
2import { Button } from "../ui/button";
3import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip";
4
5export function DiffFileStatus({
6 error,
7 truncated,
8 retry,
9}: {
10 error?: boolean | undefined;
11 truncated?: boolean | undefined;
12 retry: () => void;
13}) {
14 if (!error && !truncated) return null;
15 return (
16 <Tooltip>
17 <TooltipTrigger
18 render={
19 <Button
20 size="icon-micro"
21 variant="ghost-muted"
22 aria-label={error ? "Retry loading diff" : "Partial diff preview"}
23 onClick={(event) => {
24 event.stopPropagation();
25 if (error) retry();
26 }}
27 />
28 }
29 >
30 {error ? <RotateCwIcon className="size-3" /> : <InfoIcon className="size-3" />}
31 </TooltipTrigger>
32 <TooltipPopup>
33 {error
34 ? "Retry loading diff"
35 : "This file is too large to show in full. Counts include all changes."}
36 </TooltipPopup>
37 </Tooltip>
38 );
39}