"use client"; import { Button } from "@mdxui/primitives/button"; import { cn } from "@mdxui/primitives/lib/utils"; import { RotateCcw, X } from "lucide-react"; import { memo } from "react"; interface RecoveryBannerProps { timestamp: number; onRestore: () => void; onDismiss: () => void; } function formatTimeSince(timestamp: number): string { const seconds = Math.floor((Date.now() - timestamp) / 1000); if (seconds < 60) return "just now"; if (seconds < 3600) return `${Math.floor(seconds / 60)}m ago`; if (seconds < 86400) return `${Math.floor(seconds / 3600)}h ago`; return `${Math.floor(seconds / 86400)}d ago`; } export const RecoveryBanner = memo(function RecoveryBanner({ timestamp, onRestore, onDismiss, }: RecoveryBannerProps) { return (
Unsaved changes from{" "} {formatTimeSince(timestamp)}
); });