import type { ReactNode } from "react"; import { getTimelineTrackStyle, type TimelineTrackStyle } from "./timelineTheme"; export interface TrackVisualStyle extends TimelineTrackStyle { icon: ReactNode; } const ICON_BASE = "/icons/timeline"; function TimelineIcon({ src }: { src: string }) { return ( ); } const IconCaptions = ; const IconImage = ; const IconMusic = ; const IconText = ; const IconComposition = ; const IconAudio = ; const ICONS: Record = { video: IconImage, audio: IconMusic, img: IconImage, div: IconComposition, span: IconCaptions, p: IconText, h1: IconText, section: IconComposition, sfx: IconAudio, }; export function getTrackStyle(tag: string): TrackVisualStyle { // Defensive: callers may pass an empty/undefined tag; fall back to "div" // (restores the #1679 null-guard that a restack had dropped). const safeTag = tag || "div"; const trackStyle = getTimelineTrackStyle(safeTag); const normalized = safeTag.toLowerCase(); const icon = normalized.startsWith("h") && normalized.length === 2 && "123456".includes(normalized[1] ?? "") ? ICONS.h1 : (ICONS[normalized] ?? IconComposition); return { ...trackStyle, icon }; }