-
-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathSceneRouter.tsx
More file actions
89 lines (79 loc) · 2.37 KB
/
SceneRouter.tsx
File metadata and controls
89 lines (79 loc) · 2.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
import React from "react";
import type { SceneData } from "../types";
import { Scene } from "./Scene";
// Scene component imports (uncomment as components are built):
import { CodeMorphScene } from "./CodeMorphScene";
import { DynamicListScene } from "./DynamicListScene";
import { ComparisonGridScene } from "./ComparisonGridScene";
import { IsometricMockupScene } from "./IsometricMockupScene";
import { InfographicScene } from "./InfographicScene";
interface SceneRouterProps {
scene: SceneData;
sceneIndex: number;
durationInFrames: number;
isVertical?: boolean;
}
/**
* Routes a scene to the appropriate component based on its sceneType.
* Falls back to the generic Scene component for unimplemented types.
*/
export const SceneRouter: React.FC<SceneRouterProps> = ({
scene,
sceneIndex,
durationInFrames,
isVertical = false,
}) => {
const baseProps = {
narration: scene.narration,
sceneIndex,
durationInFrames,
isVertical,
wordTimestamps: scene.wordTimestamps,
};
switch (scene.sceneType) {
case "code":
if (scene.code) {
return <CodeMorphScene {...baseProps} code={scene.code} />;
}
break;
case "list":
if (scene.list) {
return <DynamicListScene {...baseProps} items={scene.list.items} icon={scene.list.icon} />;
}
break;
case "comparison":
if (scene.comparison) {
return <ComparisonGridScene {...baseProps} {...scene.comparison} />;
}
break;
case "mockup":
if (scene.mockup) {
return <IsometricMockupScene {...baseProps} {...scene.mockup} />;
}
break;
case "infographic":
if (scene.infographicUrl) {
return <InfographicScene {...baseProps} infographicUrl={scene.infographicUrl} />;
}
break;
case "narration":
default:
break;
}
// If scene has an infographic URL but no specific sceneType, prefer InfographicScene
// This makes infographics the primary visual when available
if (scene.infographicUrl) {
return <InfographicScene {...baseProps} infographicUrl={scene.infographicUrl} />;
}
// Fallback: use the existing Scene component
return (
<Scene
narration={scene.narration}
bRollUrl={scene.bRollUrl}
visualDescription={scene.visualDescription}
sceneIndex={sceneIndex}
durationInFrames={durationInFrames}
isVertical={isVertical}
/>
);
};