"use client" /** * ExamLockSessionAlert — soft, non-blocking session messaging inside the lock shell. * * Use for recoverable delivery notices (sync lag, background save status) — not hard * integrity pauses. Offline / tab-blur / leave-attempt pauses belong in * `ExamLockInterruptionPanel` via `useExamLockSessionController`. */ import * as React from "react" import { LocalBanner } from "@/components/ui/banner" import { cn } from "@/lib/utils" export type ExamLockSessionAlertKind = | "offline" | "degraded" | "error" | "info" | "syncing" const KIND_PRESETS: Record< ExamLockSessionAlertKind, { variant: "info" | "warning" | "error" | "success" icon: string defaultTitle: string } > = { offline: { variant: "warning", icon: "fa-wifi-slash", defaultTitle: "Connection lost", }, degraded: { variant: "warning", icon: "fa-triangle-exclamation", defaultTitle: "Unstable connection", }, error: { variant: "error", icon: "fa-circle-exclamation", defaultTitle: "Exxat could not save your last answer", }, info: { variant: "info", icon: "fa-circle-info", defaultTitle: "Session notice", }, syncing: { variant: "info", icon: "fa-arrows-rotate", defaultTitle: "Saving your work", }, } export interface ExamLockSessionAlertProps { kind: ExamLockSessionAlertKind title?: string children: React.ReactNode /** Retry / reconnect — shown as a compact button (not dismiss). */ onRetry?: () => void retryLabel?: string dismissible?: boolean onDismiss?: () => void className?: string } export function ExamLockSessionAlert({ kind, title, children, onRetry, retryLabel = "Try again", dismissible = false, onDismiss, className, }: ExamLockSessionAlertProps) { const preset = KIND_PRESETS[kind] return ( {children} ) }