StatusBadge.tsx26 lines · main
| 1 | import { Badge } from 'ui' |
| 2 | |
| 3 | import { CloneStatus } from '@/data/projects/clone-status-query' |
| 4 | |
| 5 | export const StatusBadge = ({ |
| 6 | status, |
| 7 | }: { |
| 8 | status: NonNullable<CloneStatus['clones']>[number]['status'] |
| 9 | }) => { |
| 10 | const statusTextMap = { |
| 11 | IN_PROGRESS: 'RESTORING', |
| 12 | COMPLETED: 'COMPLETED', |
| 13 | REMOVED: 'REMOVED', |
| 14 | FAILED: 'FAILED', |
| 15 | } |
| 16 | |
| 17 | if (status === 'IN_PROGRESS') { |
| 18 | return <Badge variant="warning">{statusTextMap[status]}</Badge> |
| 19 | } |
| 20 | |
| 21 | if (status === 'FAILED') { |
| 22 | return <Badge variant="destructive">{statusTextMap[status]}</Badge> |
| 23 | } |
| 24 | |
| 25 | return <Badge>{statusTextMap[status]}</Badge> |
| 26 | } |