Feedback page: results, responses, who hasn't answered, reminders (2.1.0)
- Supervisor -> Feedback (supervisors and admins, campus-scoped): every event's form with answered of asked, response rate, average rating and last reminder; per event the results per question (with the AI summary), each response, and on named forms who was asked and who has answered. - Remind those who haven't answered (or one person on a named form): a fresh link, plus the form to anyone eligible who hasn't had it; nobody gets the form or a reminder twice within 24 hours. The 3-day job is unchanged. - Anonymous forms show no names and no list of who has answered. - FeedbackInvite.reminderCount (migration 20261103120000_feedback_reminders); access log action feedback_responses; help page; dashboard and Ctrl+K links. - Roadmap: the AI helpers on the privacy pages are dropped; 2.1.0 is the feedback page. - Tests: tests/feedbackPage.test.ts, e2e/feedback.spec.ts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -8,7 +8,7 @@ import { useVisiblePolling } from "@/hooks/useVisiblePolling";
|
||||
import {
|
||||
Calendar, Banknote, Gift, Users, Ticket, QrCode, ClipboardList,
|
||||
UserPlus, FileText, MessageCircle, BarChart2, Mail, Wallet, DoorOpen, History, TicketPercent, ShieldCheck, ListChecks, WifiOff, BedDouble, Filter, ClipboardCheck, Inbox,
|
||||
Baby, HandHeart, Layers, Wrench,
|
||||
Baby, HandHeart, Layers, MessageSquareHeart, Wrench,
|
||||
} from "lucide-react";
|
||||
import { StatCard, StatCardRow } from "@/components/shared/StatCard";
|
||||
import { QuickActionTile, QuickActionGrid } from "@/components/shared/QuickActionTile";
|
||||
@@ -38,6 +38,7 @@ const QUICK_ACTIONS = [
|
||||
{ href: "/dashboard/staff/kids", label: "Kids check-in", description: "Check children in and out with pickup codes", icon: Baby },
|
||||
{ href: "/dashboard/supervisor/kids", label: "Kids check-in setup", description: "Switch it on for an event and set up the rooms", icon: Baby },
|
||||
{ href: "/dashboard/supervisor/volunteers", label: "Volunteer rosters", description: "Serving roles, who serves where, check-ins and hours", icon: HandHeart },
|
||||
{ href: "/dashboard/supervisor/feedback", label: "Feedback", description: "What people said after events, and reminders", icon: MessageSquareHeart },
|
||||
{ href: "/dashboard/supervisor/offline-scans", label: "Offline scanning", description: "Devices scanning offline and their synced scans", icon: WifiOff },
|
||||
{ href: "/dashboard/supervisor/attendance", label: "Attendance", description: "Who came to each session, and certificates", icon: ClipboardCheck },
|
||||
{ href: "/dashboard/supervisor/waitlist", label: "Waitlist", description: "People waiting for sold-out tickets", icon: ListChecks },
|
||||
|
||||
@@ -0,0 +1,347 @@
|
||||
"use client";
|
||||
|
||||
import React, { useCallback, useEffect, useMemo, useState } from "react";
|
||||
import Link from "next/link";
|
||||
import { ArrowLeft, BellRing, MessageSquareHeart, Pencil, Send, Star } from "lucide-react";
|
||||
import { useAuth } from "@/hooks/useAuth";
|
||||
import { useDismissingState } from "@/hooks/useDismissingState";
|
||||
import { apiV2Data, type V2Result } from "@/lib/apiV2";
|
||||
import { errorMessage } from "@/lib/utils";
|
||||
import { useExternalEffect } from "@/lib/hooks";
|
||||
import { BackLink } from "@/components/shared/BackLink";
|
||||
import { AiFeedbackSummary } from "@/components/reports/AiFeedbackSummary";
|
||||
|
||||
type Row = V2Result<"/feedback", "get">["data"][number];
|
||||
type Detail = V2Result<"/events/{id}/feedback/results", "get">["data"];
|
||||
type Question = Detail["questions"][number];
|
||||
type Person = NonNullable<Detail["people"]>[number];
|
||||
type Tab = "results" | "responses" | "people";
|
||||
type Show = "all" | "sent" | "waiting";
|
||||
|
||||
// Dates arrive as ISO strings (the generated types call them unknown).
|
||||
const fmt = (d: unknown, time = true) =>
|
||||
typeof d === "string" || d instanceof Date ? new Date(d).toLocaleString("en-ZA", { day: "numeric", month: "short", year: "numeric", ...(time ? { hour: "2-digit", minute: "2-digit" } : {}) }) : "—";
|
||||
const plural = (n: number, one: string, many = `${one}s`) => `${n} ${n === 1 ? one : many}`;
|
||||
|
||||
const STATUS: Record<Row["status"], { label: string; cls: string }> = {
|
||||
sent: { label: "Sent", cls: "bg-green-50 text-green-700 border-green-200" },
|
||||
scheduled: { label: "Scheduled", cls: "bg-blue-50 text-blue-700 border-blue-200" },
|
||||
not_scheduled: { label: "No send time", cls: "bg-gray-50 text-gray-600 border-gray-200" },
|
||||
};
|
||||
const StatusBadge = ({ status }: { status: Row["status"] }) => (
|
||||
<span className={`inline-block rounded-full border px-2 py-0.5 text-xs font-medium ${STATUS[status].cls}`}>{STATUS[status].label}</span>
|
||||
);
|
||||
const Stars = ({ value }: { value: number | null | undefined }) =>
|
||||
value == null ? <span className="text-gray-400">—</span> : <span className="inline-flex items-center gap-1 tabular-nums"><Star className="h-3.5 w-3.5 fill-amber-400 text-amber-400" aria-hidden />{value.toFixed(1)}</span>;
|
||||
|
||||
/** A horizontal bar per choice (or star), with its count. */
|
||||
function Bars({ items, total }: { items: { label: string; value: number }[]; total: number }) {
|
||||
return (
|
||||
<ul className="space-y-1.5">
|
||||
{items.map(i => (
|
||||
<li key={i.label} className="grid grid-cols-[minmax(3rem,8rem)_1fr_3rem] items-center gap-2 text-sm">
|
||||
<span className="truncate text-gray-700" title={i.label}>{i.label}</span>
|
||||
<span className="h-2.5 rounded-full bg-gray-100"><span className="block h-2.5 rounded-full bg-brand-500" style={{ width: `${total ? (i.value / total) * 100 : 0}%` }} /></span>
|
||||
<span className="text-right tabular-nums text-gray-600">{i.value}</span>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
);
|
||||
}
|
||||
|
||||
function QuestionResult({ q }: { q: Question }) {
|
||||
return (
|
||||
<section className="rounded-xl border bg-white p-4 shadow-sm">
|
||||
<div className="mb-3 flex flex-wrap items-baseline justify-between gap-2">
|
||||
<h3 className="font-medium text-gray-900">{q.label}</h3>
|
||||
<span className="text-xs text-gray-500">{plural(q.answered, "answer")}</span>
|
||||
</div>
|
||||
{q.type === "rating" && (
|
||||
<div className="grid gap-4 sm:grid-cols-[auto_1fr] sm:items-center">
|
||||
<div className="text-center"><div className="text-3xl font-semibold tabular-nums">{q.average != null ? q.average.toFixed(1) : "—"}</div><div className="text-xs text-gray-500">out of 5</div></div>
|
||||
<Bars items={[...(q.distribution || [])].reverse()} total={q.answered} />
|
||||
</div>
|
||||
)}
|
||||
{q.counts && <Bars items={q.counts} total={q.answered} />}
|
||||
{q.type === "numeric" && <p className="text-sm">Average: <strong className="tabular-nums">{q.average ?? "—"}</strong></p>}
|
||||
{q.texts && (q.texts.length === 0 ? <p className="text-sm text-gray-500">No answers yet.</p> : (
|
||||
<ul className="max-h-96 space-y-2 overflow-y-auto pr-1">
|
||||
{q.texts.map((t, i) => (
|
||||
<li key={i} className="rounded-lg bg-gray-50 px-3 py-2 text-sm text-gray-800">
|
||||
<p className="whitespace-pre-wrap">{t.value}</p>
|
||||
{t.name && <p className="mt-1 text-xs text-gray-500">— {t.name}</p>}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
))}
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
/** Supervisor → Feedback: every event's feedback, one event's results and answers, and reminders. */
|
||||
export default function FeedbackPage() {
|
||||
const { token } = useAuth();
|
||||
const [rows, setRows] = useState<Row[] | null>(null);
|
||||
const [eventId, setEventId] = useState("");
|
||||
const [detail, setDetail] = useState<Detail | null>(null);
|
||||
const [tab, setTab] = useState<Tab>("results");
|
||||
const [search, setSearch] = useState("");
|
||||
const [show, setShow] = useState<Show>("all");
|
||||
const [busy, setBusy] = useState<string | null>(null);
|
||||
const [msg, setMsg] = useDismissingState<{ type: "ok" | "err"; text: string } | null>(null);
|
||||
|
||||
const loadList = useCallback(async () => {
|
||||
if (!token) return;
|
||||
try {
|
||||
setRows(await (apiV2Data("get", "/feedback", { authToken: token }) as Promise<Row[]>));
|
||||
} catch (e) {
|
||||
setMsg({ type: "err", text: errorMessage(e) || "Could not load feedback" });
|
||||
}
|
||||
}, [token, setMsg]);
|
||||
useExternalEffect(() => { loadList(); }, [loadList]);
|
||||
|
||||
// ?event=<id> opens that event (links from elsewhere, and the back button).
|
||||
useEffect(() => {
|
||||
const read = () => setEventId(new URLSearchParams(window.location.search).get("event") || "");
|
||||
read();
|
||||
window.addEventListener("popstate", read);
|
||||
return () => window.removeEventListener("popstate", read);
|
||||
}, []);
|
||||
const open = (id: string) => {
|
||||
window.history.pushState(null, "", id ? `?event=${encodeURIComponent(id)}` : window.location.pathname);
|
||||
setEventId(id);
|
||||
setTab("results");
|
||||
};
|
||||
|
||||
const loadDetail = useCallback(async () => {
|
||||
if (!token || !eventId) { setDetail(null); return; }
|
||||
try {
|
||||
setDetail(await (apiV2Data("get", "/events/{id}/feedback/results", { params: { id: eventId }, authToken: token }) as Promise<Detail>));
|
||||
} catch (e) {
|
||||
setDetail(null);
|
||||
setMsg({ type: "err", text: errorMessage(e) || "Could not load this event's feedback" });
|
||||
}
|
||||
}, [token, eventId, setMsg]);
|
||||
useExternalEffect(() => { setDetail(null); loadDetail(); }, [loadDetail]);
|
||||
|
||||
const remind = async (userIds?: string[]) => {
|
||||
if (!detail) return;
|
||||
const who = userIds ? detail.people?.find(p => p.userId === userIds[0])?.name || "this person" : null;
|
||||
const question = who
|
||||
? `Send ${who} a reminder with a new feedback link?`
|
||||
: `Remind ${plural(detail.counts.canRemind, "person", "people")} who haven't answered${detail.counts.waiting ? `, and send the form to ${plural(detail.counts.waiting, "person", "people")} who haven't had it yet` : ""}?`;
|
||||
if (!window.confirm(question)) return;
|
||||
setBusy(userIds ? userIds[0] : "all");
|
||||
try {
|
||||
const out = await (apiV2Data("post", "/events/{id}/feedback/remind", { params: { id: detail.event.id }, authToken: token, body: { userIds: userIds ?? null } }) as Promise<{ message: string; reminded: number; newlyInvited: number }>);
|
||||
setMsg({ type: out.reminded || out.newlyInvited ? "ok" : "err", text: out.message });
|
||||
await Promise.all([loadDetail(), loadList()]);
|
||||
} catch (e) {
|
||||
setMsg({ type: "err", text: errorMessage(e) || "Could not send the reminders" });
|
||||
} finally {
|
||||
setBusy(null);
|
||||
}
|
||||
};
|
||||
|
||||
const sendNow = async () => {
|
||||
if (!detail || !window.confirm("Send the feedback form now, instead of waiting for its send time?")) return;
|
||||
setBusy("send");
|
||||
try {
|
||||
const out = await (apiV2Data("post", "/events/{id}/feedback/send-now", { params: { id: detail.event.id }, authToken: token, body: {} }) as Promise<{ message: string }>);
|
||||
setMsg({ type: "ok", text: out.message });
|
||||
await Promise.all([loadDetail(), loadList()]);
|
||||
} catch (e) {
|
||||
setMsg({ type: "err", text: errorMessage(e) || "Could not send the form" });
|
||||
} finally {
|
||||
setBusy(null);
|
||||
}
|
||||
};
|
||||
|
||||
const shown = useMemo(() => (rows || []).filter(r =>
|
||||
(show === "all" || (show === "sent" ? r.status === "sent" : r.status !== "sent")) &&
|
||||
(!search.trim() || r.event.title.toLowerCase().includes(search.trim().toLowerCase()))), [rows, show, search]);
|
||||
|
||||
const message = msg && <div role="status" className={`mb-4 rounded-lg border p-3 text-sm ${msg.type === "ok" ? "border-green-200 bg-green-50 text-green-800" : "border-red-200 bg-red-50 text-red-800"}`}>{msg.text}</div>;
|
||||
|
||||
return (
|
||||
<div className="mx-auto w-full max-w-5xl p-6">
|
||||
<div className="mb-5 flex items-center gap-3">
|
||||
<div className="flex h-10 w-10 shrink-0 items-center justify-center rounded-xl bg-brand-50"><MessageSquareHeart className="h-5 w-5 text-brand-600" /></div>
|
||||
<div>
|
||||
<BackLink href="/dashboard" />
|
||||
<h1 className="mt-0.5 text-2xl font-semibold text-gray-900">Feedback</h1>
|
||||
<p className="text-sm text-gray-500">What people said after your events, and who still has to answer</p>
|
||||
</div>
|
||||
</div>
|
||||
{message}
|
||||
|
||||
{!eventId && (
|
||||
<>
|
||||
<div className="mb-4 flex flex-wrap items-end gap-3">
|
||||
<label className="text-sm">
|
||||
<span className="mb-1 block text-xs text-gray-500">Search</span>
|
||||
<input type="search" value={search} onChange={e => setSearch(e.target.value)} placeholder="Event name" className="w-64 max-w-full rounded-lg border px-3 py-2 text-sm" />
|
||||
</label>
|
||||
<label className="text-sm">
|
||||
<span className="mb-1 block text-xs text-gray-500">Show</span>
|
||||
<select value={show} onChange={e => setShow(e.target.value as Show)} className="rounded-lg border px-3 py-2 text-sm">
|
||||
<option value="all">All forms</option>
|
||||
<option value="sent">Sent</option>
|
||||
<option value="waiting">Not sent yet</option>
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
{!rows && <p className="text-sm text-gray-500">Loading…</p>}
|
||||
{rows && rows.length === 0 && (
|
||||
<div className="rounded-xl border bg-white p-6 text-sm text-gray-600 shadow-sm">
|
||||
No event has a feedback form yet. Add one in the event editor's <strong>Feedback</strong> step (<Link className="text-brand-700 underline" href="/dashboard/supervisor/events">Manage events</Link>).
|
||||
</div>
|
||||
)}
|
||||
{rows && rows.length > 0 && shown.length === 0 && <p className="text-sm text-gray-500">No forms match.</p>}
|
||||
{shown.length > 0 && (
|
||||
<div className="overflow-x-auto rounded-xl border bg-white shadow-sm">
|
||||
<table className="w-full text-sm">
|
||||
<thead className="bg-gray-50 text-left text-xs text-gray-500">
|
||||
<tr><th className="p-3">Event</th><th className="p-3">Form</th><th className="p-3">Answered</th><th className="p-3">Rating</th><th className="p-3">Last reminder</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{shown.map(r => (
|
||||
<tr key={r.event.id} className="cursor-pointer border-t hover:bg-gray-50" onClick={() => open(r.event.id)}>
|
||||
<td className="p-3">
|
||||
<button type="button" className="text-left font-medium text-gray-900 hover:text-brand-700" onClick={e => { e.stopPropagation(); open(r.event.id); }}>{r.event.title}</button>
|
||||
<div className="text-xs text-gray-500">{fmt(r.event.startDate, false)}{r.anonymous ? " · anonymous" : ""}</div>
|
||||
</td>
|
||||
<td className="p-3"><StatusBadge status={r.status} /><div className="mt-1 text-xs text-gray-500">{r.status === "sent" ? fmt(r.sentAt) : r.status === "scheduled" ? `Goes ${fmt(r.sendAt)}` : ""}</div></td>
|
||||
<td className="p-3 tabular-nums">{r.status === "sent" ? <>{r.answered} of {r.invited}{r.responseRate != null && <span className="text-gray-500"> ({r.responseRate}%)</span>}</> : <span className="text-gray-400">—</span>}</td>
|
||||
<td className="p-3"><Stars value={r.averageRating} /></td>
|
||||
<td className="p-3 text-gray-600">{r.lastReminderAt ? fmt(r.lastReminderAt) : "—"}</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
|
||||
{eventId && (
|
||||
<>
|
||||
<button type="button" onClick={() => open("")} className="mb-3 inline-flex items-center gap-1 text-sm text-gray-600 hover:text-gray-900"><ArrowLeft className="h-4 w-4" /> All feedback</button>
|
||||
{!detail && <p className="text-sm text-gray-500">Loading…</p>}
|
||||
{detail && (
|
||||
<>
|
||||
<div className="mb-4 rounded-xl border bg-white p-4 shadow-sm">
|
||||
<div className="flex flex-wrap items-start justify-between gap-3">
|
||||
<div>
|
||||
<h2 className="text-xl font-semibold text-gray-900">{detail.event.title}</h2>
|
||||
<p className="text-sm text-gray-500">{fmt(detail.event.startDate, false)} · {detail.form.audience === "all" ? "everyone registered" : "people who checked in"} · {detail.form.anonymous ? "anonymous answers" : "named answers"}</p>
|
||||
<p className="mt-1 text-sm text-gray-600">
|
||||
<StatusBadge status={detail.form.status} />{" "}
|
||||
{detail.form.status === "sent" && <>Sent {fmt(detail.form.sentAt)}. {detail.form.autoReminderSent ? "The automatic reminder has gone out." : `Automatic reminder ${fmt(detail.form.autoReminderAt)}.`}</>}
|
||||
{detail.form.status === "scheduled" && <>Goes out {fmt(detail.form.sendAt)}.</>}
|
||||
{detail.form.status === "not_scheduled" && <>No send time is set.</>}
|
||||
</p>
|
||||
</div>
|
||||
<div className="flex flex-wrap gap-2">
|
||||
{detail.form.status !== "sent" && (
|
||||
<button type="button" onClick={sendNow} disabled={!!busy} className="inline-flex items-center gap-1.5 rounded-lg bg-brand-600 px-3 py-2 text-sm font-medium text-white hover:bg-brand-700 disabled:opacity-50"><Send className="h-4 w-4" /> {busy === "send" ? "Sending…" : "Send now"}</button>
|
||||
)}
|
||||
{detail.form.status === "sent" && (
|
||||
<button type="button" onClick={() => remind()} disabled={!!busy || detail.counts.canRemind + detail.counts.waiting === 0}
|
||||
title={detail.counts.canRemind + detail.counts.waiting === 0 ? (detail.counts.notAnswered ? "Everyone who hasn't answered was sent the form or a reminder in the last 24 hours" : "Everyone has answered") : undefined}
|
||||
className="inline-flex items-center gap-1.5 rounded-lg bg-brand-600 px-3 py-2 text-sm font-medium text-white hover:bg-brand-700 disabled:opacity-50">
|
||||
<BellRing className="h-4 w-4" /> {busy === "all" ? "Sending…" : detail.counts.canRemind + detail.counts.waiting ? `Remind ${detail.counts.canRemind + detail.counts.waiting} who haven't answered` : "Remind those who haven't answered"}
|
||||
</button>
|
||||
)}
|
||||
<Link href={`/dashboard/supervisor/events?edit=${encodeURIComponent(detail.event.id)}`} className="inline-flex items-center gap-1.5 rounded-lg border px-3 py-2 text-sm hover:bg-gray-50"><Pencil className="h-4 w-4" /> Edit form</Link>
|
||||
</div>
|
||||
</div>
|
||||
<dl className="mt-4 grid grid-cols-2 gap-3 sm:grid-cols-4">
|
||||
{[
|
||||
["Asked", detail.counts.invited],
|
||||
["Answered", detail.counts.answered],
|
||||
["Response rate", detail.counts.responseRate != null ? `${detail.counts.responseRate}%` : "—"],
|
||||
["Average rating", detail.averageRating != null ? `${detail.averageRating.toFixed(1)} ★` : "—"],
|
||||
].map(([k, v]) => (
|
||||
<div key={String(k)} className="rounded-lg bg-gray-50 p-3"><dt className="text-xs text-gray-500">{k}</dt><dd className="text-xl font-semibold tabular-nums text-gray-900">{v}</dd></div>
|
||||
))}
|
||||
</dl>
|
||||
{detail.form.status === "sent" && (detail.counts.notAnswered > 0 || detail.counts.waiting > 0) && (
|
||||
<p className="mt-3 text-xs text-gray-500">
|
||||
{plural(detail.counts.notAnswered, "person hasn't", "people haven't")} answered
|
||||
{detail.counts.remindedRecently > 0 && ` (${detail.counts.remindedRecently} sent the form or a reminder in the last 24 hours)`}
|
||||
{detail.counts.waiting > 0 && `; ${plural(detail.counts.waiting, "person", "people")} can still be sent the form (e.g. checked in after it went out)`}.
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="mb-4 flex flex-wrap gap-1 border-b" role="tablist">
|
||||
{([["results", "Results"], ["responses", `Responses (${detail.responses.length})`], ...(detail.people ? [["people", `People (${detail.people.length})`]] : [])] as [Tab, string][]).map(([id, label]) => (
|
||||
<button key={id} role="tab" aria-selected={tab === id} onClick={() => setTab(id)} className={`-mb-px border-b-2 px-3 py-2 text-sm ${tab === id ? "border-brand-600 font-medium text-brand-700" : "border-transparent text-gray-500"}`}>{label}</button>
|
||||
))}
|
||||
</div>
|
||||
|
||||
{tab === "results" && (
|
||||
<div className="space-y-4">
|
||||
<AiFeedbackSummary eventId={detail.event.id} responses={detail.responses.length} />
|
||||
{detail.responses.length === 0 && <p className="text-sm text-gray-500">No answers yet.</p>}
|
||||
{detail.responses.length > 0 && detail.questions.map(q => <QuestionResult key={q.fieldId} q={q} />)}
|
||||
{detail.form.anonymous && <p className="text-xs text-gray-500">This form is anonymous: answers aren't linked to anyone, and who has or hasn't answered isn't shown.</p>}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{tab === "responses" && (
|
||||
<div className="space-y-3">
|
||||
{detail.responses.length === 0 && <p className="text-sm text-gray-500">No answers yet.</p>}
|
||||
{detail.responses.map((r, i) => (
|
||||
<article key={r.id} className="rounded-xl border bg-white p-4 shadow-sm">
|
||||
<div className="mb-2 flex flex-wrap justify-between gap-2 text-sm">
|
||||
<strong className="text-gray-900">{r.name ?? `Response ${detail.responses.length - i}`}</strong>
|
||||
<span className="text-gray-500">{fmt(r.createdAt)}</span>
|
||||
</div>
|
||||
<dl className="space-y-2 text-sm">
|
||||
{detail.fields.map(f => (
|
||||
<div key={f.id}>
|
||||
<dt className="text-xs text-gray-500">{f.label}</dt>
|
||||
<dd className="whitespace-pre-wrap text-gray-800">{r.answers[f.id] == null ? <span className="text-gray-400">—</span> : f.type === "rating" ? `${"★".repeat(Number(r.answers[f.id]))}${"☆".repeat(5 - Number(r.answers[f.id]))}` : f.type === "yes_no" ? (r.answers[f.id] === "yes" ? "Yes" : "No") : r.answers[f.id]}</dd>
|
||||
</div>
|
||||
))}
|
||||
</dl>
|
||||
</article>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{tab === "people" && detail.people && (
|
||||
detail.people.length === 0 ? <p className="text-sm text-gray-500">The form hasn't been sent to anyone yet.</p> : (
|
||||
<div className="overflow-x-auto rounded-xl border bg-white shadow-sm">
|
||||
<table className="w-full text-sm">
|
||||
<thead className="bg-gray-50 text-left text-xs text-gray-500"><tr><th className="p-3">Person</th><th className="p-3">Sent</th><th className="p-3">Answered</th><th className="p-3">Reminders</th><th className="p-3" /></tr></thead>
|
||||
<tbody>
|
||||
{detail.people.map((p: Person) => (
|
||||
<tr key={p.userId} className="border-t">
|
||||
<td className="p-3"><div className="font-medium text-gray-900">{p.name}</div><div className="text-xs text-gray-500">{[p.email, p.phoneNumber].filter(Boolean).join(" · ") || "No contact details"}</div></td>
|
||||
<td className="p-3 text-gray-600">{fmt(p.sentAt)}</td>
|
||||
<td className="p-3">{p.respondedAt ? <span className="text-green-700">{fmt(p.respondedAt)}</span> : <span className="text-amber-700">Not yet</span>}</td>
|
||||
<td className="p-3 text-gray-600">{p.reminderCount ? <>{p.reminderCount} · last {fmt(p.remindedAt)}</> : "None"}</td>
|
||||
<td className="p-3 text-right">
|
||||
{!p.respondedAt && (
|
||||
<button type="button" onClick={() => remind([p.userId])} disabled={!!busy || !p.canRemind}
|
||||
title={p.canRemind ? undefined : "Sent the form or a reminder in the last 24 hours"}
|
||||
className="rounded-lg border px-2.5 py-1 text-xs hover:bg-gray-50 disabled:opacity-50">{busy === p.userId ? "Sending…" : "Remind"}</button>
|
||||
)}
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
)
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -8,7 +8,7 @@ import { useVisiblePolling } from "@/hooks/useVisiblePolling";
|
||||
import {
|
||||
Calendar, Banknote, Gift, Users, Ticket, QrCode, DoorOpen, Wallet,
|
||||
UserPlus, FileText, MessageCircle, BarChart2, Mail, TicketPercent, ShieldCheck, ListChecks, WifiOff, BedDouble, Filter, ClipboardCheck,
|
||||
Baby, HandHeart, Layers,
|
||||
Baby, HandHeart, Layers, MessageSquareHeart,
|
||||
} from "lucide-react";
|
||||
import { StatCard, StatCardRow } from "@/components/shared/StatCard";
|
||||
import { QuickActionTile, QuickActionGrid } from "@/components/shared/QuickActionTile";
|
||||
@@ -35,6 +35,7 @@ const QUICK_ACTIONS = [
|
||||
{ href: "/dashboard/staff/kids", label: "Kids check-in", description: "Check children in and out with pickup codes", icon: Baby },
|
||||
{ href: "/dashboard/supervisor/kids", label: "Kids check-in setup", description: "Switch it on for an event and set up the rooms", icon: Baby },
|
||||
{ href: "/dashboard/supervisor/volunteers", label: "Volunteer rosters", description: "Serving roles, who serves where, check-ins and hours", icon: HandHeart },
|
||||
{ href: "/dashboard/supervisor/feedback", label: "Feedback", description: "What people said after events, and reminders", icon: MessageSquareHeart },
|
||||
{ href: "/dashboard/supervisor/offline-scans", label: "Offline scanning", description: "Devices scanning offline and their synced scans", icon: WifiOff },
|
||||
{ href: "/dashboard/supervisor/attendance", label: "Attendance", description: "Who came to each session, and certificates", icon: ClipboardCheck },
|
||||
{ href: "/dashboard/supervisor/waitlist", label: "Waitlist", description: "People waiting for sold-out tickets", icon: ListChecks },
|
||||
|
||||
Reference in New Issue
Block a user