"use client"; import { useEffect, useState } from "react"; import { CheckCircle2, Info, X } from "lucide-react"; // A minimal toast for a confirmed import. Deliberately not a dependency: the app needs // exactly one, and a full toast library would ship far more surface than that justifies. // // Both fills come from the existing palette rather than inventing hues: #00798C teal is // this app's success colour (the "All booked" badge, the income tiles), and #EDAE49 sunny // is its existing attention/amber accent. // // Announced politely rather than assertively — a confirmation is not urgent, and it // should not interrupt whatever a screen reader is currently saying. // // z-[1300], not a low value: the sticky header is z-[1100] (it has to clear Leaflet's // z-1000 control panes) and the mobile nav drawer is z-[1200]. Below those the toast // rendered behind the nav bar. export function Toast({ message, detail, tone = "success", onDismiss, duration = 6000, }: { message: string; detail?: string; // "success" = it was imported. "notice" = nothing was added, but nothing is wrong // either — e.g. the file was already in the register. tone?: "success" | "notice"; onDismiss: () => void; duration?: number; }) { const [leaving, setLeaving] = useState(false); const close = () => { setLeaving(true); setTimeout(onDismiss, 200); // let the transition run before unmounting }; useEffect(() => { const t = setTimeout(close, duration); return () => clearTimeout(t); // eslint-disable-next-line react-hooks/exhaustive-deps }, [message, detail, duration]); return (