import { Loader2 } from "lucide-react"; import { Button } from "@/components/ui/button"; import { cn } from "@/lib/utils"; /** * Shown above a composer while a send waits for the connection. The text stays * on this device and resends with its original request ID, so it cannot post * twice; the user can resend now or take the text back with Cancel. * * Without `onResendNow` (a send saved by an older version, with no stored * request to replay) it only says the outcome is unknown and offers Cancel. */ export function PendingSendNotice({ noun = "message", resending, stalled, persisted = false, onResendNow, onCancel, className, }: { /** What is being sent: "comment", "task", "update". */ noun?: string; resending: boolean; stalled: boolean; persisted?: boolean; onResendNow?: () => void; onCancel: () => void; className?: string; }) { const replayable = Boolean(onResendNow); const title = !replayable ? `We couldn’t confirm whether this ${noun} was sent.` : resending ? "Sending…" : stalled ? `Couldn’t send this ${noun} yet.` : "Sending when reconnected…"; const detail = replayable ? persisted ? `Your ${noun} is saved on this device.` : "Browser storage is unavailable. Keep this tab open or copy your text before leaving." : "It may already be in the conversation. Check it before sending again; Cancel keeps your text."; return (
{resending ?
{detail}