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;
|
to: string;
|
||||||
/** RSVP "going" count for events. */
|
/** RSVP "going" count for events. */
|
||||||
goingCount?: number;
|
goingCount?: number;
|
||||||
|
/** True for date-only items with no meaningful clock time (multi-day tours). */
|
||||||
|
allDay?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface EventsCalendarProps {
|
interface EventsCalendarProps {
|
||||||
|
|
@ -80,9 +82,9 @@ function eventsToItems(events: SkateEvent[], goingCounts?: Map<string, number>):
|
||||||
}
|
}
|
||||||
|
|
||||||
function toursToItems(tours: SkateTour[]): CalendarItem[] {
|
function toursToItems(tours: SkateTour[]): CalendarItem[] {
|
||||||
// Only tours with a concrete date range belong on a calendar (mostly
|
// Only tours with a concrete date belong on a calendar: scheduled local
|
||||||
// competition/"destruction" tours). Open-ended local guides have no fixed
|
// sessions plus multi-day national/international/destruction tours. Open-ended
|
||||||
// date and are better browsed as a list.
|
// "book anytime" local guides have no fixed date and are browsed as a list.
|
||||||
return tours
|
return tours
|
||||||
.filter((t) => typeof t.startDate === 'number')
|
.filter((t) => typeof t.startDate === 'number')
|
||||||
.map((t) => ({
|
.map((t) => ({
|
||||||
|
|
@ -93,6 +95,8 @@ function toursToItems(tours: SkateTour[]): CalendarItem[] {
|
||||||
end: t.endDate,
|
end: t.endDate,
|
||||||
location: t.location ?? t.cities?.[0] ?? t.countries?.[0],
|
location: t.location ?? t.cities?.[0] ?? t.countries?.[0],
|
||||||
to: `/tour/${t.pubkey}/${t.identifier}`,
|
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" />
|
<Clock className="h-3 w-3" />
|
||||||
{multiDay
|
{multiDay
|
||||||
? `${new Date(it.start * 1000).toLocaleDateString([], { month: 'short', day: 'numeric' })} – ${new Date((it.end as number) * 1000).toLocaleDateString([], { month: 'short', day: 'numeric' })}`
|
? `${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'
|
? 'All day'
|
||||||
: formatTime(it.start)}
|
: formatTime(it.start)}
|
||||||
</span>
|
</span>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue