Skip to content

The open-source full-stack studio for Opus 5.5 motion video. Reverse engineering for any video. Code video with HTML: recreate, edit and render. BYOA + BYOK · Motion.md · Images, Video, Music & Voice.

fix(studio): match loading placeholders to timeline clips

罗高3fffde4ceb5b
diff --git a/studio/src/player/components/TimelinePendingAssetDrops.tsx b/studio/src/player/components/TimelinePendingAssetDrops.tsx
index dfb5c861..c2826f88 100644
--- a/studio/src/player/components/TimelinePendingAssetDrops.tsx
+++ b/studio/src/player/components/TimelinePendingAssetDrops.tsx
@@ -3,6 +3,7 @@ import { RemixIcon, X } from "../../icons/RemixIcons";
import { usePlayerStore } from "../store/playerStore";
import { dismissPendingAssetDrop } from "../store/pendingAssetDrops";
import { CLIP_Y, TRACK_H } from "./timelineLayout";
+import { getTimelineAssetKind } from "../../utils/timelineAssetDrop";
export function TimelinePendingAssetDrops({
contentOrigin, pixelsPerSecond, trackOrder, rowTop,
@@ -23,6 +24,9 @@ export function TimelinePendingAssetDrops({
const row = placement.insertRow ?? (index < 0 ? trackOrder.length : index);
const start = drop.element?.start ?? placement.start;
const name = drop.assetPath.split("/").pop() ?? drop.assetPath;
+ const audio = getTimelineAssetKind(drop.assetPath) === "audio";
+ const width = Math.max(drop.failed ? 140 : 48, (drop.duration ?? 5) * pixelsPerSecond);
+ const compact = !drop.failed && width < 96;
const message = t(drop.failed === "preview" ? "Preview failed to load" : drop.failed ? "Failed to add media" : "Adding…");
return (
<div
@@ -33,20 +37,23 @@ export function TimelinePendingAssetDrops({
aria-busy={!drop.failed}
aria-label={`${name}: ${message}`}
title={`${name}: ${message}`}
- className="absolute flex items-center gap-1.5 overflow-hidden rounded border border-dashed px-2 text-[11px] text-neutral-200"
+ className={`timeline-clip absolute flex items-center gap-1.5 overflow-hidden px-2 text-[11px] ${audio ? "is-audio" : ""} ${compact ? "justify-center" : ""}`}
style={{
top: rowTop(row) + CLIP_Y,
left: contentOrigin + start * pixelsPerSecond,
- width: Math.max(drop.failed ? 140 : 48, (drop.duration ?? 5) * pixelsPerSecond),
+ width,
height: TRACK_H - CLIP_Y * 2,
- background: "var(--timeline-shell-bg)",
- borderColor: drop.failed ? "var(--color-red-400)" : "var(--timeline-accent)",
+ borderRadius: audio ? "var(--timeline-clip-audio-radius)" : "var(--timeline-clip-radius)",
+ background: audio ? "var(--timeline-clip-audio-bg)" : "var(--timeline-clip-bg)",
+ color: audio ? "var(--timeline-clip-chip-text)" : "var(--timeline-text-primary)",
+ borderColor: drop.failed ? "var(--color-red-400)" : audio ? "var(--timeline-clip-audio-border)" : "var(--timeline-clip-border)",
zIndex: 40,
pointerEvents: drop.failed ? "auto" : "none",
}}
>
{!drop.failed && <RemixIcon name="loader-4-line" size={14} className="shrink-0 motion-safe:animate-spin" aria-hidden="true" />}
- <span className="min-w-0 truncate">{message} · {name}</span>
+ {!compact && <span className="min-w-0 truncate">{drop.failed ? `${message} · ${name}` : name}</span>}
+ {!drop.failed && <span aria-hidden="true" className="absolute inset-x-0 bottom-0 h-0.5 bg-current opacity-20 motion-safe:animate-pulse" />}
{drop.failed && <button
type="button"
className="ml-auto shrink-0 rounded p-1 focus-visible:outline focus-visible:outline-2"