feat(studio): add media treatment inspector

This commit is contained in:
ukimsanov
2026-07-24 18:42:37 -07:00
parent b0d3164ddb
commit 39c2341c4d
22 changed files with 2558 additions and 412 deletions
@@ -9,6 +9,7 @@ import { addBlockToProject } from "../utils/blockInstaller";
import type { BlockParam } from "@hyperframes/core/registry";
import type { EditHistoryKind } from "../utils/editHistory";
import type { RightPanelTab } from "../utils/studioHelpers";
import type { MediaOverlayPlacement } from "../components/editor/propertyPanelTypes";
interface BlockCtxDeps {
activeCompPath: string | null;
@@ -46,6 +47,7 @@ export interface UseBlockHandlersResult {
>;
handleAddBlock: (blockName: string) => void;
handleTimelineBlockDrop: (blockName: string, placement: { start: number; track: number }) => void;
handleAddMediaOverlay: (blockName: string, placement: MediaOverlayPlacement) => Promise<void>;
handlePreviewBlockDrop: (blockName: string, position: { left: number; top: number }) => void;
}
@@ -151,6 +153,25 @@ export function useBlockHandlers({
[projectId, blockCtx, previewIframeRef, runBlockInstall],
);
const handleAddMediaOverlay = useCallback(
async (blockName: string, placement: MediaOverlayPlacement) => {
if (!projectId) return;
const { compositionPath, ...timelinePlacement } = placement;
await runBlockInstall(blockName, () =>
addBlockToProject({
projectId,
blockName,
...blockCtx,
activeCompPath: compositionPath ?? blockCtx.activeCompPath,
placement: timelinePlacement,
previewIframe: previewIframeRef.current,
currentTime: usePlayerStore.getState().currentTime,
}),
);
},
[projectId, blockCtx, previewIframeRef, runBlockInstall],
);
const handlePreviewBlockDrop = useCallback(
(blockName: string, position: { left: number; top: number }) => {
if (!projectId) return;
@@ -173,6 +194,7 @@ export function useBlockHandlers({
setActiveBlockParams,
handleAddBlock,
handleTimelineBlockDrop,
handleAddMediaOverlay,
handlePreviewBlockDrop,
};
}