Open History to see the last commit
1import { ExternalLinkIcon, GitPullRequestIcon, RefreshCwIcon } from "lucide-react";
2
3import { Button } from "../ui/button";
4import {
5 Empty,
6 EmptyContent,
7 EmptyDescription,
8 EmptyHeader,
9 EmptyMedia,
10 EmptyTitle,
11} from "../ui/empty";
12
13export function PullRequestsUnavailableState({
14 title = "Could not load pull requests",
15 error,
16 onRetry,
17 gitHubUrl,
18}: {
19 title?: string;
20 error: string;
21 onRetry?: () => void;
22 gitHubUrl?: string;
23}) {
24 return (
25 <Empty className="px-4 py-16 md:px-4">
26 <EmptyMedia variant="icon">
27 <GitPullRequestIcon />
28 </EmptyMedia>
29 <EmptyHeader>
30 <EmptyTitle>{title}</EmptyTitle>
31 {/* The caller names the fix — update the environment, install gh, sign in — so this
32 shows its message rather than trying to infer one from the failure text. */}
33 <EmptyDescription>{error}</EmptyDescription>
34 </EmptyHeader>
35 {onRetry || gitHubUrl ? (
36 <EmptyContent className="flex-row flex-wrap justify-center gap-2">
37 {onRetry ? (
38 <Button size="sm" variant="outline" onClick={onRetry}>
39 <RefreshCwIcon className="size-3.5" />
40 Retry
41 </Button>
42 ) : null}
43 {gitHubUrl ? (
44 <Button
45 size="sm"
46 variant="outline"
47 render={<a href={gitHubUrl} target="_blank" rel="noopener noreferrer" />}
48 >
49 <ExternalLinkIcon aria-hidden className="size-3.5" />
50 Open on GitHub
51 </Button>
52 ) : null}
53 </EmptyContent>
54 ) : null}
55 </Empty>
56 );
57}