|
1 | | -import { OctagonAlertIcon } from "lucide-react"; |
| 1 | +import { Settings2Icon } from "lucide-react"; |
2 | 2 | import type { ReactNode } from "react"; |
3 | 3 |
|
4 | 4 | import { |
5 | 5 | ensureClientSettingsHydrated, |
6 | 6 | useClientSettingsHydrationStatus, |
7 | 7 | } from "../hooks/useSettings"; |
8 | 8 | import { Button } from "./ui/button"; |
| 9 | +import { |
| 10 | + Empty, |
| 11 | + EmptyContent, |
| 12 | + EmptyDescription, |
| 13 | + EmptyHeader, |
| 14 | + EmptyMedia, |
| 15 | + EmptyTitle, |
| 16 | +} from "./ui/empty"; |
9 | 17 | import { RefreshIcon } from "./ui/refresh-icon"; |
10 | | -import { StandalonePage, StandalonePageIcon } from "./ui/standalone-page"; |
| 18 | +import { StandalonePage } from "./ui/standalone-page"; |
11 | 19 |
|
12 | 20 | /** Edits made on defaults after a failed read are never saved, so the app waits for a good read. */ |
13 | 21 | export function ClientSettingsRecoveryGate({ children }: { readonly children: ReactNode }) { |
14 | 22 | const status = useClientSettingsHydrationStatus(); |
15 | 23 | if (status !== "failed" && status !== "retrying") return children; |
16 | 24 | const retrying = status === "retrying"; |
17 | 25 | return ( |
18 | | - <StandalonePage size="card"> |
19 | | - <div className="flex items-center gap-3"> |
20 | | - <StandalonePageIcon tone="error"> |
21 | | - <OctagonAlertIcon /> |
22 | | - </StandalonePageIcon> |
23 | | - <h1 className="min-w-0 flex-1 text-label text-strong-foreground"> |
24 | | - Couldn't load your settings |
25 | | - </h1> |
26 | | - <Button |
27 | | - size="standard" |
28 | | - variant="secondary" |
29 | | - disabled={retrying} |
30 | | - onClick={() => void ensureClientSettingsHydrated().catch(() => undefined)} |
31 | | - > |
32 | | - <RefreshIcon refreshing={retrying} /> |
33 | | - Retry |
34 | | - </Button> |
35 | | - </div> |
| 26 | + <StandalonePage size="bare"> |
| 27 | + <Empty size="compact"> |
| 28 | + <EmptyMedia variant="icon"> |
| 29 | + <Settings2Icon /> |
| 30 | + </EmptyMedia> |
| 31 | + <EmptyHeader> |
| 32 | + <EmptyTitle>Couldn't load your settings</EmptyTitle> |
| 33 | + <EmptyDescription>Your saved settings are unchanged.</EmptyDescription> |
| 34 | + </EmptyHeader> |
| 35 | + <EmptyContent> |
| 36 | + <Button |
| 37 | + size="standard" |
| 38 | + disabled={retrying} |
| 39 | + aria-busy={retrying} |
| 40 | + onClick={() => void ensureClientSettingsHydrated().catch(() => undefined)} |
| 41 | + > |
| 42 | + <RefreshIcon refreshing={retrying} /> |
| 43 | + {retrying ? "Retrying…" : "Retry"} |
| 44 | + </Button> |
| 45 | + </EmptyContent> |
| 46 | + </Empty> |
36 | 47 | </StandalonePage> |
37 | 48 | ); |
38 | 49 | } |
0 commit comments