import { Link } from 'react-router-dom' import { PlayIcon } from '@heroicons/react/24/outline' import { formatTimestamp, meetingMomentPath } from '../lib/timestamp' /** * Who said it, when, and a link to that moment in the recording (CORE-2.1, #240). * * Only real values are shown: a missing speaker reads "Speaker not identified" and a missing time "time not * recorded" (the link then opens the meeting at the start). Nothing is guessed. */ export interface CitationLinkProps { meetingId: string startSeconds: number | null speakerName?: string | null speakerRole?: string | null /** ISO date of the meeting (YYYY-MM-DD). */ meetingDate?: string | null } function displayDate(iso: string): string { const d = new Date(`${iso.slice(0, 10)}T12:00:00`) return Number.isNaN(d.getTime()) ? iso : d.toLocaleDateString('en-US', { year: 'numeric', month: 'short', day: 'numeric' }) } export default function CitationLink({ meetingId, startSeconds, speakerName, speakerRole, meetingDate, }: CitationLinkProps) { const who = speakerName ? (speakerRole ? `${speakerName}, ${speakerRole}` : speakerName) : 'Speaker not identified' const hasTime = startSeconds != null && startSeconds >= 0 return ( Said by {who} {meetingDate && ( <> {displayDate(meetingDate)} )} ) }