From 05e3b67fcecea7a335fe0d1537e2816b17eb555b Mon Sep 17 00:00:00 2001 From: Dave Earley Date: Wed, 3 Jun 2026 20:23:42 +0100 Subject: [PATCH] Feature: Occurrence fixes --- .../src/components/common/EventCard/index.tsx | 20 ++++++++++--- .../common/EventDateRange/index.tsx | 12 ++++---- .../layouts/EventHomepage/index.tsx | 30 +++++-------------- 3 files changed, 30 insertions(+), 32 deletions(-) diff --git a/frontend/src/components/common/EventCard/index.tsx b/frontend/src/components/common/EventCard/index.tsx index f62fc96084..a236ecf675 100644 --- a/frontend/src/components/common/EventCard/index.tsx +++ b/frontend/src/components/common/EventCard/index.tsx @@ -344,13 +344,25 @@ export function EventCard({event, compact = false}: EventCardProps) { )}
- e.stopPropagation()} + onClick={(e) => { + e.preventDefault(); + e.stopPropagation(); + navigate(`/manage/organizer/${event?.organizer?.id}`); + }} + onKeyDown={(e) => { + if (e.key === 'Enter' || e.key === ' ') { + e.preventDefault(); + e.stopPropagation(); + navigate(`/manage/organizer/${event?.organizer?.id}`); + } + }} > {event?.organizer?.name} - + {ticketAvailability && ( {ticketAvailability.text} diff --git a/frontend/src/components/common/EventDateRange/index.tsx b/frontend/src/components/common/EventDateRange/index.tsx index e157928d0b..42849e357a 100644 --- a/frontend/src/components/common/EventDateRange/index.tsx +++ b/frontend/src/components/common/EventDateRange/index.tsx @@ -42,19 +42,19 @@ export const EventDateRange = ({event, occurrence}: EventDateRangeProps) => { } if (event.type === EventType.RECURRING) { - const activeOccurrences = (event.occurrences || []) - .filter(o => o.status === EventOccurrenceStatus.ACTIVE && !o.is_past) + const upcomingOccurrences = (event.occurrences || []) + .filter(o => o.status !== EventOccurrenceStatus.CANCELLED && !o.is_past) .sort((a, b) => a.start_date.localeCompare(b.start_date)); - if (activeOccurrences.length > 0) { - const next = activeOccurrences[0]; - if (activeOccurrences.length === 1) { + if (upcomingOccurrences.length > 0) { + const next = upcomingOccurrences[0]; + if (upcomingOccurrences.length === 1) { return formatRange(next.start_date, next.end_date, event.timezone); } const nextFormatted = formatDateWithLocale(next.start_date, "shortDateTime", event.timezone); return ( - {t`Next: ${nextFormatted}`} · {t`${activeOccurrences.length} upcoming dates`} + {t`Next: ${nextFormatted}`} · {t`${upcomingOccurrences.length} upcoming dates`} ); } diff --git a/frontend/src/components/layouts/EventHomepage/index.tsx b/frontend/src/components/layouts/EventHomepage/index.tsx index bf939dbee1..58693dc2ae 100644 --- a/frontend/src/components/layouts/EventHomepage/index.tsx +++ b/frontend/src/components/layouts/EventHomepage/index.tsx @@ -4,7 +4,7 @@ import "../../../styles/widget/default.scss"; import React, {useEffect, useRef, useState} from "react"; import {EventDocumentHead} from "../../common/EventDocumentHead"; import {eventCoverImage, eventHomepageUrl, imageUrl, organizerHomepageUrl} from "../../../utilites/urlHelper.ts"; -import {Event, EventOccurrence, EventOccurrenceStatus, EventType, LocationType, OrganizerStatus} from "../../../types.ts"; +import {Event, EventOccurrence, EventType, LocationType, OrganizerStatus} from "../../../types.ts"; import {EventNotAvailable} from "./EventNotAvailable"; import { IconArrowUpRight, @@ -392,29 +392,15 @@ const EventHomepage = ({...loaderData}: EventHomepageProps) => {
{/* Event Ended */} - {event.type === EventType.RECURRING ? ( - (event.occurrences || []).filter(o => o.status === EventOccurrenceStatus.ACTIVE && !o.is_past).length === 0 && - (event.occurrences || []).length > 0 && ( -
-
- -
-
-
{t`No upcoming dates`}
-
+ {event.type !== EventType.RECURRING && event.end_date && isDateInPast(event.end_date) && ( +
+
+
- ) - ) : ( - event.end_date && isDateInPast(event.end_date) && ( -
-
- -
-
-
{t`This event has ended`}
-
+
+
{t`This event has ended`}
- ) +
)} {/* Online Event */}