WIP 2.0.0: React Compiler lint rules back to errors; docs
- The 192 places the rules flagged are fixed and the rules are errors again (npx eslint src: nothing). lib/hooks.ts: useStateSync (state that follows other state, set while rendering), useExternalEffect (API loads and browser reads), useNow; lib/navigation.ts hardNavigate for full reloads after sign-out or identity switches; other pages use the router. Resets moved into the handlers that cause them. - The banner shows and hides at its times on open pages. - HANDOVER, roadmap, README, FEATURES, SETTINGS, CHANGELOG updated; 2.0.0 section drafted in WHATS-NEW. e2e 102/102 (PayFast sandbox skipped); production build passes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -22,6 +22,7 @@ import { MyCertificates } from "@/components/events/MyCertificates";
|
||||
import { isPickOption } from "@/lib/sessions";
|
||||
import type { Event, EventOption, Payment, Registration, RegistrationOption, Ticket as TicketRecord } from "@/types";
|
||||
import { ModalOverlay } from "@/components/shared/ModalOverlay";
|
||||
import { useExternalEffect, useNow } from "@/lib/hooks";
|
||||
|
||||
// Helper formatters
|
||||
const formatRand = (n: number) => `R ${n.toFixed(2)}`;
|
||||
@@ -35,12 +36,13 @@ const isEventOver = (ev: EventStatusFields | null | undefined) =>
|
||||
// Status badge for an event, shown wherever an event title is displayed on this page.
|
||||
// Precedence when more than one applies: Closed > Past > Inactive.
|
||||
function EventStatusBadge({ event }: { event: EventStatusFields | null | undefined }) {
|
||||
const now = useNow();
|
||||
if (!event) return null;
|
||||
let label: string | null = null;
|
||||
let className = '';
|
||||
if (event.cashupStatus === 'closed') {
|
||||
label = 'Closed'; className = 'bg-rose-50 text-rose-700';
|
||||
} else if (event.endDate && new Date(event.endDate).getTime() < Date.now()) {
|
||||
} else if (event.endDate && new Date(event.endDate).getTime() < now) {
|
||||
label = 'Past'; className = 'bg-amber-50 text-amber-700';
|
||||
} else if (event.isActive === false) {
|
||||
label = 'Inactive'; className = 'bg-gray-100 text-gray-500';
|
||||
@@ -369,7 +371,7 @@ export default function UserDashboardPage() {
|
||||
const activeBill = activeRegId ? billing[activeRegId] : undefined;
|
||||
|
||||
// When a registration is opened, determine whether its event has attendee forms
|
||||
useEffect(() => {
|
||||
useExternalEffect(() => {
|
||||
setActiveEventHasForm(null);
|
||||
if (!activeRegId) return;
|
||||
const ar = registrations.find(r => r.id === activeRegId);
|
||||
|
||||
Reference in New Issue
Block a user