The best way to control Claude Code, Codex and more from any computer or phone

main
tsx 68 lines 2.4 KB
Raw
1 import type { SourceControlProviderKind } from "@t3tools/contracts";
2 import { T, useMessages, Var } from "gt-react";
3 import { ExternalLinkIcon, TriangleAlertIcon } from "lucide-react";
4
5 import { getSourceControlPresentationForKind } from "~/sourceControlPresentation";
6
7 import { Button } from "../ui/button";
8 import { Empty, EmptyDescription, EmptyHeader, EmptyTitle } from "../ui/empty";
9 import { RefreshIcon } from "../ui/refresh-icon";
10 import { changeRequestTermKind } from "./changeRequestTerm";
11 import { describePullRequestDiffError } from "./pullRequestDiffError";
12
13 export function PullRequestDiffUnavailableState({
14 error,
15 provider,
16 url,
17 onRetry,
18 }: {
19 error: string;
20 provider: SourceControlProviderKind;
21 url: string;
22 onRetry: () => void;
23 }) {
24 const m = useMessages();
25 const { providerName, terminology } = getSourceControlPresentationForKind(provider);
26 const { title, description } = describePullRequestDiffError(
27 error,
28 providerName,
29 changeRequestTermKind(terminology),
30 m,
31 );
32
33 return (
34 <Empty size="compact" className="min-h-full" role="status">
35 <div className="flex size-11 items-center justify-center rounded-full bg-warning-surface text-warning">
36 <TriangleAlertIcon aria-hidden className="size-5" />
37 </div>
38 <EmptyHeader>
39 <EmptyTitle>{title}</EmptyTitle>
40 <EmptyDescription>{description}</EmptyDescription>
41 </EmptyHeader>
42 <div className="flex flex-wrap justify-center gap-2">
43 <Button size="sm" variant="default" onClick={onRetry}>
44 <RefreshIcon />
45 <T>Try again</T>
46 </Button>
47 <Button
48 size="sm"
49 variant="outline"
50 render={<a href={url} target="_blank" rel="noopener noreferrer" />}
51 >
52 <ExternalLinkIcon aria-hidden />
53 <T>
54 Open on <Var>{providerName}</Var>
55 </T>
56 </Button>
57 </div>
58 <details className="w-full max-w-lg text-xs text-muted-foreground">
59 <summary className="mx-auto w-fit cursor-pointer rounded-sm -outline-offset-2 hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring">
60 <T>Technical details</T>
61 </summary>
62 <pre className="scrollbar-gutter-both mt-3 max-h-40 overflow-auto whitespace-pre-wrap break-words rounded-lg border border-border bg-muted/40 p-3 text-left font-mono text-xs">
63 {error}
64 </pre>
65 </details>
66 </Empty>
67 );
68 }