Calendar: show session time for scheduled local tours
The shared EventsCalendar already renders tours alongside events with live
countdowns on cards/detail pages. This refines the agenda time display: local
tours now carry a specific session time, so the calendar shows that clock time
instead of a blanket "All day". Multi-day national/international/destruction
tours remain date-only ("All day" / date range), and events are unaffected.
- Add allDay flag to CalendarItem (set from tour category)
- Local sessions show their start time; other tours stay all-day
Co-authored-by: shakespeare.diy <assistant@shakespeare.diy>
This commit is contained in:
parent
5d96f8dfa8
commit
7eba7dfe22
1 changed files with 8 additions and 4 deletions
|
|
@ -18,6 +18,8 @@ export interface CalendarItem {
|
|||
to: string;
|
||||
/** RSVP "going" count for events. */
|
||||
goingCount?: number;
|
||||
/** True for date-only items with no meaningful clock time (multi-day tours). */
|
||||
allDay?: boolean;
|
||||
}
|
||||
|
||||
interface EventsCalendarProps {
|
||||
|
|
@ -80,9 +82,9 @@ function eventsToItems(events: SkateEvent[], goingCounts?: Map<string, number>):
|
|||
}
|
||||
|
||||
function toursToItems(tours: SkateTour[]): CalendarItem[] {
|
||||
// Only tours with a concrete date range belong on a calendar (mostly
|
||||
// competition/"destruction" tours). Open-ended local guides have no fixed
|
||||
// date and are better browsed as a list.
|
||||
// Only tours with a concrete date belong on a calendar: scheduled local
|
||||
// sessions plus multi-day national/international/destruction tours. Open-ended
|
||||
// "book anytime" local guides have no fixed date and are browsed as a list.
|
||||
return tours
|
||||
.filter((t) => typeof t.startDate === 'number')
|
||||
.map((t) => ({
|
||||
|
|
@ -93,6 +95,8 @@ function toursToItems(tours: SkateTour[]): CalendarItem[] {
|
|||
end: t.endDate,
|
||||
location: t.location ?? t.cities?.[0] ?? t.countries?.[0],
|
||||
to: `/tour/${t.pubkey}/${t.identifier}`,
|
||||
// Local sessions have a specific clock time; everything else is date-only.
|
||||
allDay: t.category !== 'local',
|
||||
}));
|
||||
}
|
||||
|
||||
|
|
@ -335,7 +339,7 @@ export function EventsCalendar({ events, tours, goingCounts, show }: EventsCalen
|
|||
<Clock className="h-3 w-3" />
|
||||
{multiDay
|
||||
? `${new Date(it.start * 1000).toLocaleDateString([], { month: 'short', day: 'numeric' })} – ${new Date((it.end as number) * 1000).toLocaleDateString([], { month: 'short', day: 'numeric' })}`
|
||||
: it.kind === 'tour'
|
||||
: it.allDay
|
||||
? 'All day'
|
||||
: formatTime(it.start)}
|
||||
</span>
|
||||
|
|
|
|||
Loading…
Reference in a new issue