import { Tooltip } from "./ui"; import { PropertyPanel } from "./editor/PropertyPanel"; import { MotionPanel } from "./editor/MotionPanel"; import { LayersPanel } from "./editor/LayersPanel"; import { CaptionPropertyPanel } from "../captions/components/CaptionPropertyPanel"; import { BlockParamsPanel } from "./editor/BlockParamsPanel"; import { RenderQueue } from "./renders/RenderQueue"; import type { RenderJob } from "./renders/useRenderQueue"; import type { StudioGsapMotion } from "./editor/studioMotion"; import type { BlockParam } from "@hyperframes/core/registry"; import { STUDIO_INSPECTOR_PANELS_ENABLED, STUDIO_MOTION_PANEL_ENABLED, } from "./editor/manualEditingAvailability"; /** Motion data without targeting metadata. */ type StudioMotionData = Omit; import { useStudioContext } from "../contexts/StudioContext"; import { usePanelLayoutContext } from "../contexts/PanelLayoutContext"; import { useFileManagerContext } from "../contexts/FileManagerContext"; import { useDomEditContext } from "../contexts/DomEditContext"; export interface StudioRightPanelProps { selectedStudioMotion: StudioMotionData | null; designPanelActive: boolean; motionPanelActive: boolean; activeBlockParams?: { blockName: string; blockTitle: string; params: BlockParam[]; compositionPath: string; } | null; onCloseBlockParams?: () => void; } export function StudioRightPanel({ selectedStudioMotion, designPanelActive, motionPanelActive, activeBlockParams, onCloseBlockParams, }: StudioRightPanelProps) { const { rightWidth, rightPanelTab, setRightPanelTab, handlePanelResizeStart, handlePanelResizeMove, handlePanelResizeEnd, } = usePanelLayoutContext(); const { captionEditMode, previewIframeRef, projectId, activeCompPath, compositionDimensions, waitForPendingDomEditSaves, renderQueue, } = useStudioContext(); const { domEditSelection, domEditGroupSelections, copiedAgentPrompt, clearDomSelection, handleDomStyleCommit, handleDomAttributeCommit, handleDomHtmlAttributeCommit, handleDomPathOffsetCommit, handleDomBoxSizeCommit, handleDomRotationCommit, handleDomTextCommit, handleDomTextFieldStyleCommit, handleDomAddTextField, handleDomRemoveTextField, handleAskAgent, handleDomMotionCommit, handleDomMotionClear, } = useDomEditContext(); const { assets, fontAssets, projectDir, handleImportFiles, handleImportFonts } = useFileManagerContext(); const renderJobs = renderQueue.jobs as RenderJob[]; return ( <>
handlePanelResizeStart("right", e)} onPointerMove={handlePanelResizeMove} onPointerUp={handlePanelResizeEnd} >
{captionEditMode ? ( ) : ( <>
{STUDIO_INSPECTOR_PANELS_ENABLED && ( <> {STUDIO_MOTION_PANEL_ENABLED && ( )} )}
{rightPanelTab === "block-params" && activeBlockParams ? ( {})} /> ) : rightPanelTab === "layers" ? ( ) : designPanelActive ? ( 1 ? null : domEditSelection} multiSelectCount={domEditGroupSelections.length} copiedAgentPrompt={copiedAgentPrompt} onClearSelection={clearDomSelection} onSetStyle={handleDomStyleCommit} onSetAttribute={handleDomAttributeCommit} onSetHtmlAttribute={handleDomHtmlAttributeCommit} onSetManualOffset={handleDomPathOffsetCommit} onSetManualSize={handleDomBoxSizeCommit} onSetManualRotation={handleDomRotationCommit} onSetText={handleDomTextCommit} onSetTextFieldStyle={handleDomTextFieldStyleCommit} onAddTextField={handleDomAddTextField} onRemoveTextField={handleDomRemoveTextField} onAskAgent={handleAskAgent} onImportAssets={handleImportFiles} fontAssets={fontAssets} onImportFonts={handleImportFonts} /> ) : motionPanelActive ? ( 1 ? null : domEditSelection} motion={selectedStudioMotion} onClearSelection={clearDomSelection} onSetMotion={handleDomMotionCommit} onClearMotion={handleDomMotionClear} /> ) : ( { await waitForPendingDomEditSaves(); const composition = activeCompPath && activeCompPath !== "index.html" ? activeCompPath : undefined; await renderQueue.startRender({ fps, quality, format, resolution, composition, }); }} compositionDimensions={compositionDimensions} isRendering={renderQueue.isRendering} /> )}
)}
); }