diff --git a/packages/studio/src/components/sidebar/BlocksTab.tsx b/packages/studio/src/components/sidebar/BlocksTab.tsx index 14cce1eff..f4474b3e7 100644 --- a/packages/studio/src/components/sidebar/BlocksTab.tsx +++ b/packages/studio/src/components/sidebar/BlocksTab.tsx @@ -5,8 +5,6 @@ import { getCategoryColors, type BlockCategory, } from "../../utils/blockCategories"; -import { TIMELINE_BLOCK_MIME } from "../../utils/timelineAssetDrop"; - export interface BlockPreviewInfo { videoUrl?: string; posterUrl?: string; @@ -14,12 +12,11 @@ export interface BlockPreviewInfo { } interface BlocksTabProps { - onAddBlock: (blockName: string) => void; onPreviewBlock?: (preview: BlockPreviewInfo | null) => void; } // fallow-ignore-next-line complexity -export const BlocksTab = memo(function BlocksTab({ onAddBlock, onPreviewBlock }: BlocksTabProps) { +export const BlocksTab = memo(function BlocksTab({ onPreviewBlock }: BlocksTabProps) { const { loading, error, search, setSearch, category, setCategory, filteredBlocks } = useBlockCatalog(); @@ -104,10 +101,6 @@ export const BlocksTab = memo(function BlocksTab({ onAddBlock, onPreviewBlock }: > {filteredBlocks.map((block) => { const dur = "duration" in block ? (block.duration as number) : undefined; - const dims = - "dimensions" in block - ? (block.dimensions as { width: number; height: number }) - : undefined; return ( onAddBlock(block.name)} onPreview={onPreviewBlock} /> ); @@ -172,30 +163,52 @@ function buildAgentPrompt( const isComponent = blockType === "hyperframes:component"; const kind = isComponent ? "component" : "block"; - const categoryHints: Record = { - captions: - "This is a caption style. Add it to the composition, then customize the transcript text, fonts, colors, and timing to match the voiceover or audio.", - vfx: "This is a VFX effect. Add it as an overlay and adjust shader parameters, colors, and intensity to match the scene.", - transitions: - "This is a transition. Place it between two scenes on the timeline and adjust the duration and direction.", - effects: - "This is a visual effect overlay. Layer it on top of existing content and tweak colors, opacity, and animation timing.", - social: - "This is a social media template. Customize the text, handle, avatar, and metrics to match the content.", - data: "This is a data visualization. Update the data values, labels, colors, and animation stagger to tell the right story.", - scenes: - "This is a full scene. Customize the text, images, layout, and animation timing to fit the narrative.", + const categoryPrompts: Record = { + captions: [ + `Using /hyperframes, add the "${title}" caption style (registry: ${name}) to my composition.`, + `${description}`, + `Transcribe the audio with /hyperframes-media, then wire the transcript into this caption component. Match the font colors and animation timing to my composition's design tokens. Place it as an overlay above the main content with the highest z-index.`, + ].join("\n\n"), + vfx: [ + `Using /hyperframes, add the "${title}" VFX (registry: ${name}) as a full-screen overlay on my composition.`, + `${description}`, + `This is a WebGL effect that requires chrome://flags/#html-in-canvas. Layer it on top of all content, adjust the shader uniforms and color palette to complement my scene, and set the duration to match the composition length.`, + ].join("\n\n"), + transitions: [ + `Using /hyperframes, add the "${title}" transition (registry: ${name}) between my scenes.`, + `${description}`, + `Place this transition at the cut point between the current scene and the next. Set the duration to 0.5–1s, position it at the scene boundary on the timeline, and make sure the z-index is above both scenes. Adjust colors to match my palette.`, + ].join("\n\n"), + effects: [ + `Using /hyperframes, add the "${title}" effect (registry: ${name}) as an overlay on my composition.`, + `${description}`, + `Layer this on top of the current content. Adjust the opacity, colors, and animation timing to enhance the scene without overwhelming the main content.`, + ].join("\n\n"), + social: [ + `Using /hyperframes, add the "${title}" template (registry: ${name}) to my composition.`, + `${description}`, + `Replace the placeholder text, handle, and avatar with my actual content. Match the typography and colors to my brand. Adjust timing so the elements animate in sync with the voiceover.`, + ].join("\n\n"), + data: [ + `Using /hyperframes, add the "${title}" visualization (registry: ${name}) to my composition.`, + `${description}`, + `Replace the placeholder data with my actual values and labels. Adjust the color scale, animation stagger timing, and typography to match my composition's design system. Size it to fit the current viewport.`, + ].join("\n\n"), + scenes: [ + `Using /hyperframes, add the "${title}" scene (registry: ${name}) to my composition.`, + `${description}`, + `Replace all placeholder text, images, and content with my actual material. Match fonts, colors, and layout to my existing design tokens. Set the timeline position and duration to fit the narrative flow.`, + ].join("\n\n"), }; - const hint = categoryHints[category] ?? `Customize this ${kind} to fit the composition.`; - - return [ - `Add the "${title}" ${kind} (registry: ${name}) to my composition using /hyperframes.`, - "", - `${description}`, - "", - hint, - ].join("\n"); + return ( + categoryPrompts[category] ?? + [ + `Using /hyperframes, add the "${title}" ${kind} (registry: ${name}) to my composition.`, + `${description}`, + `Customize it to match my composition's design and timeline.`, + ].join("\n\n") + ); } function BlockCard({ @@ -208,8 +221,6 @@ function BlockCard({ tags, posterUrl, videoUrl, - dimensions, - onAdd, onPreview, }: { name: string; @@ -221,12 +232,9 @@ function BlockCard({ tags?: string[]; posterUrl?: string; videoUrl?: string; - dimensions?: { width: number; height: number }; - onAdd: () => void; onPreview?: (preview: BlockPreviewInfo | null) => void; }) { const [hovered, setHovered] = useState(false); - const [adding, setAdding] = useState(false); const [copied, setCopied] = useState(false); const hoverTimer = useRef | null>(null); const colors = getCategoryColors(category); @@ -254,17 +262,6 @@ function BlockCard({ }; }, []); - const handleAdd = useCallback( - (e: React.MouseEvent) => { - e.stopPropagation(); - if (adding) return; - setAdding(true); - onAdd(); - setTimeout(() => setAdding(false), 1000); - }, - [onAdd, adding], - ); - const handleCopyPrompt = useCallback( (e: React.MouseEvent) => { e.stopPropagation(); @@ -276,21 +273,11 @@ function BlockCard({ [title, name, description, category, blockType], ); - const handleDragStart = useCallback( - (e: React.DragEvent) => { - e.dataTransfer.effectAllowed = "copy"; - e.dataTransfer.setData(TIMELINE_BLOCK_MIME, JSON.stringify({ name, duration, dimensions })); - }, - [name, duration, dimensions], - ); - return (
{/* Thumbnail */}
@@ -321,44 +308,28 @@ function BlockCard({
)} - {/* Action buttons overlay */} -
- - -
+ + + + + {copied ? "Copied!" : "Ask agent"} + + {/* Badges */}
diff --git a/packages/studio/src/components/sidebar/LeftSidebar.tsx b/packages/studio/src/components/sidebar/LeftSidebar.tsx index 0bbb73a8f..634fe6e1f 100644 --- a/packages/studio/src/components/sidebar/LeftSidebar.tsx +++ b/packages/studio/src/components/sidebar/LeftSidebar.tsx @@ -84,7 +84,6 @@ export const LeftSidebar = memo( onLint, linting, onToggleCollapse, - onAddBlock, onPreviewBlock, takeoverContent, }, @@ -246,8 +245,8 @@ export const LeftSidebar = memo(
)} - {STUDIO_BLOCKS_PANEL_ENABLED && tab === "blocks" && onAddBlock && ( - + {STUDIO_BLOCKS_PANEL_ENABLED && tab === "blocks" && ( + )} {/* Lint button pinned at the bottom */}