import { AlertCircle, LifeBuoy, Loader2 } from "lucide-react"; import { Card, CardContent } from "../../../components/ui/card.tsx"; import { Alert, AlertDescription } from "../../../components/ui/alert.tsx"; import { Badge } from "../../../components/ui/badge.tsx"; import { EmptyState } from "../../../components/ui/empty-state.tsx"; import { useSupportTickets, TICKET_STATUS_LABELS, TICKET_STATUS_VARIANT, TICKET_HOLDER_LABELS, } from "../../../hooks/useSupportTickets"; import { formatDateTime } from "../../../utils/dateUtils"; /** * THE PRACTICE'S OWN SUPPORT SCREEN - where a ticket raised from the assistant's escalation form * (`SupportTicketForm`, in `SetupHelpWidget`) is FOLLOWED afterwards. Raising a ticket happens in the * widget; everything that happens next happens here - a ticket somebody has to remember to check is a * ticket they stop filing and telephone about instead. * * A PLAIN ANCHOR TO EACH ROW, NOT ``. This app is a HashRouter (see App.tsx and * organizationPortalUrl.ts's own header on why), and `href="#/dashboard/support/"` is the same * plain-anchor pattern App.tsx already uses for internal navigation (the upgrade-your-plan and * edit-profile links). ``/`useNavigate` need a Router ancestor to render at all; a bare anchor * needs none and still lands on exactly the right in-app route once clicked. * * The status label, Badge variant and holder label maps live in `useSupportTickets.ts`, not here - * this screen and `SupportTicketDetail` both paint the same status and holder, and a second copy of * the map that decides the colour is how a future contrast fix lands on one screen and leaves the * other wrong. */ export const SupportPage = () => { const { tickets, loading, error } = useSupportTickets(); return (

{/* NAMES WHO ACTUALLY RECEIVES THESE, AT CREATION. A ticket raised here goes first to the contractor managing this practice's platform, never straight to Akashic - but escalation can move it there afterward, which is why each row also names who holds it now, the same correction `speakerLabel` makes on the thread itself. */}

Tickets this practice has raised with your contractor, and what happened next.

{error && ( {error} )} {loading ? (

Loading support tickets…

) : ( {tickets.length === 0 ? ( // Says what WILL appear here rather than asserting nothing is wrong - a // practice on day one has never raised a ticket and does not yet know what // this screen is for. ) : ( tickets.map((ticket) => (

{ticket.subject}

{ticket.reference && `${ticket.reference} — `} Updated {formatDateTime(ticket.updatedAt)}

{/* Status and holder answer two different questions - what is happening to the ticket, and who is holding it - so each gets its own badge rather than folding one into the other's words. */}
{TICKET_STATUS_LABELS[ticket.status]} {TICKET_HOLDER_LABELS[ticket.holder]}
)) )}
)}
); }; export default SupportPage;