feat: enhance accessibility and testing with data-test attributes and improve error handling
Some checks failed
Workflow / ⚫️ Test (push) Has been cancelled
Workflow / ʦ TypeScript (push) Has been cancelled

This commit is contained in:
T. Zehetbauer
2026-04-01 10:46:44 +02:00
parent 3bcc5c70a3
commit abac22feb1
55 changed files with 1622 additions and 128 deletions

View File

@@ -47,19 +47,21 @@ export default async function EventsPage({ params, searchParams }: PageProps) {
const events = await api.listEvents(acct.id, { page });
// Fetch registration counts for all events on this page
const eventIds = events.data.map((e: Record<string, unknown>) =>
String(e.id),
const eventIds = events.data.map((eventItem: Record<string, unknown>) =>
String(eventItem.id),
);
const registrationCounts = await api.getRegistrationCounts(eventIds);
// Pre-compute stats before rendering
const uniqueLocationCount = new Set(
events.data.map((e: Record<string, unknown>) => e.location).filter(Boolean),
events.data
.map((eventItem: Record<string, unknown>) => eventItem.location)
.filter(Boolean),
).size;
const totalCapacity = events.data.reduce(
(sum: number, e: Record<string, unknown>) =>
sum + (Number(e.capacity) || 0),
(sum: number, eventItem: Record<string, unknown>) =>
sum + (Number(eventItem.capacity) || 0),
0,
);
@@ -74,7 +76,7 @@ export default async function EventsPage({ params, searchParams }: PageProps) {
</div>
<Link href={`/home/${account}/events/new`}>
<Button>
<Button data-test="events-new-btn">
<Plus className="mr-2 h-4 w-4" />
{t('newEvent')}
</Button>