Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions packages/studio/src/player/components/timelineIcons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@ const ICONS: Record<string, ReactNode> = {
};

export function getTrackStyle(tag: string): TrackVisualStyle {
const trackStyle = getTimelineTrackStyle(tag);
const normalized = tag.toLowerCase();
if (!tag) console.warn("[Timeline] getTrackStyle received empty tag, defaulting to div");
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
Expand Down
8 changes: 6 additions & 2 deletions packages/studio/src/player/lib/timelineDOM.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ export {
// TimelineElement factories
// ---------------------------------------------------------------------------

function resolveClipTag(clip: ClipManifestClip): string {
return clip.tagName || clip.kind || "div";
}

export function createTimelineElementFromManifestClip(params: {
clip: ClipManifestClip;
fallbackIndex: number;
Expand All @@ -72,7 +76,7 @@ export function createTimelineElementFromManifestClip(params: {
const label = getTimelineElementDisplayLabel({
id: clip.id,
label: clip.label,
tag: clip.tagName || clip.kind,
tag: resolveClipTag(clip),
});

let domId: string | undefined;
Expand Down Expand Up @@ -103,7 +107,7 @@ export function createTimelineElementFromManifestClip(params: {
id: identity.id,
label,
key: identity.key,
tag: clip.tagName || clip.kind,
tag: resolveClipTag(clip),
start: clip.start,
duration: clip.duration,
track: clip.track,
Expand Down
Loading