"use client" /** * ExamLockInterruptionPanel โ€” pause surface behind the sliding question card. * * Recoverable pauses use one generic screen. Action pairs match `DialogFooter`: * Retry (ghost) left, **Raise hand (filled primary) right** โ€” pin with `sm:order-1` / `sm:order-2`. */ import * as React from "react" import { EXAM_LOCK_INTERRUPTION_CATEGORY_CHROME, EXAM_LOCK_INTERRUPTION_PRESETS, examLockInterruptionCategory, } from "@/components/exam-lock/exam-lock-interruption-presets" import { ExamLockCautionStrip } from "@/components/exam-lock/exam-lock-caution-strip" import { ExamLockTimerDisplay } from "@/components/exam-lock/exam-lock-timer-display" import type { ExamLockPauseReason } from "@/components/exam-lock/exam-lock-session-types" import { LocalBanner } from "@/components/ui/banner" import { Button } from "@/components/ui/button" import { cn } from "@/lib/utils" export interface ExamLockInterruptionSupportActions { retry?: { label?: string onClick: () => void disabled?: boolean } connectWithPerson?: { label?: string onConnect: () => void } } export interface ExamLockInterruptionPanelProps { open: boolean pauseReason: ExamLockPauseReason severity?: "hard" | "terminal" title?: string description?: React.ReactNode pausedAtSeconds: number primaryAction?: { label: string onClick: () => void disabled?: boolean /** When true, shows the raised-hand confirmation state. */ raised?: boolean } supportActions?: ExamLockInterruptionSupportActions className?: string } type InterruptionPreset = (typeof EXAM_LOCK_INTERRUPTION_PRESETS)[ExamLockPauseReason] type InterruptionChrome = (typeof EXAM_LOCK_INTERRUPTION_CATEGORY_CHROME)[keyof typeof EXAM_LOCK_INTERRUPTION_CATEGORY_CHROME] type InterruptionPrimaryAction = NonNullable type InterruptionRetry = NonNullable const SUPPORT_REQUESTED_FALLBACK = "Hand raised. Someone from your program will check in with you shortly." /** Derived display flags โ€” all branching on category / props lives here, not in the component. */ function resolveInterruptionView( category: ReturnType, preset: InterruptionPreset, primaryAction: InterruptionPrimaryAction | undefined, supportActions: ExamLockInterruptionSupportActions | undefined, ) { const recoverable = category === "technical" || category === "integrity" const terminal = category === "terminal" const retry = terminal ? undefined : supportActions?.retry return { recoverable, terminal, retry, handRaised: primaryAction?.raised === true, showCautionStrips: preset.cautionStrips === true, showActions: !terminal && (primaryAction != null || retry != null), retryLabel: retry?.label ?? preset.retryActionLabel ?? "Retry", supportRequestedMessage: preset.supportRequestedMessage ?? SUPPORT_REQUESTED_FALLBACK, } } function InterruptionIcon({ preset, chrome }: { preset: InterruptionPreset; chrome: InterruptionChrome }) { return (