Full site redesign, help system, and dashboard stats fixes

Multi-phase visual facelift (design tokens, dashboards, sidebar/navbar
shell, per-page help guides, and a layout/content pass across every
remaining page) plus backend fixes to the dashboard KPI stats:

- Admin/Supervisor dashboard KPIs (revenue, donations, registrations,
  tickets sold) now use a rolling trailing-month window (today back one
  calendar month, e.g. 9 May - 8 June if today is 8 June) instead of
  calendar month-to-date, which under-counted for most of the month.
  The comparison window shifts the same way, so like is still compared
  with like.
- Reports deep-links from those stat tiles now match the same window
  (range=trailing_month, replacing range=this_month).
- Design tokens (brand-* Tailwind scale + shadcn CSS variables), a
  site-wide contextual help button, fixed dashboard sidebar/navbar,
  Admin/Supervisor/Staff/User dashboard rebuilds backed by a new
  GET /api/stats/overview endpoint, a dedicated Contact page, Site
  Settings restyle with WhatsApp config folded in, and an Account
  activity feed backed by a new SecurityEvent model.
- Every remaining page (home, events, registration flow, auth, legal,
  payment results, and every Admin/Supervisor/Staff/User tool page)
  restyled onto the same design tokens, several with real layout
  upgrades (home hero, events list/detail, donate page, auth pages).
- 20+ new dedicated help guides so the whole site has page-specific
  help content instead of falling back to a generic guide.
- Assorted fixes surfaced along the way: donation-leg double-counting
  in payment stats, donations not counting toward revenue, refund
  netting in per-method report breakdowns, and donation
  over-allocation after a refund.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-06 15:00:10 +02:00
