@remotion/promo-pages 5.0.0-canary.3 → 5.0.1-canary
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-make.log +8 -0
- package/bundle.ts +38 -0
- package/dist/Homepage.js +1 -1
- package/dist/homepage/Pricing.js +1 -1
- package/eslint.config.mjs +7 -0
- package/index.html +13 -0
- package/package.json +3 -6
- package/public/fire.mp3 +0 -0
- package/public/img/cluster.png +0 -0
- package/public/img/code-sample-new.png +0 -0
- package/public/img/freelancers/alex.jpeg +0 -0
- package/public/img/freelancers/antoine.jpeg +0 -0
- package/public/img/freelancers/ayush.png +0 -0
- package/public/img/freelancers/benjamin.jpeg +0 -0
- package/public/img/freelancers/default.png +0 -0
- package/public/img/freelancers/florent.jpeg +0 -0
- package/public/img/freelancers/karel.jpeg +0 -0
- package/public/img/freelancers/lorenzo.jpeg +0 -0
- package/public/img/freelancers/mickael.jpeg +0 -0
- package/public/img/freelancers/mohit.jpeg +0 -0
- package/public/img/freelancers/pramod.jpg +0 -0
- package/public/img/freelancers/pranav.jpg +0 -0
- package/public/img/freelancers/rahul.png +0 -0
- package/public/img/freelancers/ray.jpeg +0 -0
- package/public/img/freelancers/stephen.png +0 -0
- package/public/img/freelancers/umungo.png +0 -0
- package/public/img/freelancers/yehor.jpeg +0 -0
- package/public/img/gt-planar-black.woff2 +0 -0
- package/public/img/gt-planar-bold.woff2 +0 -0
- package/public/img/gt-planar-medium.woff2 +0 -0
- package/public/img/gt-planar-regular.woff2 +0 -0
- package/public/img/logo-small.png +0 -0
- package/public/img/mp4.png +0 -0
- package/public/img/player-demo.mp4 +0 -0
- package/public/img/player-example-dark.png +0 -0
- package/public/img/player-example.png +0 -0
- package/public/img/writeinreact.png +0 -0
- package/public/partyhorn.mp3 +0 -0
- package/public/sad.mp3 +0 -0
- package/src/cn.ts +6 -0
- package/src/components/Homepage.tsx +88 -0
- package/src/components/homepage/BackgroundAnimation.tsx +108 -0
- package/src/components/homepage/ChooseTemplate.tsx +57 -0
- package/src/components/homepage/CodeExample.tsx +89 -0
- package/src/components/homepage/CommunityStats.tsx +54 -0
- package/src/components/homepage/CommunityStatsItems.tsx +304 -0
- package/src/components/homepage/Counter.tsx +110 -0
- package/src/components/homepage/Demo/Card.tsx +273 -0
- package/src/components/homepage/Demo/Cards.tsx +129 -0
- package/src/components/homepage/Demo/Comp.tsx +157 -0
- package/src/components/homepage/Demo/CurrentCountry.tsx +97 -0
- package/src/components/homepage/Demo/DemoError.tsx +18 -0
- package/src/components/homepage/Demo/DemoErrorIcon.tsx +32 -0
- package/src/components/homepage/Demo/DemoRender.tsx +166 -0
- package/src/components/homepage/Demo/DigitWheel.tsx +179 -0
- package/src/components/homepage/Demo/DisplayedEmoji.tsx +81 -0
- package/src/components/homepage/Demo/DoneCheckmark.tsx +39 -0
- package/src/components/homepage/Demo/DownloadNudge.tsx +62 -0
- package/src/components/homepage/Demo/DragAndDropNudge.tsx +57 -0
- package/src/components/homepage/Demo/EmojiCard.tsx +198 -0
- package/src/components/homepage/Demo/Minus.tsx +21 -0
- package/src/components/homepage/Demo/PlayPauseButton.tsx +66 -0
- package/src/components/homepage/Demo/PlayerControls.tsx +48 -0
- package/src/components/homepage/Demo/PlayerSeekBar.tsx +325 -0
- package/src/components/homepage/Demo/PlayerVolume.tsx +83 -0
- package/src/components/homepage/Demo/Progress.tsx +38 -0
- package/src/components/homepage/Demo/Spinner.tsx +60 -0
- package/src/components/homepage/Demo/Switcher.tsx +54 -0
- package/src/components/homepage/Demo/Temperature.tsx +44 -0
- package/src/components/homepage/Demo/TemperatureNumber.tsx +68 -0
- package/src/components/homepage/Demo/ThemeNudge.tsx +72 -0
- package/src/components/homepage/Demo/TimeDisplay.tsx +43 -0
- package/src/components/homepage/Demo/TrendingRepos.tsx +106 -0
- package/src/components/homepage/Demo/icons.tsx +114 -0
- package/src/components/homepage/Demo/index.tsx +158 -0
- package/src/components/homepage/Demo/math.ts +43 -0
- package/src/components/homepage/Demo/types.ts +6 -0
- package/src/components/homepage/Editor.tsx +67 -0
- package/src/components/homepage/EvaluateRemotion.tsx +92 -0
- package/src/components/homepage/FreePricing.tsx +295 -0
- package/src/components/homepage/GetStartedStrip.tsx +77 -0
- package/src/components/homepage/GitHubButton.tsx +23 -0
- package/src/components/homepage/IconForTemplate.tsx +154 -0
- package/src/components/homepage/IfYouKnowReact.tsx +29 -0
- package/src/components/homepage/InfoTooltip.tsx +25 -0
- package/src/components/homepage/MoreTemplatesButton.tsx +29 -0
- package/src/components/homepage/MuxVideo.tsx +68 -0
- package/src/components/homepage/NewsletterButton.tsx +88 -0
- package/src/components/homepage/Pricing.tsx +49 -0
- package/src/components/homepage/PricingBulletPoint.tsx +50 -0
- package/src/components/homepage/RealMp4Videos.tsx +50 -0
- package/src/components/homepage/Spacer.tsx +5 -0
- package/src/components/homepage/TemplateIcon.tsx +36 -0
- package/src/components/homepage/TextInput.tsx +62 -0
- package/src/components/homepage/TrustedByBanner.tsx +194 -0
- package/src/components/homepage/VideoApps.tsx +231 -0
- package/src/components/homepage/VideoAppsShowcase.tsx +276 -0
- package/src/components/homepage/VideoAppsTitle.tsx +24 -0
- package/src/components/homepage/VideoPlayerWithControls.tsx +188 -0
- package/src/components/homepage/WriteInReact.tsx +34 -0
- package/src/components/homepage/YouAreHere.tsx +30 -0
- package/src/components/homepage/custom.css +57 -0
- package/src/components/homepage/layout/Button.tsx +93 -0
- package/src/components/homepage/layout/colors.ts +17 -0
- package/src/components/homepage/layout/use-color-mode.tsx +44 -0
- package/src/components/homepage/layout/use-el-size.ts +51 -0
- package/src/components/homepage/layout/use-mobile-layout.ts +8 -0
- package/src/components/homepage/video-player.css +24 -0
- package/src/components/icons/blank.tsx +13 -0
- package/src/components/icons/clone.tsx +10 -0
- package/src/components/icons/code-hike.tsx +15 -0
- package/src/components/icons/cubes.tsx +13 -0
- package/src/components/icons/js.tsx +17 -0
- package/src/components/icons/next.tsx +64 -0
- package/src/components/icons/overlay.tsx +24 -0
- package/src/components/icons/remix.tsx +24 -0
- package/src/components/icons/skia.tsx +13 -0
- package/src/components/icons/stargazer.tsx +13 -0
- package/src/components/icons/still.tsx +13 -0
- package/src/components/icons/tailwind.tsx +22 -0
- package/src/components/icons/tiktok.tsx +13 -0
- package/src/components/icons/ts.tsx +18 -0
- package/src/components/icons/tts.tsx +13 -0
- package/src/components/icons/undo.tsx +11 -0
- package/src/components/icons/waveform.tsx +13 -0
- package/src/fonts.css +30 -0
- package/src/index.css +74 -0
- package/src/main.tsx +12 -0
- package/tsconfig.json +15 -0
- package/vite.config.ts +9 -0
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import type {EmojiName} from '@remotion/animated-emoji';
|
|
2
|
+
import React, {
|
|
3
|
+
createRef,
|
|
4
|
+
useCallback,
|
|
5
|
+
useEffect,
|
|
6
|
+
useRef,
|
|
7
|
+
useState,
|
|
8
|
+
} from 'react';
|
|
9
|
+
import {AbsoluteFill, getRemotionEnvironment} from 'remotion';
|
|
10
|
+
import {Card} from './Card';
|
|
11
|
+
import type {RemoteData} from './Comp';
|
|
12
|
+
import {CurrentCountry} from './CurrentCountry';
|
|
13
|
+
import {EmojiCard, type EmojiCardRef} from './EmojiCard';
|
|
14
|
+
import {getInitialPositions} from './math';
|
|
15
|
+
import {Temperature} from './Temperature';
|
|
16
|
+
import {TrendingRepos} from './TrendingRepos';
|
|
17
|
+
import type {Location} from './types';
|
|
18
|
+
|
|
19
|
+
export const Cards: React.FC<{
|
|
20
|
+
readonly onUpdate: (newIndices: number[]) => void;
|
|
21
|
+
readonly indices: number[];
|
|
22
|
+
readonly theme: 'dark' | 'light';
|
|
23
|
+
readonly location: Location | null;
|
|
24
|
+
readonly trending: RemoteData | null;
|
|
25
|
+
readonly onToggle: () => void;
|
|
26
|
+
readonly onLeft: () => void;
|
|
27
|
+
readonly onRight: () => void;
|
|
28
|
+
readonly emojiName: EmojiName;
|
|
29
|
+
}> = ({
|
|
30
|
+
onUpdate,
|
|
31
|
+
indices,
|
|
32
|
+
theme,
|
|
33
|
+
onToggle,
|
|
34
|
+
onLeft: onLeftPress,
|
|
35
|
+
onRight: onRightPress,
|
|
36
|
+
emojiName,
|
|
37
|
+
location,
|
|
38
|
+
trending,
|
|
39
|
+
}) => {
|
|
40
|
+
const container = useRef<HTMLDivElement>(null);
|
|
41
|
+
|
|
42
|
+
const [refs] = useState(() => {
|
|
43
|
+
return new Array(4).fill(true).map(() => {
|
|
44
|
+
return createRef<HTMLDivElement>();
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
const positions = useRef(getInitialPositions());
|
|
49
|
+
const shouldBePositions = useRef(getInitialPositions());
|
|
50
|
+
const {isRendering} = getRemotionEnvironment();
|
|
51
|
+
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
const {current} = container;
|
|
54
|
+
if (!current) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const onClick = (e: MouseEvent) => {
|
|
59
|
+
if (e.target !== current) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
onToggle();
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
current.addEventListener('click', onClick);
|
|
67
|
+
|
|
68
|
+
return () => {
|
|
69
|
+
current.removeEventListener('click', onClick);
|
|
70
|
+
};
|
|
71
|
+
}, [onToggle]);
|
|
72
|
+
|
|
73
|
+
const ref = useRef<EmojiCardRef>(null);
|
|
74
|
+
|
|
75
|
+
const onLeft = useCallback(() => {
|
|
76
|
+
ref.current?.onRight();
|
|
77
|
+
onRightPress();
|
|
78
|
+
}, [onRightPress]);
|
|
79
|
+
|
|
80
|
+
const onRight = useCallback(() => {
|
|
81
|
+
ref.current?.onLeft();
|
|
82
|
+
onLeftPress();
|
|
83
|
+
}, [onLeftPress]);
|
|
84
|
+
|
|
85
|
+
return (
|
|
86
|
+
<AbsoluteFill ref={container}>
|
|
87
|
+
{new Array(4).fill(true).map((_, i) => {
|
|
88
|
+
const index = indices[i];
|
|
89
|
+
const content =
|
|
90
|
+
index === 0 ? (
|
|
91
|
+
<TrendingRepos trending={trending} theme={theme} />
|
|
92
|
+
) : index === 1 ? (
|
|
93
|
+
<Temperature
|
|
94
|
+
city={location?.city ?? null}
|
|
95
|
+
theme={theme}
|
|
96
|
+
temperatureInCelsius={trending?.temperatureInCelsius ?? null}
|
|
97
|
+
/>
|
|
98
|
+
) : index === 2 ? (
|
|
99
|
+
<CurrentCountry
|
|
100
|
+
countryPaths={trending?.countryPaths ?? null}
|
|
101
|
+
countryLabel={trending?.countryLabel ?? null}
|
|
102
|
+
theme={theme}
|
|
103
|
+
/>
|
|
104
|
+
) : (
|
|
105
|
+
<EmojiCard ref={ref} emojiIndex={emojiName} />
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
return (
|
|
109
|
+
<Card
|
|
110
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
111
|
+
key={i}
|
|
112
|
+
onUpdate={onUpdate}
|
|
113
|
+
// @ts-expect-error
|
|
114
|
+
refsToUse={refs}
|
|
115
|
+
index={i}
|
|
116
|
+
content={content}
|
|
117
|
+
positions={positions}
|
|
118
|
+
shouldBePositions={shouldBePositions}
|
|
119
|
+
indices={indices}
|
|
120
|
+
theme={theme}
|
|
121
|
+
withSwitcher={index === 3 && !isRendering}
|
|
122
|
+
onClickLeft={onLeft}
|
|
123
|
+
onClickRight={onRight}
|
|
124
|
+
/>
|
|
125
|
+
);
|
|
126
|
+
})}
|
|
127
|
+
</AbsoluteFill>
|
|
128
|
+
);
|
|
129
|
+
};
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import type {EmojiName} from '@remotion/animated-emoji';
|
|
2
|
+
import React, {useCallback, useEffect, useMemo, useState} from 'react';
|
|
3
|
+
import {
|
|
4
|
+
AbsoluteFill,
|
|
5
|
+
Audio,
|
|
6
|
+
prefetch,
|
|
7
|
+
staticFile,
|
|
8
|
+
type CalculateMetadataFunction,
|
|
9
|
+
} from 'remotion';
|
|
10
|
+
import {Cards} from './Cards';
|
|
11
|
+
import type {Location} from './types';
|
|
12
|
+
|
|
13
|
+
export type RemoteData = {
|
|
14
|
+
repos: string[];
|
|
15
|
+
date: string | number;
|
|
16
|
+
temperatureInCelsius: number;
|
|
17
|
+
countryLabel: string;
|
|
18
|
+
countryPaths: {
|
|
19
|
+
d: string;
|
|
20
|
+
class: string;
|
|
21
|
+
}[];
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export type LocationAndTrending = {
|
|
25
|
+
readonly location: Location | null;
|
|
26
|
+
readonly trending: RemoteData | null;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const getDataAndProps = async () => {
|
|
30
|
+
const location = (await fetch(
|
|
31
|
+
'https://bugs-git-homepage-player-remotion.vercel.app/api/location',
|
|
32
|
+
).then((res) => res.json())) as Location;
|
|
33
|
+
|
|
34
|
+
const trending = await fetch(
|
|
35
|
+
`https://bugs.remotion.dev/trending?lat=${location.latitude}&lng=${location.longitude}&country=${location.country}`,
|
|
36
|
+
)
|
|
37
|
+
.then((res) => res.json())
|
|
38
|
+
.then((data) => {
|
|
39
|
+
return {
|
|
40
|
+
repos: data.trending.repos.slice(0, 3),
|
|
41
|
+
date: data.trending.dateFetched,
|
|
42
|
+
temperatureInCelsius: Math.round(data.temperature),
|
|
43
|
+
countryLabel: data.countryLabel,
|
|
44
|
+
countryPaths: data.countryPaths,
|
|
45
|
+
};
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
return {trending, location};
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export const calculateMetadata: CalculateMetadataFunction<DemoPlayerProps> = ({
|
|
52
|
+
props,
|
|
53
|
+
}) => {
|
|
54
|
+
return {
|
|
55
|
+
durationInFrames: 120,
|
|
56
|
+
fps: 30,
|
|
57
|
+
height: 360,
|
|
58
|
+
width: 640,
|
|
59
|
+
props: {
|
|
60
|
+
...props,
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export type DemoPlayerProps = {
|
|
66
|
+
readonly onToggle: () => void;
|
|
67
|
+
readonly cardOrder: number[];
|
|
68
|
+
readonly updateCardOrder: (newCardOrder: number[]) => void;
|
|
69
|
+
readonly theme: 'dark' | 'light';
|
|
70
|
+
readonly onClickLeft: () => void;
|
|
71
|
+
readonly onClickRight: () => void;
|
|
72
|
+
readonly emojiIndex: number;
|
|
73
|
+
} & LocationAndTrending;
|
|
74
|
+
|
|
75
|
+
const fireAudio = staticFile('fire.mp3');
|
|
76
|
+
const partyHornAudio = staticFile('partyhorn.mp3');
|
|
77
|
+
const sadAudio = staticFile('sad.mp3');
|
|
78
|
+
|
|
79
|
+
export const HomepageVideoComp: React.FC<DemoPlayerProps> = ({
|
|
80
|
+
theme,
|
|
81
|
+
onToggle,
|
|
82
|
+
cardOrder,
|
|
83
|
+
updateCardOrder,
|
|
84
|
+
location,
|
|
85
|
+
trending,
|
|
86
|
+
emojiIndex,
|
|
87
|
+
onClickLeft,
|
|
88
|
+
onClickRight,
|
|
89
|
+
}) => {
|
|
90
|
+
const [rerenders, setRerenders] = useState(0);
|
|
91
|
+
|
|
92
|
+
const onUpdate = useCallback(
|
|
93
|
+
(newIndices: number[]) => {
|
|
94
|
+
setRerenders(rerenders + 1);
|
|
95
|
+
updateCardOrder(newIndices);
|
|
96
|
+
},
|
|
97
|
+
[rerenders, updateCardOrder],
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
const emoji = useMemo((): EmojiName => {
|
|
101
|
+
if ((emojiIndex + 10000 * 3) % 3 === 1) {
|
|
102
|
+
return 'melting';
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if ((emojiIndex + 10000 * 3) % 3 === 2) {
|
|
106
|
+
return 'fire';
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
return 'partying-face';
|
|
110
|
+
}, [emojiIndex]);
|
|
111
|
+
|
|
112
|
+
const audioSrc = useMemo(() => {
|
|
113
|
+
if (emoji === 'fire') {
|
|
114
|
+
return fireAudio;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
if (emoji === 'partying-face') {
|
|
118
|
+
return partyHornAudio;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return sadAudio;
|
|
122
|
+
}, [emoji]);
|
|
123
|
+
|
|
124
|
+
useEffect(() => {
|
|
125
|
+
const a = prefetch(fireAudio);
|
|
126
|
+
const b = prefetch(partyHornAudio);
|
|
127
|
+
const c = prefetch(sadAudio);
|
|
128
|
+
|
|
129
|
+
return () => {
|
|
130
|
+
a.free();
|
|
131
|
+
b.free();
|
|
132
|
+
c.free();
|
|
133
|
+
};
|
|
134
|
+
}, []);
|
|
135
|
+
|
|
136
|
+
return (
|
|
137
|
+
<AbsoluteFill
|
|
138
|
+
style={{
|
|
139
|
+
backgroundColor: theme === 'dark' ? '#222' : '#fafafa',
|
|
140
|
+
}}
|
|
141
|
+
>
|
|
142
|
+
<Cards
|
|
143
|
+
key={rerenders}
|
|
144
|
+
onUpdate={onUpdate}
|
|
145
|
+
indices={cardOrder}
|
|
146
|
+
theme={theme}
|
|
147
|
+
location={location}
|
|
148
|
+
trending={trending}
|
|
149
|
+
onToggle={onToggle}
|
|
150
|
+
onLeft={onClickLeft}
|
|
151
|
+
onRight={onClickRight}
|
|
152
|
+
emojiName={emoji}
|
|
153
|
+
/>
|
|
154
|
+
{audioSrc ? <Audio src={audioSrc} /> : null}
|
|
155
|
+
</AbsoluteFill>
|
|
156
|
+
);
|
|
157
|
+
};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import {getBoundingBox, resetPath} from '@remotion/paths';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import {
|
|
4
|
+
AbsoluteFill,
|
|
5
|
+
interpolate,
|
|
6
|
+
spring,
|
|
7
|
+
useCurrentFrame,
|
|
8
|
+
useVideoConfig,
|
|
9
|
+
} from 'remotion';
|
|
10
|
+
|
|
11
|
+
export const CurrentCountry: React.FC<{
|
|
12
|
+
readonly theme: 'dark' | 'light';
|
|
13
|
+
readonly countryPaths:
|
|
14
|
+
| {
|
|
15
|
+
d: string;
|
|
16
|
+
class: string;
|
|
17
|
+
}[]
|
|
18
|
+
| null;
|
|
19
|
+
readonly countryLabel: string | null;
|
|
20
|
+
}> = ({theme, countryPaths, countryLabel}) => {
|
|
21
|
+
const {fps} = useVideoConfig();
|
|
22
|
+
const frame = useCurrentFrame();
|
|
23
|
+
|
|
24
|
+
if (!countryPaths) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const joined = countryPaths.map((p) => p.d).join(' ');
|
|
29
|
+
const reset = resetPath(joined);
|
|
30
|
+
const boundingBox = getBoundingBox(reset);
|
|
31
|
+
|
|
32
|
+
const progress = spring({
|
|
33
|
+
fps,
|
|
34
|
+
frame,
|
|
35
|
+
delay: 10,
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<AbsoluteFill style={{overflow: 'hidden'}}>
|
|
40
|
+
<AbsoluteFill
|
|
41
|
+
style={{
|
|
42
|
+
transform: `scale(${progress})`,
|
|
43
|
+
}}
|
|
44
|
+
>
|
|
45
|
+
<svg
|
|
46
|
+
viewBox={boundingBox.viewBox}
|
|
47
|
+
style={{
|
|
48
|
+
scale: '0.8',
|
|
49
|
+
}}
|
|
50
|
+
>
|
|
51
|
+
<path fill={theme === 'light' ? '#bbb' : '#222'} d={reset} />
|
|
52
|
+
</svg>
|
|
53
|
+
</AbsoluteFill>
|
|
54
|
+
<AbsoluteFill
|
|
55
|
+
style={{
|
|
56
|
+
alignItems: 'center',
|
|
57
|
+
justifyContent: 'center',
|
|
58
|
+
}}
|
|
59
|
+
>
|
|
60
|
+
<div
|
|
61
|
+
style={{
|
|
62
|
+
color: '#0b84f3',
|
|
63
|
+
fontFamily: 'GTPlanar',
|
|
64
|
+
fontWeight: '500',
|
|
65
|
+
fontSize: 13,
|
|
66
|
+
textAlign: 'center',
|
|
67
|
+
marginTop: -10,
|
|
68
|
+
width: '100%',
|
|
69
|
+
paddingLeft: 20,
|
|
70
|
+
paddingRight: 20,
|
|
71
|
+
transform:
|
|
72
|
+
'translateX(' + interpolate(progress, [0, 1], [-100, 0]) + '%)',
|
|
73
|
+
}}
|
|
74
|
+
>
|
|
75
|
+
Your country
|
|
76
|
+
</div>
|
|
77
|
+
<div
|
|
78
|
+
style={{
|
|
79
|
+
lineHeight: 1.1,
|
|
80
|
+
fontFamily: 'GTPlanar',
|
|
81
|
+
textAlign: 'center',
|
|
82
|
+
fontWeight: '500',
|
|
83
|
+
fontSize: 30,
|
|
84
|
+
color: theme === 'dark' ? 'white' : 'black',
|
|
85
|
+
width: '100%',
|
|
86
|
+
paddingLeft: 20,
|
|
87
|
+
paddingRight: 20,
|
|
88
|
+
transform:
|
|
89
|
+
'translateX(' + interpolate(progress, [0, 1], [100, 0]) + '%)',
|
|
90
|
+
}}
|
|
91
|
+
>
|
|
92
|
+
{countryLabel}
|
|
93
|
+
</div>
|
|
94
|
+
</AbsoluteFill>
|
|
95
|
+
</AbsoluteFill>
|
|
96
|
+
);
|
|
97
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {FONTS, RED} from '../layout/colors';
|
|
3
|
+
|
|
4
|
+
export const DemoError: React.FC = () => {
|
|
5
|
+
return (
|
|
6
|
+
<div
|
|
7
|
+
style={{
|
|
8
|
+
color: RED,
|
|
9
|
+
fontFamily: FONTS.GTPLANAR,
|
|
10
|
+
position: 'absolute',
|
|
11
|
+
paddingTop: 15,
|
|
12
|
+
}}
|
|
13
|
+
>
|
|
14
|
+
Sorry, we limit the amount of renders possible per day on this page. Come
|
|
15
|
+
back tomorrow!
|
|
16
|
+
</div>
|
|
17
|
+
);
|
|
18
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {RED} from '../layout/colors';
|
|
3
|
+
|
|
4
|
+
export const DemoErrorIcon: React.FC = () => {
|
|
5
|
+
return (
|
|
6
|
+
<div
|
|
7
|
+
style={{
|
|
8
|
+
height: 26,
|
|
9
|
+
width: 26,
|
|
10
|
+
borderRadius: 13,
|
|
11
|
+
display: 'flex',
|
|
12
|
+
alignItems: 'center',
|
|
13
|
+
justifyContent: 'center',
|
|
14
|
+
animation: 'jump 0.2s ease-out',
|
|
15
|
+
}}
|
|
16
|
+
>
|
|
17
|
+
<svg
|
|
18
|
+
style={{
|
|
19
|
+
flexShrink: 0,
|
|
20
|
+
width: 26,
|
|
21
|
+
}}
|
|
22
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
23
|
+
viewBox="0 0 512 512"
|
|
24
|
+
>
|
|
25
|
+
<path
|
|
26
|
+
fill={RED}
|
|
27
|
+
d="M17.1 292c-12.9-22.3-12.9-49.7 0-72L105.4 67.1c12.9-22.3 36.6-36 62.4-36l176.6 0c25.7 0 49.5 13.7 62.4 36L494.9 220c12.9 22.3 12.9 49.7 0 72L406.6 444.9c-12.9 22.3-36.6 36-62.4 36l-176.6 0c-25.7 0-49.5-13.7-62.4-36L17.1 292zM256 128c-13.3 0-24 10.7-24 24l0 112c0 13.3 10.7 24 24 24s24-10.7 24-24l0-112c0-13.3-10.7-24-24-24zm32 224a32 32 0 1 0 -64 0 32 32 0 1 0 64 0z"
|
|
28
|
+
/>
|
|
29
|
+
</svg>
|
|
30
|
+
</div>
|
|
31
|
+
);
|
|
32
|
+
};
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import type {EnhancedErrorInfo} from '@remotion/lambda';
|
|
2
|
+
import React, {useCallback} from 'react';
|
|
3
|
+
import {z} from 'zod';
|
|
4
|
+
import {PALETTE} from '../layout/colors';
|
|
5
|
+
import {DemoErrorIcon} from './DemoErrorIcon';
|
|
6
|
+
import {DoneCheckmark} from './DoneCheckmark';
|
|
7
|
+
import {Progress} from './Progress';
|
|
8
|
+
import {Spinner} from './Spinner';
|
|
9
|
+
|
|
10
|
+
const countryPath = z.object({
|
|
11
|
+
d: z.string(),
|
|
12
|
+
class: z.string(),
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const remoteData = z.object({
|
|
16
|
+
repos: z.array(z.string()),
|
|
17
|
+
date: z.string().or(z.number()),
|
|
18
|
+
temperatureInCelsius: z.number(),
|
|
19
|
+
countryLabel: z.string(),
|
|
20
|
+
countryPaths: z.array(countryPath),
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const location = z.object({
|
|
24
|
+
country: z.string(),
|
|
25
|
+
city: z.string(),
|
|
26
|
+
latitude: z.number().or(z.string()),
|
|
27
|
+
longitude: z.number().or(z.string()),
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
31
|
+
const data = z.object({
|
|
32
|
+
trending: remoteData,
|
|
33
|
+
location,
|
|
34
|
+
emojiIndex: z.number(),
|
|
35
|
+
theme: z.enum(['light', 'dark']),
|
|
36
|
+
cardOrder: z.array(z.number()),
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
type State =
|
|
40
|
+
| {
|
|
41
|
+
type: 'idle';
|
|
42
|
+
}
|
|
43
|
+
| {
|
|
44
|
+
type: 'invoking';
|
|
45
|
+
}
|
|
46
|
+
| {
|
|
47
|
+
type: 'progress';
|
|
48
|
+
progress: number;
|
|
49
|
+
}
|
|
50
|
+
| {
|
|
51
|
+
type: 'done';
|
|
52
|
+
}
|
|
53
|
+
| {
|
|
54
|
+
type: 'error';
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const style: React.CSSProperties = {
|
|
58
|
+
appearance: 'none',
|
|
59
|
+
border: 'none',
|
|
60
|
+
outline: 'none',
|
|
61
|
+
backgroundColor: 'transparent',
|
|
62
|
+
cursor: 'pointer',
|
|
63
|
+
width: 55,
|
|
64
|
+
height: 50,
|
|
65
|
+
display: 'flex',
|
|
66
|
+
alignItems: 'center',
|
|
67
|
+
justifyContent: 'center',
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export const RenderButton: React.FC<{
|
|
71
|
+
readonly renderData: z.infer<typeof data> | null;
|
|
72
|
+
readonly onError: () => void;
|
|
73
|
+
}> = ({renderData, onError}) => {
|
|
74
|
+
const [state, setState] = React.useState<State>({
|
|
75
|
+
type: 'idle',
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
const triggerRender = useCallback(async () => {
|
|
79
|
+
if (renderData === null) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
try {
|
|
84
|
+
setState({type: 'invoking'});
|
|
85
|
+
|
|
86
|
+
const {renderId, bucketName} = await (
|
|
87
|
+
await fetch('https://bugs.remotion.dev/render', {
|
|
88
|
+
method: 'post',
|
|
89
|
+
headers: {'content-type': 'application/json'},
|
|
90
|
+
body: JSON.stringify(renderData),
|
|
91
|
+
})
|
|
92
|
+
).json();
|
|
93
|
+
setState({type: 'progress', progress: 0});
|
|
94
|
+
|
|
95
|
+
let done = false;
|
|
96
|
+
|
|
97
|
+
while (!done) {
|
|
98
|
+
const progress = (await (
|
|
99
|
+
await fetch('https://bugs.remotion.dev/progress', {
|
|
100
|
+
method: 'post',
|
|
101
|
+
headers: {'content-type': 'application/json'},
|
|
102
|
+
body: JSON.stringify({renderId, bucketName}),
|
|
103
|
+
})
|
|
104
|
+
).json()) as {
|
|
105
|
+
overallProgress: number;
|
|
106
|
+
outputFile: string | null;
|
|
107
|
+
errors: EnhancedErrorInfo[];
|
|
108
|
+
fatalErrorEncountered: boolean;
|
|
109
|
+
};
|
|
110
|
+
setState({
|
|
111
|
+
type: 'progress',
|
|
112
|
+
progress: progress.overallProgress,
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
if (progress.outputFile) {
|
|
116
|
+
done = true;
|
|
117
|
+
const a = document.createElement('a');
|
|
118
|
+
a.href = progress.outputFile;
|
|
119
|
+
a.download = 'remotion.dev.mp4';
|
|
120
|
+
a.click();
|
|
121
|
+
setState({type: 'done'});
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
if (progress.fatalErrorEncountered) {
|
|
125
|
+
done = true;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
} catch {
|
|
129
|
+
setState({type: 'error'});
|
|
130
|
+
onError();
|
|
131
|
+
}
|
|
132
|
+
}, [onError, renderData]);
|
|
133
|
+
|
|
134
|
+
return (
|
|
135
|
+
<button
|
|
136
|
+
type="button"
|
|
137
|
+
onClick={triggerRender}
|
|
138
|
+
style={style}
|
|
139
|
+
disabled={!renderData || state.type !== 'idle'}
|
|
140
|
+
>
|
|
141
|
+
{state.type === 'error' ? (
|
|
142
|
+
<DemoErrorIcon />
|
|
143
|
+
) : state.type === 'done' ? (
|
|
144
|
+
<DoneCheckmark />
|
|
145
|
+
) : state.type === 'progress' ? (
|
|
146
|
+
<Progress progress={state.progress} />
|
|
147
|
+
) : state.type === 'invoking' ? (
|
|
148
|
+
<Spinner size={20} duration={1} />
|
|
149
|
+
) : (
|
|
150
|
+
<svg
|
|
151
|
+
style={{
|
|
152
|
+
width: 18,
|
|
153
|
+
opacity: renderData ? 1 : 0.5,
|
|
154
|
+
}}
|
|
155
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
156
|
+
viewBox="0 0 384 512"
|
|
157
|
+
>
|
|
158
|
+
<path
|
|
159
|
+
fill={PALETTE.TEXT_COLOR}
|
|
160
|
+
d="M214.6 342.6L192 365.3l-22.6-22.6-128-128L18.7 192 64 146.7l22.6 22.6L160 242.7 160 64l0-32 64 0 0 32 0 178.7 73.4-73.4L320 146.7 365.3 192l-22.6 22.6-128 128zM32 416l320 0 32 0 0 64-32 0L32 480 0 480l0-64 32 0z"
|
|
161
|
+
/>
|
|
162
|
+
</svg>
|
|
163
|
+
)}
|
|
164
|
+
</button>
|
|
165
|
+
);
|
|
166
|
+
};
|