import type { Meeting, Session, RaceHub } from '../types' import { formatDate } from '../utils' interface Props { meeting?: Meeting session?: Session source: RaceHub['source'] } function SourceBadge({ source }: { source: RaceHub['source'] }) { if (source === 'local') return Local if (source === 'partial') return Partial return No data } export function RaceHubHeader({ meeting, session, source }: Props) { const meetingName = meeting?.meeting_name ?? 'Unknown Meeting' const sessionName = session?.session_name ?? 'Unknown Session' const dateStr = formatDate(session?.date_start ?? meeting?.date_start) const location = meeting ? `${meeting.location} · ${meeting.country_name}` : null return (
{meetingName}
{sessionName}
{dateStr && {dateStr}} {location && ·} {location && {location}}
) }