co-authored by Claude Sonnet 5
parent d715a45e22
commit 5c2e29ed1b
119 changed files with 5116 additions and 4316 deletions
@@ -0,0 +1,186 @@
import type { HelpContent } from "./types";
import { reportsHelpContent } from "./reports";
import { dashboardUserHelpContent } from "./dashboard-user";
import { dashboardAdminHelpContent } from "./dashboard-admin";
import { dashboardSupervisorHelpContent } from "./dashboard-supervisor";
import { dashboardStaffHelpContent } from "./dashboard-staff";
import { siteSettingsHelpContent } from "./site-settings";
import { authHelpContent } from "./auth";
import { dashboardUserPaymentsHelpContent } from "./dashboard-user-payments";
import { dashboardUserDonateHelpContent } from "./dashboard-user-donate";
import { generalHelpContent } from "./general";
import { homeHelpContent } from "./home";
import { eventsHelpContent } from "./events";
import { eventDetailHelpContent } from "./event-detail";
import { dashboardAdminUsersHelpContent } from "./dashboard-admin-users";
import { dashboardAdminRegistrationsHelpContent } from "./dashboard-admin-registrations";
import { dashboardAdminCashupHelpContent, dashboardAdminCashupDetailHelpContent } from "./dashboard-admin-cashup";
import { supervisorEventsHelpContent } from "./supervisor-events";
import { supervisorEventOptionsHelpContent } from "./supervisor-event-options";
import { supervisorManualHelpContent, supervisorManualRegistrationLegacyHelpContent } from "./supervisor-manual";
import { supervisorAtTheDoorHelpContent } from "./supervisor-at-the-door";
import { supervisorPaymentsHelpContent } from "./supervisor-payments";
import { supervisorFormsHelpContent } from "./supervisor-forms";
import { supervisorEmailAttendeesHelpContent } from "./supervisor-email-attendees";
import { supervisorWhatsappAttendeesHelpContent } from "./supervisor-whatsapp-attendees";
import { staffEventTicketsHelpContent } from "./staff-event-tickets";
import { staffTicketScanningHelpContent } from "./staff-ticket-scanning";
import { userFormsHelpContent } from "./user-forms";
type HelpRegistryEntry = {
/** Unique, stable slug — used as the per-page "don't show again" storage key. */
slug: string;
matches: (pathname: string) => boolean;
content: HelpContent;
};
// Most-specific first; the first match wins. Anything that matches nothing
// falls back to `generalHelpContent` below.
const REGISTRY: HelpRegistryEntry[] = [
{
slug: "reports",
matches: pathname => pathname === "/dashboard/supervisor/reports",
content: reportsHelpContent,
},
{
slug: "dashboard-user",
matches: pathname => pathname === "/dashboard/user",
content: dashboardUserHelpContent,
},
{
slug: "dashboard-admin",
matches: pathname => pathname === "/dashboard/admin",
content: dashboardAdminHelpContent,
},
{
slug: "dashboard-supervisor",
matches: pathname => pathname === "/dashboard/supervisor",
content: dashboardSupervisorHelpContent,
},
{
slug: "dashboard-staff",
matches: pathname => pathname === "/dashboard/staff",
content: dashboardStaffHelpContent,
},
{
slug: "site-settings",
matches: pathname => pathname === "/dashboard/admin/settings",
content: siteSettingsHelpContent,
},
{
slug: "dashboard-user-payments",
matches: pathname => pathname === "/dashboard/user/payments",
content: dashboardUserPaymentsHelpContent,
},
{
slug: "dashboard-user-donate",
matches: pathname => pathname === "/dashboard/user/donate",
content: dashboardUserDonateHelpContent,
},
{
slug: "auth",
matches: pathname => pathname === "/login" || pathname === "/register" || pathname === "/forgot-password",
content: authHelpContent,
},
{
slug: "home",
matches: pathname => pathname === "/",
content: homeHelpContent,
},
{
slug: "events",
matches: pathname => pathname === "/events",
content: eventsHelpContent,
},
{
slug: "event-detail",
matches: pathname => /^\/events\/[^/]+$/.test(pathname),
content: eventDetailHelpContent,
},
{
slug: "dashboard-admin-users",
matches: pathname => pathname === "/dashboard/admin/users",
content: dashboardAdminUsersHelpContent,
},
{
slug: "dashboard-admin-registrations",
matches: pathname => pathname === "/dashboard/admin/registrations",
content: dashboardAdminRegistrationsHelpContent,
},
{
slug: "dashboard-admin-cashup-detail",
matches: pathname => /^\/dashboard\/admin\/cashup\/[^/]+$/.test(pathname),
content: dashboardAdminCashupDetailHelpContent,
},
{
slug: "dashboard-admin-cashup",
matches: pathname => pathname === "/dashboard/admin/cashup",
content: dashboardAdminCashupHelpContent,
},
{
slug: "supervisor-events",
matches: pathname => pathname === "/dashboard/supervisor/events" || pathname === "/dashboard/supervisor/sections",
content: supervisorEventsHelpContent,
},
{
slug: "supervisor-event-options",
matches: pathname => pathname === "/dashboard/supervisor/event-options",
content: supervisorEventOptionsHelpContent,
},
{
slug: "supervisor-manual",
matches: pathname => pathname === "/dashboard/supervisor/manual",
content: supervisorManualHelpContent,
},
{
slug: "supervisor-manual-registration-legacy",
matches: pathname => pathname === "/dashboard/supervisor/manual-registration",
content: supervisorManualRegistrationLegacyHelpContent,
},
{
slug: "supervisor-at-the-door",
matches: pathname => pathname === "/dashboard/supervisor/at-the-door",
content: supervisorAtTheDoorHelpContent,
},
{
slug: "supervisor-payments",
matches: pathname => pathname === "/dashboard/supervisor/payments",
content: supervisorPaymentsHelpContent,
},
{
slug: "supervisor-forms",
matches: pathname => pathname === "/dashboard/supervisor/forms" || pathname === "/dashboard/admin/forms",
content: supervisorFormsHelpContent,
},
{
slug: "supervisor-email-attendees",
matches: pathname => pathname === "/dashboard/supervisor/email-attendees",
content: supervisorEmailAttendeesHelpContent,
},
{
slug: "supervisor-whatsapp-attendees",
matches: pathname => pathname === "/dashboard/supervisor/whatsapp-attendees",
content: supervisorWhatsappAttendeesHelpContent,
},
{
slug: "staff-event-tickets",
matches: pathname => pathname === "/dashboard/staff/event-tickets",
content: staffEventTicketsHelpContent,
},
{
slug: "staff-ticket-scanning",
matches: pathname => pathname === "/dashboard/staff/ticket-scanning",
content: staffTicketScanningHelpContent,
},
{
slug: "user-forms",
matches: pathname => pathname === "/dashboard/user/forms",
content: userFormsHelpContent,
},
];
export function resolveHelpContent(pathname: string): { slug: string; content: HelpContent } {
const match = REGISTRY.find(entry => entry.matches(pathname));
if (match) return { slug: match.slug, content: match.content };
return { slug: "general", content: generalHelpContent };
}