'use client'; import { Input, Label, Textarea } from '@/components/input'; import { Button } from '@/components/ui/button'; import { apiFetch } from '@/lib/api'; import { Loader2 } from 'lucide-react'; import Link from 'next/link'; import { useEffect, useState } from 'react'; interface Ticket { id: string; subject: string; status: 'awaiting_admin' | 'awaiting_user' | 'closed'; createdAt: string; lastMessageAt: string; } const STATUS_LABEL: Record = { awaiting_admin: 'Open — awaiting support', awaiting_user: 'Reply received', closed: 'Closed', }; const STATUS_COLOR: Record = { awaiting_admin: 'text-amber-300', awaiting_user: 'text-emerald-300', closed: 'text-[--color-fg-subtle]', }; export default function SupportPage() { const [tickets, setTickets] = useState(null); const [showNew, setShowNew] = useState(false); const [subject, setSubject] = useState(''); const [body, setBody] = useState(''); const [busy, setBusy] = useState(false); const [error, setError] = useState(null); function load() { apiFetch<{ tickets: Ticket[] }>('/v1/support/tickets') .then((r) => setTickets(r.tickets)) .catch((e) => setError((e as Error).message)); } useEffect(load, []); async function createTicket(e: React.FormEvent) { e.preventDefault(); setBusy(true); setError(null); try { await apiFetch('/v1/support/tickets', { method: 'POST', body: JSON.stringify({ subject, body }), }); setSubject(''); setBody(''); setShowNew(false); load(); } catch (err) { setError((err as Error).message); } finally { setBusy(false); } } return (

Support

Open a ticket and we'll get back to you within one business day.

{!showNew && ( )}
{showNew && (
setSubject(e.target.value)} placeholder="Briefly — what's up?" />