|
| 1 | +import { |
| 2 | + ArrowsClockwiseIcon, |
| 3 | + CircleNotchIcon, |
| 4 | + WarningIcon, |
| 5 | +} from "@phosphor-icons/react"; |
| 6 | +import { Box, Button, Flex, Text } from "@radix-ui/themes"; |
| 7 | + |
| 8 | +export function SignalsLoadingState() { |
| 9 | + return ( |
| 10 | + <Flex height="100%" style={{ minHeight: 0 }}> |
| 11 | + <Box flexGrow="1" style={{ minWidth: 0 }}> |
| 12 | + <Flex direction="column" height="100%"> |
| 13 | + <Flex |
| 14 | + align="center" |
| 15 | + justify="between" |
| 16 | + px="3" |
| 17 | + py="2" |
| 18 | + style={{ borderBottom: "1px solid var(--gray-5)" }} |
| 19 | + > |
| 20 | + <Flex align="center" gap="2"> |
| 21 | + <CircleNotchIcon |
| 22 | + size={12} |
| 23 | + className="animate-spin text-gray-10" |
| 24 | + /> |
| 25 | + <Text size="1" color="gray" className="font-mono text-[11px]"> |
| 26 | + Loading signals |
| 27 | + </Text> |
| 28 | + </Flex> |
| 29 | + </Flex> |
| 30 | + <Flex direction="column"> |
| 31 | + {Array.from({ length: 5 }).map((_, index) => ( |
| 32 | + <Flex |
| 33 | + // biome-ignore lint/suspicious/noArrayIndexKey: static local loading placeholders |
| 34 | + key={index} |
| 35 | + direction="column" |
| 36 | + gap="2" |
| 37 | + px="3" |
| 38 | + py="3" |
| 39 | + className="border-gray-5 border-b" |
| 40 | + > |
| 41 | + <Box className="h-[12px] w-[44%] animate-pulse rounded bg-gray-4" /> |
| 42 | + <Box className="h-[11px] w-[82%] animate-pulse rounded bg-gray-3" /> |
| 43 | + </Flex> |
| 44 | + ))} |
| 45 | + </Flex> |
| 46 | + </Flex> |
| 47 | + </Box> |
| 48 | + </Flex> |
| 49 | + ); |
| 50 | +} |
| 51 | + |
| 52 | +export function SignalsErrorState({ |
| 53 | + onRetry, |
| 54 | + onGoToSetup, |
| 55 | + isRetrying, |
| 56 | +}: { |
| 57 | + onRetry: () => void; |
| 58 | + onGoToSetup: () => void; |
| 59 | + isRetrying: boolean; |
| 60 | +}) { |
| 61 | + return ( |
| 62 | + <Flex align="center" justify="center" height="100%" p="4"> |
| 63 | + <Flex |
| 64 | + direction="column" |
| 65 | + align="center" |
| 66 | + gap="3" |
| 67 | + px="4" |
| 68 | + py="4" |
| 69 | + className="w-full max-w-[460px] rounded border border-gray-6 bg-gray-2 text-center" |
| 70 | + > |
| 71 | + <WarningIcon size={20} className="text-amber-10" weight="bold" /> |
| 72 | + <Flex direction="column" gap="2" align="center"> |
| 73 | + <Text size="2" weight="medium" className="font-mono text-[12px]"> |
| 74 | + Could not load signals |
| 75 | + </Text> |
| 76 | + <Text size="1" color="gray" className="font-mono text-[11px]"> |
| 77 | + Check your connection or permissions, then retry. You can still use |
| 78 | + Setup while this is unavailable. |
| 79 | + </Text> |
| 80 | + </Flex> |
| 81 | + <Flex align="center" gap="2" wrap="wrap" justify="center"> |
| 82 | + <Button |
| 83 | + size="1" |
| 84 | + variant="soft" |
| 85 | + onClick={onRetry} |
| 86 | + className="font-mono text-[11px]" |
| 87 | + disabled={isRetrying} |
| 88 | + > |
| 89 | + {isRetrying ? ( |
| 90 | + <CircleNotchIcon size={12} className="animate-spin" /> |
| 91 | + ) : ( |
| 92 | + <ArrowsClockwiseIcon size={12} /> |
| 93 | + )} |
| 94 | + Retry |
| 95 | + </Button> |
| 96 | + <Button |
| 97 | + size="1" |
| 98 | + variant="ghost" |
| 99 | + onClick={onGoToSetup} |
| 100 | + className="font-mono text-[11px]" |
| 101 | + > |
| 102 | + Go to Setup |
| 103 | + </Button> |
| 104 | + </Flex> |
| 105 | + </Flex> |
| 106 | + </Flex> |
| 107 | + ); |
| 108 | +} |
0 commit comments