Spaces:
Sleeping
Sleeping
Download frontend/src/components/stillwave/BackupStatus.tsx from kishankrish19/Chat: direct link, hf CLI and curl.
- Browser
- Download file 2.1 kB
-
https://huggingface.co/spaces/kishankrish19/Chat/resolve/main/frontend/src/components/stillwave/BackupStatus.tsx
- Command line
-
hf download hf://spaces/kishankrish19/Chat/frontend/src/components/stillwave/BackupStatus.tsx
-
curl -L -o BackupStatus.tsx https://huggingface.co/spaces/kishankrish19/Chat/resolve/main/frontend/src/components/stillwave/BackupStatus.tsx
2.1 kB
| "use client"; | |
| import { | |
| Cloud, | |
| CloudCheck, | |
| CloudUpload, | |
| CloudOff, | |
| CloudAlert, | |
| HardDrive, | |
| } from "lucide-react"; | |
| import { useLibraryStore } from "@/lib/store/libraryStore"; | |
| const states = { | |
| replicated: { | |
| icon: CloudCheck, | |
| label: "Encrypted backup verified on Hugging Face", | |
| short: "Backup verified", | |
| tone: "complete", | |
| }, | |
| remote: { | |
| icon: Cloud, | |
| label: "Available in the connected Hugging Face dataset", | |
| short: "On Hugging Face", | |
| tone: "complete", | |
| }, | |
| pending: { | |
| icon: CloudUpload, | |
| label: | |
| "Not backed up yet · waiting to upload to Hugging Face; automatic retries are enabled", | |
| short: "Backup queued", | |
| tone: "waiting", | |
| }, | |
| running: { | |
| icon: CloudUpload, | |
| label: "Uploading to Hugging Face and verifying the backup", | |
| short: "Backing up…", | |
| tone: "waiting", | |
| }, | |
| paused: { | |
| icon: CloudOff, | |
| label: | |
| "Not backed up · cloud uploads are paused; ask an administrator to enable a storage account", | |
| short: "Backup paused", | |
| tone: "waiting", | |
| }, | |
| failed: { | |
| icon: CloudAlert, | |
| label: | |
| "Not backed up · cloud upload failed; an administrator can retry it in Storage settings", | |
| short: "Backup failed", | |
| tone: "failed", | |
| }, | |
| local: { | |
| icon: HardDrive, | |
| label: "Stored on this server only · no verified Hugging Face backup", | |
| short: "Server only", | |
| tone: "waiting", | |
| }, | |
| }; | |
| export default function BackupStatus({ | |
| id, | |
| status, | |
| showLabel = false, | |
| }: { | |
| id?: string; | |
| status?: string; | |
| showLabel?: boolean; | |
| }) { | |
| const live = useLibraryStore((s) => | |
| id ? s.activity[id]?.backup_status : undefined, | |
| ); | |
| const value = live || status; | |
| if (!value) return null; | |
| const state = states[value as keyof typeof states] || states.local; | |
| const Icon = state.icon; | |
| return ( | |
| <span | |
| className={`backup-status ${state.tone} ${value === "running" ? "uploading" : ""}`} | |
| role="img" | |
| aria-label={state.label} | |
| title={state.label} | |
| > | |
| <Icon size={15} aria-hidden="true" /> | |
| {showLabel && <span>{state.short}</span>} | |
| </span> | |
| ); | |
| } | |