@devries-cameron20 / t3code Mirror · read-only
Fork 0

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

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 04:45 UTC

main
tsx 60 lines 1.79 KB
Raw
1 import { RefreshIcon } from "~/components/ui/refresh-icon";
2 import { T, useGT } from "gt-react";
3 import { ExternalLinkIcon } from "lucide-react";
4
5 import { Button } from "../ui/button";
6 import { Empty, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from "../ui/empty";
7 import { PullRequestGlyph } from "./pullRequestIcons";
8
9 export function PullRequestsUnavailableState({
10 title,
11 error,
12 onRetry,
13 refreshing = false,
14 host,
15 }: {
16 title?: string;
17 error: string;
18 onRetry?: () => void;
19 refreshing?: boolean;
20 host?: { readonly url: string; readonly openLabel: string };
21 }) {
22 const gt = useGT();
23 return (
24 <Empty className="scrollbar-gutter-both min-h-0 justify-center-safe overflow-y-auto [&>*]:shrink-0">
25 <EmptyMedia variant="icon">
26 <PullRequestGlyph.pullRequest />
27 </EmptyMedia>
28 <EmptyHeader>
29 <EmptyTitle>{title ?? gt("Could not load pull requests")}</EmptyTitle>
30 <EmptyDescription>{error}</EmptyDescription>
31 </EmptyHeader>
32 {onRetry || host ? (
33 <div className="flex flex-wrap justify-center gap-2">
34 {onRetry ? (
35 <Button
36 size="sm"
37 variant="outline"
38 onClick={onRetry}
39 disabled={refreshing}
40 aria-busy={refreshing}
41 >
42 <RefreshIcon size="sm" refreshing={refreshing} />
43 <T>Retry</T>
44 </Button>
45 ) : null}
46 {host ? (
47 <Button
48 size="sm"
49 variant="outline"
50 render={<a href={host.url} target="_blank" rel="noopener noreferrer" />}
51 >
52 <ExternalLinkIcon aria-hidden className="size-3.5" />
53 {host.openLabel}
54 </Button>
55 ) : null}
56 </div>
57 ) : null}
58 </Empty>
59 );
60 }