import type { components } from '@/api/schema' import { I } from '@/components/icons' import { fmtDate, fmtDur } from '@/lib/format' type Transcript = components['schemas']['GetTranscriptWithParticipants'] type Props = { transcript: Transcript speakerCount: number } function sourceLabel(t: Transcript): string { if (t.source_kind === 'room') return t.room_name || 'room' if (t.source_kind === 'live') return 'live' return 'upload' } function toSeconds(value: number | null | undefined) { if (!value) return 0 // Backend persists duration in ms in the `duration` column (see file_pipeline.py). return Math.round(value / 1000) } function Dot() { return · } export function MetadataStrip({ transcript, speakerCount }: Props) { const src = transcript.source_language ?? '' const tgt = transcript.target_language ?? null const shortId = transcript.id.slice(0, 8) const duration = toSeconds(transcript.duration) return (
#{shortId} {sourceLabel(transcript)} {fmtDate(transcript.created_at)} {fmtDur(duration)} {speakerCount > 0 && ( <> {I.Users(11)} {speakerCount} {speakerCount === 1 ? 'speaker' : 'speakers'} )} {src && ( <> {I.Globe(11)} {src} {tgt && tgt !== src && <> → {tgt}} )} {transcript.room_name && ( <> {I.Door(11)} {transcript.room_name} )}
) }