🎥 Make videos programmatically with React
Fix responsiveness of Generate Page
ASchwad3c6a0fb68e58
diff --git a/packages/template-prompt-to-motion-graphics/src/app/code-examples/page.tsx b/packages/template-prompt-to-motion-graphics/src/app/code-examples/page.tsxindex 9f464427be..3e22ee92b4 100644--- a/packages/template-prompt-to-motion-graphics/src/app/code-examples/page.tsx+++ b/packages/template-prompt-to-motion-graphics/src/app/code-examples/page.tsx@@ -164,24 +164,26 @@ function DemoPageContent() {</div></div>- <div className="flex-1 flex gap-8 overflow-hidden">+ <div className="flex-1 flex flex-col lg:flex-row gap-8 overflow-auto lg:overflow-hidden"><CodeEditorcode={code}onChange={handleCodeChange}isStreaming={false}streamPhase="idle"/>- <AnimationPlayer- Component={Component}- durationInFrames={durationInFrames}- fps={fps}- onDurationChange={setDurationInFrames}- onFpsChange={setFps}- isCompiling={isCompiling}- isStreaming={false}- error={error}- code={code}- />+ <div className="shrink-0 lg:shrink lg:flex-[2.5] lg:min-w-0 lg:h-full">+ <AnimationPlayer+ Component={Component}+ durationInFrames={durationInFrames}+ fps={fps}+ onDurationChange={setDurationInFrames}+ onFpsChange={setFps}+ isCompiling={isCompiling}+ isStreaming={false}+ error={error}+ code={code}+ />+ </div></div></div></div>diff --git a/packages/template-prompt-to-motion-graphics/src/app/generate/page.tsx b/packages/template-prompt-to-motion-graphics/src/app/generate/page.tsxindex 96b0405af8..af64ca69dc 100644--- a/packages/template-prompt-to-motion-graphics/src/app/generate/page.tsx+++ b/packages/template-prompt-to-motion-graphics/src/app/generate/page.tsx@@ -119,25 +119,27 @@ function GeneratePageContent() {return (<PageLayout showLogoAsLink><div className="flex-1 flex flex-col min-w-0 px-12 pb-8 gap-8 overflow-hidden">- <div className="flex-1 flex overflow-hidden gap-8">+ <div className="flex-1 flex flex-col lg:flex-row overflow-auto lg:overflow-hidden gap-8"><CodeEditorcode={hasGeneratedOnce ? code : ""}onChange={handleCodeChange}isStreaming={isStreaming}streamPhase={streamPhase}/>- <AnimationPlayer- Component={Component}- durationInFrames={durationInFrames}- fps={fps}- onDurationChange={setDurationInFrames}- onFpsChange={setFps}- isCompiling={isCompiling}- isStreaming={isStreaming}- error={apiError || error}- errorType={apiError ? "api" : "compilation"}- code={code}- />+ <div className="shrink-0 lg:shrink lg:flex-[2.5] lg:min-w-0 lg:h-full">+ <AnimationPlayer+ Component={Component}+ durationInFrames={durationInFrames}+ fps={fps}+ onDurationChange={setDurationInFrames}+ onFpsChange={setFps}+ isCompiling={isCompiling}+ isStreaming={isStreaming}+ error={apiError || error}+ errorType={apiError ? "api" : "compilation"}+ code={code}+ />+ </div></div><PromptInputdiff --git a/packages/template-prompt-to-motion-graphics/src/components/AnimationPlayer.tsx b/packages/template-prompt-to-motion-graphics/src/components/AnimationPlayer.tsxindex 8e8b5033a9..d39f99d186 100644--- a/packages/template-prompt-to-motion-graphics/src/components/AnimationPlayer.tsx+++ b/packages/template-prompt-to-motion-graphics/src/components/AnimationPlayer.tsx@@ -47,12 +47,12 @@ export const AnimationPlayer: React.FC<AnimationPlayerProps> = ({}) => {if (isStreaming) {return (- <div className="flex flex-3 flex-col items-center bg-background min-w-0">- <div className="w-full max-w-[1200px]">- <h2 className="text-sm font-medium text-muted-foreground mb-3">+ <div className="flex flex-col bg-background min-w-0 h-full">+ <div className="w-full h-full flex flex-col gap-3">+ <h2 className="text-sm font-medium text-muted-foreground shrink-0">Video Preview</h2>- <div className="w-full aspect-video flex flex-col justify-center items-center gap-4 bg-background-elevated rounded-lg overflow-hidden shadow-[0_0_60px_rgba(0,0,0,0.5)]">+ <div className="w-full aspect-video max-h-[calc(100%-80px)] flex flex-col justify-center items-center gap-4 bg-background-elevated rounded-lg overflow-hidden shadow-[0_0_60px_rgba(0,0,0,0.5)]"><div className="w-12 h-12 border-4 border-border border-t-primary rounded-full animate-spin" /><p className="text-muted-foreground text-sm">Waiting for code generation to finish...@@ -65,12 +65,12 @@ export const AnimationPlayer: React.FC<AnimationPlayerProps> = ({if (isCompiling) {return (- <div className="flex flex-3 flex-col items-center bg-background min-w-0">- <div className="w-full max-w-[1200px]">- <h2 className="text-sm font-medium text-muted-foreground mb-3">+ <div className="flex flex-col bg-background min-w-0 h-full">+ <div className="w-full h-full flex flex-col gap-3">+ <h2 className="text-sm font-medium text-muted-foreground shrink-0">Video Preview</h2>- <div className="w-full aspect-video flex justify-center items-center bg-background-elevated rounded-lg overflow-hidden shadow-[0_0_60px_rgba(0,0,0,0.5)]">+ <div className="w-full aspect-video max-h-[calc(100%-80px)] flex justify-center items-center bg-background-elevated rounded-lg overflow-hidden shadow-[0_0_60px_rgba(0,0,0,0.5)]"><div className="w-12 h-12 border-4 border-border border-t-primary rounded-full animate-spin" /></div></div>@@ -81,12 +81,12 @@ export const AnimationPlayer: React.FC<AnimationPlayerProps> = ({if (error) {const errorTitle = errorType === "api" ? "API Error" : "Compilation Error";return (- <div className="flex flex-3 flex-col items-center bg-background min-w-0">- <div className="w-full max-w-[1200px]">- <h2 className="text-sm font-medium text-muted-foreground mb-3">+ <div className="flex flex-col bg-background min-w-0 h-full">+ <div className="w-full h-full flex flex-col gap-3">+ <h2 className="text-sm font-medium text-muted-foreground shrink-0">Video Preview</h2>- <div className="w-full aspect-video flex justify-center items-center bg-background-error rounded-lg overflow-hidden shadow-[0_0_60px_rgba(0,0,0,0.5)] border border-destructive">+ <div className="w-full aspect-video max-h-[calc(100%-80px)] flex justify-center items-center bg-background-error rounded-lg overflow-hidden shadow-[0_0_60px_rgba(0,0,0,0.5)] border border-destructive"><div className="text-center max-w-[80%]"><div className="text-destructive text-base font-semibold mb-2 font-sans">{errorTitle}@@ -103,12 +103,12 @@ export const AnimationPlayer: React.FC<AnimationPlayerProps> = ({if (!Component) {return (- <div className="flex flex-3 flex-col items-center bg-background min-w-0">- <div className="w-full max-w-[1200px]">- <h2 className="text-sm font-medium text-muted-foreground mb-3">+ <div className="flex flex-col bg-background min-w-0 h-full">+ <div className="w-full h-full flex flex-col gap-3">+ <h2 className="text-sm font-medium text-muted-foreground shrink-0">Video Preview</h2>- <div className="w-full aspect-video flex justify-center items-center bg-background-elevated rounded-lg overflow-hidden shadow-[0_0_60px_rgba(0,0,0,0.5)] text-muted-foreground-dim text-lg font-sans">+ <div className="w-full aspect-video max-h-[calc(100%-80px)] flex justify-center items-center bg-background-elevated rounded-lg overflow-hidden shadow-[0_0_60px_rgba(0,0,0,0.5)] text-muted-foreground-dim text-lg font-sans">Select an example to get started</div></div>@@ -117,12 +117,12 @@ export const AnimationPlayer: React.FC<AnimationPlayerProps> = ({}return (- <div className="flex flex-3 flex-col items-center bg-background min-w-0">- <div className="w-full max-w-[1200px] flex flex-col gap-3">- <h2 className="text-sm font-medium text-muted-foreground">+ <div className="flex flex-col bg-background min-w-0 h-full">+ <div className="w-full flex flex-col gap-3 h-full">+ <h2 className="text-sm font-medium text-muted-foreground shrink-0">Video Preview</h2>- <div className="w-full aspect-video rounded-lg overflow-hidden shadow-[0_0_60px_rgba(0,0,0,0.5)]">+ <div className="w-full aspect-video max-h-[calc(100%-80px)] rounded-lg overflow-hidden shadow-[0_0_60px_rgba(0,0,0,0.5)]"><Playerkey={Component.toString()}component={Component}diff --git a/packages/template-prompt-to-motion-graphics/src/components/CodeEditor/CodeEditor.tsx b/packages/template-prompt-to-motion-graphics/src/components/CodeEditor/CodeEditor.tsxindex 6f87257110..083bf5361c 100644--- a/packages/template-prompt-to-motion-graphics/src/components/CodeEditor/CodeEditor.tsx+++ b/packages/template-prompt-to-motion-graphics/src/components/CodeEditor/CodeEditor.tsx@@ -270,7 +270,7 @@ export const CodeEditor: React.FC<CodeEditorProps> = ({};return (- <div className="flex-2 h-full flex flex-col">+ <div className="flex-2 h-[500px] lg:h-full flex flex-col min-w-0"><h2 className="text-sm font-medium text-muted-foreground mb-3">Remotion Code</h2><div className="flex-1 flex flex-col bg-background-editor rounded-lg overflow-hidden"><EditorHeader filename="MyAnimation.tsx" code={code} />