File size: 1,186 Bytes
e1e42ea
f6a5d94
9221bcd
919f360
9221bcd
e1e42ea
 
f6a5d94
e1e42ea
 
 
 
ba31655
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e1e42ea
 
 
 
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
import { Series } from "remotion";
import { OriginalManuscript } from 'common-utils';
import { PaperDrivePage } from './PaperDrivePage';
import { PaperDriveIndex } from './PaperDriveIndex';
import { PaperDrivePageExtras } from "./types";

export const PaperDriveComposition = (props: OriginalManuscript) => {
  let { meta } = props
  let fps = meta.fps
  return (
    <Series>
      {
        props.transcript
          .filter(transcript => ['index', 'page'].includes(transcript.extras?.template))
          .map(transcript => {
            const extras = transcript.extras as PaperDrivePageExtras
            let page = undefined
            if (extras.template == 'index') {
              page = <PaperDriveIndex transcript={transcript} />
            }
            else if (extras.template == 'page') {
              page = <PaperDrivePage transcript={transcript} />
            }
            if (page == undefined) {
              return undefined
            }
            return (
              <Series.Sequence durationInFrames={transcript.durationInSeconds * fps}>
                {page}
              </Series.Sequence>
            )
          })
      }
    </Series>
  );
};