"use client"; import { AnimatePresence, motion } from "framer-motion"; import { CheckIcon, LoaderCircleIcon, TriangleAlertIcon } from "lucide-react"; import type { SaveState } from "@/hooks/use-autosave"; import { cn } from "@/lib/utils"; export function SaveIndicator({ state, className }: { state: SaveState; className?: string }) { const content = state === "saving" ? { icon: , text: "Saving", tone: "text-muted-foreground" } : state === "saved" ? { icon: , text: "Saved", tone: "text-[var(--success)]" } : state === "error" ? { icon: , text: "Save failed", tone: "text-destructive" } : state === "conflict" ? { icon: , text: "Changed elsewhere — not saved", tone: "text-destructive" } : state === "dirty" ? { icon: , text: "Unsaved", tone: "text-muted-foreground" } : null; return (
{content && ( {content.icon} {content.text} )}
); }