"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 ( ); }