"use client";
import { AlertCircleIcon, CheckIcon, ClockIcon, SaveIcon } from "lucide-react";
import { useState } from "react";
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
import { Spinner } from "@/components/ui/spinner";
import type { SaveState } from "@/hooks/use-manual-save";
import { FloatingSavePanel } from "./floating-save-panel";
interface SaveFeedbackProps {
state: SaveState;
issues?: readonly string[];
conflictVersion?: number | null;
canOverwrite?: boolean;
onReloadLatest?: () => void;
onOverwrite?: () => void;
}
function SaveFeedback({
state,
issues = [],
conflictVersion,
canOverwrite = false,
onReloadLatest,
onOverwrite,
}: SaveFeedbackProps) {
const [showIssues, setShowIssues] = useState(false);
if (state === "saving")
return (
แก้ไขรายการด้านล่าง แล้วกดปุ่มบันทึก ข้อมูลที่กรอกไว้ยังไม่หาย
{issues.length ? (กรุณาเลือกโหลดข้อมูลล่าสุดหรือเขียนทับด้วย Draft นี้ {conflictVersion ? ` (version ${conflictVersion})` : ""}