🎥 Make videos programmatically with React
refactor(tp2mg): integrate TabPanel with responsive layout
ASchwadcf5bb2be1580
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 8dbb77e952..ada67fe5a5 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@@ -8,6 +8,7 @@ import { CodeEditor } from "../../components/CodeEditor";import { AnimationPlayer } from "../../components/AnimationPlayer";import { PageLayout } from "../../components/PageLayout";import { ChatSidebar, type ChatSidebarRef } from "../../components/ChatSidebar";+import { TabPanel } from "../../components/TabPanel";import type { StreamPhase, GenerationErrorType } from "../../types/generation";import { examples } from "../../examples/code";import { useAnimationState } from "../../hooks/useAnimationState";@@ -231,7 +232,7 @@ function GeneratePageContent() {return (<PageLayout showLogoAsLink>- <div className="flex-1 flex min-w-0 overflow-hidden">+ <div className="flex-1 flex flex-col min-[1000px]:flex-row min-w-0 overflow-hidden">{/* Chat History Sidebar */}<ChatSidebarref={chatSidebarRef}@@ -265,15 +266,17 @@ function GeneratePageContent() {/>{/* Main content area */}- <div className="flex-1 flex flex-col min-w-0 px-12 pb-8 gap-8 overflow-hidden">- <div className="flex-1 flex flex-col lg:flex-row overflow-auto lg:overflow-hidden gap-8">- <CodeEditor- code={hasGeneratedOnce && !generationError ? code : ""}- onChange={handleCodeChange}- isStreaming={isStreaming}- streamPhase={streamPhase}- />- <div className="shrink-0 lg:shrink lg:flex-[2.5] lg:min-w-0 lg:h-full">+ <div className="flex-1 flex flex-col min-w-0 pr-12 pb-8 overflow-hidden">+ <TabPanel+ codeContent={+ <CodeEditor+ code={hasGeneratedOnce && !generationError ? code : ""}+ onChange={handleCodeChange}+ isStreaming={isStreaming}+ streamPhase={streamPhase}+ />+ }+ previewContent={<AnimationPlayerComponent={generationError ? null : Component}durationInFrames={durationInFrames}@@ -288,8 +291,8 @@ function GeneratePageContent() {onRuntimeError={handleRuntimeError}onFrameChange={setCurrentFrame}/>- </div>- </div>+ }+ /></div></div></PageLayout>diff --git a/packages/template-prompt-to-motion-graphics/src/components/AnimationPlayer/index.tsx b/packages/template-prompt-to-motion-graphics/src/components/AnimationPlayer/index.tsxindex d4cb87c8fb..746ef34415 100644--- a/packages/template-prompt-to-motion-graphics/src/components/AnimationPlayer/index.tsx+++ b/packages/template-prompt-to-motion-graphics/src/components/AnimationPlayer/index.tsx@@ -151,7 +151,7 @@ export const AnimationPlayer: React.FC<AnimationPlayerProps> = ({clickToPlay={false}/></div>- <div className="flex items-center justify-between gap-6">+ <div className="flex items-center justify-between gap-6 mt-4"><RenderControls code={code} durationInFrames={durationInFrames} fps={fps} /><SettingsModaldurationInFrames={durationInFrames}@@ -166,10 +166,7 @@ export const AnimationPlayer: React.FC<AnimationPlayerProps> = ({return (<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 h-full flex flex-col">{renderContent()}</div></div>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 b87216374b..1392f76004 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@@ -269,10 +269,7 @@ export const CodeEditor: React.FC<CodeEditorProps> = ({};return (- <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="h-full flex flex-col min-w-0"><div className="flex-1 flex flex-col bg-background-editor rounded-lg overflow-hidden"><EditorHeader filename="MyAnimation.tsx" code={code} /><div className="flex-1 overflow-hidden relative">