import { useState } from "react"; import { Button } from "~/components/ui/button"; import { Popover, PopoverContent, PopoverTrigger, } from "~/components/ui/popover"; import { Cloud, CloudOff, Wifi, WifiOff } from "lucide-react"; import { cn } from "~/lib/utils"; export function SyncButton() { const [isSync, setIsSync] = useState(true); const [isOpen, setIsOpen] = useState(false); const lastSync = new Date(); // TODO: Replace with actual last sync date const getIcon = () => { if (isSync) return ; return ; }; const getStatusColor = () => { if (isSync) return "text-primary"; return "text-muted-foreground"; }; const formatLastSync = (date: Date | null) => { if (!date) return "N/A"; const now = new Date(); const diff = now.getTime() - date.getTime(); const minutes = Math.floor(diff / 60000); const hours = Math.floor(minutes / 60); const days = Math.floor(hours / 24); if (minutes < 1) return "A l'instant"; if (minutes < 60) return `il y a ${minutes}m`; if (hours < 24) return `il y a ${hours}h`; return `il y a ${days}j`; }; return ( {}} > {getIcon()} {isSync ? "Sync" : "Offline"} {isSync ? ( ) : ( )} Status {isSync ? "Connecté" : "Erreur"} Dernière mis à jour : {formatLastSync(lastSync)} {/* TODO: {syncStatus.isOnline && syncStatus.status !== "syncing" && ( Sync Now )} */} ); }