Skip to content

Commit c6b06ab

Browse files
author
marcselman
committed
Show unique participants instead of total registrations in hero section
Update HeroSection component to display the count of unique participants based on email addresses rather than the sum of all attendees across sessions. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 9b278ad5-3a45-420e-ba83-0847baf9924f Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: dce0d821-7558-4b75-a1b9-4e7148a340d4 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/04133160-d2cd-42c9-82f0-4e08d800b951/9b278ad5-3a45-420e-ba83-0847baf9924f/szOT2Og Replit-Helium-Checkpoint-Created: true
1 parent 14c6424 commit c6b06ab

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

client/src/components/HeroSection.tsx

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,15 @@ interface HeroSectionProps {
2727
export function HeroSection({ edition, sessions, userEmail }: HeroSectionProps) {
2828
const backdropImage = useMemo(() => getRandomBackdrop(), []);
2929

30-
const totalRegistrations = sessions.reduce(
31-
(sum, session) => sum + session.attendees.length,
32-
0
33-
);
30+
const uniqueParticipants = useMemo(() => {
31+
const emails = new Set<string>();
32+
sessions.forEach(session => {
33+
session.attendees.forEach(attendee => {
34+
emails.add(attendee.email.toLowerCase());
35+
});
36+
});
37+
return emails.size;
38+
}, [sessions]);
3439

3540
const userRegistrations = userEmail
3641
? sessions.filter((s) => isEmailInAttendees(userEmail, s.attendees)).length
@@ -99,10 +104,10 @@ export function HeroSection({ edition, sessions, userEmail }: HeroSectionProps)
99104
</div>
100105
<div className="flex items-center gap-2">
101106
<Users className="h-4 w-4" />
102-
<span className="text-2xl font-bold text-white" data-testid="text-registration-count">
103-
{totalRegistrations}
107+
<span className="text-2xl font-bold text-white" data-testid="text-participant-count">
108+
{uniqueParticipants}
104109
</span>
105-
<span>inschrijvingen</span>
110+
<span>deelnemer{uniqueParticipants !== 1 ? "s" : ""}</span>
106111
</div>
107112
{userEmail && userRegistrations > 0 && (
108113
<div className="rounded-full bg-white/20 px-3 py-1">

0 commit comments

Comments
 (0)