Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

DiffFileStatus.tsx

39 lines1.0 KB

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