@remotion/promo-pages 4.0.260 → 5.0.0-canary.3

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.
Files changed (131) hide show
  1. package/dist/Homepage.js +2 -4
  2. package/package.json +52 -48
  3. package/.turbo/turbo-lint.log +0 -5
  4. package/.turbo/turbo-make.log +0 -8
  5. package/LICENSE.md +0 -49
  6. package/bundle.ts +0 -46
  7. package/eslint.config.mjs +0 -7
  8. package/index.html +0 -13
  9. package/public/fire.mp3 +0 -0
  10. package/public/img/cluster.png +0 -0
  11. package/public/img/code-sample-new.png +0 -0
  12. package/public/img/freelancers/alex.jpeg +0 -0
  13. package/public/img/freelancers/antoine.jpeg +0 -0
  14. package/public/img/freelancers/ayush.png +0 -0
  15. package/public/img/freelancers/benjamin.jpeg +0 -0
  16. package/public/img/freelancers/default.png +0 -0
  17. package/public/img/freelancers/florent.jpeg +0 -0
  18. package/public/img/freelancers/karel.jpeg +0 -0
  19. package/public/img/freelancers/lorenzo.jpeg +0 -0
  20. package/public/img/freelancers/mickael.jpeg +0 -0
  21. package/public/img/freelancers/mohit.jpeg +0 -0
  22. package/public/img/freelancers/pramod.jpg +0 -0
  23. package/public/img/freelancers/pranav.jpg +0 -0
  24. package/public/img/freelancers/rahul.png +0 -0
  25. package/public/img/freelancers/ray.jpeg +0 -0
  26. package/public/img/freelancers/stephen.png +0 -0
  27. package/public/img/freelancers/umungo.png +0 -0
  28. package/public/img/freelancers/yehor.jpeg +0 -0
  29. package/public/img/gt-planar-black.woff2 +0 -0
  30. package/public/img/gt-planar-bold.woff2 +0 -0
  31. package/public/img/gt-planar-medium.woff2 +0 -0
  32. package/public/img/gt-planar-regular.woff2 +0 -0
  33. package/public/img/logo-small.png +0 -0
  34. package/public/img/mp4.png +0 -0
  35. package/public/img/player-demo.mp4 +0 -0
  36. package/public/img/player-example-dark.png +0 -0
  37. package/public/img/player-example.png +0 -0
  38. package/public/img/writeinreact.png +0 -0
  39. package/public/partyhorn.mp3 +0 -0
  40. package/public/sad.mp3 +0 -0
  41. package/src/cn.ts +0 -6
  42. package/src/components/Homepage.tsx +0 -88
  43. package/src/components/homepage/BackgroundAnimation.tsx +0 -108
  44. package/src/components/homepage/ChooseTemplate.tsx +0 -57
  45. package/src/components/homepage/CodeExample.tsx +0 -89
  46. package/src/components/homepage/CommunityStats.tsx +0 -54
  47. package/src/components/homepage/CommunityStatsItems.tsx +0 -304
  48. package/src/components/homepage/Counter.tsx +0 -110
  49. package/src/components/homepage/Demo/Card.tsx +0 -273
  50. package/src/components/homepage/Demo/Cards.tsx +0 -129
  51. package/src/components/homepage/Demo/Comp.tsx +0 -157
  52. package/src/components/homepage/Demo/CurrentCountry.tsx +0 -97
  53. package/src/components/homepage/Demo/DemoError.tsx +0 -18
  54. package/src/components/homepage/Demo/DemoErrorIcon.tsx +0 -32
  55. package/src/components/homepage/Demo/DemoRender.tsx +0 -166
  56. package/src/components/homepage/Demo/DigitWheel.tsx +0 -179
  57. package/src/components/homepage/Demo/DisplayedEmoji.tsx +0 -81
  58. package/src/components/homepage/Demo/DoneCheckmark.tsx +0 -39
  59. package/src/components/homepage/Demo/DownloadNudge.tsx +0 -62
  60. package/src/components/homepage/Demo/DragAndDropNudge.tsx +0 -57
  61. package/src/components/homepage/Demo/EmojiCard.tsx +0 -198
  62. package/src/components/homepage/Demo/Minus.tsx +0 -21
  63. package/src/components/homepage/Demo/PlayPauseButton.tsx +0 -66
  64. package/src/components/homepage/Demo/PlayerControls.tsx +0 -48
  65. package/src/components/homepage/Demo/PlayerSeekBar.tsx +0 -325
  66. package/src/components/homepage/Demo/PlayerVolume.tsx +0 -83
  67. package/src/components/homepage/Demo/Progress.tsx +0 -38
  68. package/src/components/homepage/Demo/Spinner.tsx +0 -60
  69. package/src/components/homepage/Demo/Switcher.tsx +0 -54
  70. package/src/components/homepage/Demo/Temperature.tsx +0 -44
  71. package/src/components/homepage/Demo/TemperatureNumber.tsx +0 -68
  72. package/src/components/homepage/Demo/ThemeNudge.tsx +0 -72
  73. package/src/components/homepage/Demo/TimeDisplay.tsx +0 -43
  74. package/src/components/homepage/Demo/TrendingRepos.tsx +0 -106
  75. package/src/components/homepage/Demo/icons.tsx +0 -114
  76. package/src/components/homepage/Demo/index.tsx +0 -158
  77. package/src/components/homepage/Demo/math.ts +0 -43
  78. package/src/components/homepage/Demo/types.ts +0 -6
  79. package/src/components/homepage/Editor.tsx +0 -67
  80. package/src/components/homepage/EvaluateRemotion.tsx +0 -92
  81. package/src/components/homepage/FreePricing.tsx +0 -295
  82. package/src/components/homepage/GetStartedStrip.tsx +0 -77
  83. package/src/components/homepage/GitHubButton.tsx +0 -23
  84. package/src/components/homepage/IconForTemplate.tsx +0 -154
  85. package/src/components/homepage/IfYouKnowReact.tsx +0 -29
  86. package/src/components/homepage/InfoTooltip.tsx +0 -25
  87. package/src/components/homepage/MoreTemplatesButton.tsx +0 -29
  88. package/src/components/homepage/MuxVideo.tsx +0 -68
  89. package/src/components/homepage/NewsletterButton.tsx +0 -88
  90. package/src/components/homepage/Pricing.tsx +0 -49
  91. package/src/components/homepage/PricingBulletPoint.tsx +0 -50
  92. package/src/components/homepage/RealMp4Videos.tsx +0 -50
  93. package/src/components/homepage/Spacer.tsx +0 -5
  94. package/src/components/homepage/TemplateIcon.tsx +0 -36
  95. package/src/components/homepage/TextInput.tsx +0 -62
  96. package/src/components/homepage/TrustedByBanner.tsx +0 -194
  97. package/src/components/homepage/VideoApps.tsx +0 -231
  98. package/src/components/homepage/VideoAppsShowcase.tsx +0 -276
  99. package/src/components/homepage/VideoAppsTitle.tsx +0 -24
  100. package/src/components/homepage/VideoPlayerWithControls.tsx +0 -188
  101. package/src/components/homepage/WriteInReact.tsx +0 -34
  102. package/src/components/homepage/YouAreHere.tsx +0 -30
  103. package/src/components/homepage/custom.css +0 -57
  104. package/src/components/homepage/layout/Button.tsx +0 -93
  105. package/src/components/homepage/layout/colors.ts +0 -17
  106. package/src/components/homepage/layout/use-color-mode.tsx +0 -44
  107. package/src/components/homepage/layout/use-el-size.ts +0 -51
  108. package/src/components/homepage/layout/use-mobile-layout.ts +0 -8
  109. package/src/components/homepage/video-player.css +0 -24
  110. package/src/components/icons/blank.tsx +0 -13
  111. package/src/components/icons/clone.tsx +0 -10
  112. package/src/components/icons/code-hike.tsx +0 -15
  113. package/src/components/icons/cubes.tsx +0 -13
  114. package/src/components/icons/js.tsx +0 -17
  115. package/src/components/icons/next.tsx +0 -64
  116. package/src/components/icons/overlay.tsx +0 -24
  117. package/src/components/icons/remix.tsx +0 -24
  118. package/src/components/icons/skia.tsx +0 -13
  119. package/src/components/icons/stargazer.tsx +0 -13
  120. package/src/components/icons/still.tsx +0 -13
  121. package/src/components/icons/tailwind.tsx +0 -22
  122. package/src/components/icons/tiktok.tsx +0 -13
  123. package/src/components/icons/ts.tsx +0 -18
  124. package/src/components/icons/tts.tsx +0 -13
  125. package/src/components/icons/undo.tsx +0 -11
  126. package/src/components/icons/waveform.tsx +0 -13
  127. package/src/fonts.css +0 -30
  128. package/src/index.css +0 -74
  129. package/src/main.tsx +0 -12
  130. package/tsconfig.json +0 -15
  131. package/vite.config.ts +0 -9
@@ -1,273 +0,0 @@
1
- import React, {useCallback, useRef} from 'react';
2
- import {AbsoluteFill, spring} from 'remotion';
3
- import {
4
- cardHeight,
5
- cardWidth,
6
- getIndexFromPosition,
7
- getInitialPositions,
8
- getPositionForIndex,
9
- type Position,
10
- } from './math';
11
- import {Switcher} from './Switcher';
12
-
13
- const arePositionsEqual = (a: Position[], b: Position[]) => {
14
- return a.every((pos, i) => {
15
- return pos.x === b[i].x && pos.y === b[i].y;
16
- });
17
- };
18
-
19
- export const Card: React.FC<{
20
- readonly index: number;
21
- readonly refsToUse: React.MutableRefObject<HTMLDivElement>[];
22
- readonly onUpdate: (newIndices: number[]) => void;
23
- readonly content: React.ReactNode;
24
- readonly positions: React.MutableRefObject<Position[]>;
25
- readonly shouldBePositions: React.MutableRefObject<Position[]>;
26
- readonly indices: number[];
27
- readonly theme: 'dark' | 'light';
28
- readonly withSwitcher: boolean;
29
- readonly onClickLeft: () => void;
30
- readonly onClickRight: () => void;
31
- }> = ({
32
- positions,
33
- shouldBePositions,
34
- index,
35
- refsToUse,
36
- onUpdate,
37
- content,
38
- indices,
39
- theme,
40
- withSwitcher,
41
- onClickLeft,
42
- onClickRight,
43
- }) => {
44
- const refToUse = refsToUse[index];
45
- const stopPrevious = useRef<(() => void)[]>([]);
46
-
47
- // eslint-disable-next-line react-hooks/exhaustive-deps
48
- let newIndices = [...indices];
49
-
50
- const applyPositions = useCallback(
51
- (except: number | null) => {
52
- let stopped = false;
53
- stopPrevious.current.forEach((s) => {
54
- s();
55
- });
56
- stopPrevious.current.push(() => {
57
- stopped = true;
58
- });
59
- positions.current.forEach((_, i) => {
60
- const shouldBe = shouldBePositions.current[i];
61
- const ref = refsToUse[i].current;
62
- if (!ref) {
63
- return;
64
- }
65
-
66
- if (except === null) {
67
- ref.style.pointerEvents = 'none';
68
- }
69
-
70
- if (i === except) {
71
- ref.style.left = getPositionForIndex(i).x + 'px';
72
- ref.style.top = getPositionForIndex(i).y + 'px';
73
- return;
74
- }
75
-
76
- let animationI = 1;
77
- const duration = 20;
78
-
79
- const releasePositionX = positions.current[i].x;
80
- const releasePositionY = positions.current[i].y;
81
-
82
- const finishAnimation = () => {
83
- refsToUse.forEach((r) => {
84
- r.current.style.zIndex = '1';
85
- r.current.style.scale = '1';
86
- r.current.style.opacity = '1';
87
- });
88
- if (i === 0) {
89
- setTimeout(() => {
90
- onUpdate([...newIndices]);
91
- }, 200);
92
- }
93
- };
94
-
95
- if (
96
- releasePositionX === shouldBe.x &&
97
- releasePositionY === shouldBe.y &&
98
- animationI === duration &&
99
- except === null
100
- ) {
101
- finishAnimation();
102
- return;
103
- }
104
-
105
- const update = () => {
106
- if (stopped) {
107
- return;
108
- }
109
-
110
- const progress = spring({
111
- fps: 60,
112
- frame: animationI,
113
- config: {
114
- damping: 200,
115
- },
116
- durationInFrames: duration,
117
- durationRestThreshold: 0.001,
118
- });
119
- const newX =
120
- progress * (shouldBe.x - releasePositionX) + releasePositionX;
121
- const newY =
122
- progress * (shouldBe.y - releasePositionY) + releasePositionY;
123
- ref.style.left = `${newX}px`;
124
- ref.style.top = `${newY}px`;
125
- positions.current[i] = {
126
- x: newX,
127
- y: newY,
128
- };
129
- animationI++;
130
- if (animationI === duration && except === null) {
131
- finishAnimation();
132
-
133
- return;
134
- }
135
-
136
- requestAnimationFrame(update);
137
- };
138
-
139
- update();
140
- });
141
- },
142
- [newIndices, onUpdate, positions, refsToUse, shouldBePositions],
143
- );
144
-
145
- const onPointerDown = useCallback(
146
- (e: React.PointerEvent<HTMLDivElement>) => {
147
- e.currentTarget.setPointerCapture(e.pointerId);
148
- const cardLeft = refToUse.current.offsetLeft;
149
- const cardTop = refToUse.current.offsetTop;
150
- const startX = e.clientX;
151
- const startY = e.clientY;
152
-
153
- if (e.button === 2) {
154
- return;
155
- }
156
-
157
- let translateX = 0;
158
- let translateY = 0;
159
- refToUse.current.style.scale = '1.05';
160
- refToUse.current.style.cursor = 'grabbing';
161
-
162
- const onMove = (evt: PointerEvent) => {
163
- refsToUse.forEach((r) => {
164
- if (r !== refToUse) {
165
- r.current.style.opacity = '0';
166
- }
167
- });
168
- const scale =
169
- refToUse.current.getBoundingClientRect().width / cardWidth;
170
-
171
- translateX = (evt.clientX - startX) * (1 / scale);
172
- translateY = (evt.clientY - startY) * (1 / scale);
173
-
174
- const position = getIndexFromPosition(
175
- cardLeft + translateX,
176
- cardTop + translateY,
177
- );
178
- if (position === undefined) {
179
- throw new Error('pos');
180
- }
181
-
182
- if (position === index) {
183
- if (
184
- !arePositionsEqual(getInitialPositions(), shouldBePositions.current)
185
- ) {
186
- shouldBePositions.current = getInitialPositions();
187
- applyPositions(index);
188
- }
189
- } else {
190
- const newPos = getInitialPositions();
191
- newPos[position] = getPositionForIndex(index);
192
- newPos[index] = getPositionForIndex(position);
193
- // eslint-disable-next-line react-hooks/exhaustive-deps
194
- newIndices = [...indices];
195
- const prevIndexPosition = newIndices[position];
196
- newIndices[position] = newIndices[index];
197
- newIndices[index] = prevIndexPosition;
198
-
199
- if (!arePositionsEqual(newPos, shouldBePositions.current)) {
200
- shouldBePositions.current = newPos;
201
- applyPositions(index);
202
- }
203
- }
204
-
205
- refToUse.current.style.transform = `translateX(${translateX}px) translateY(${translateY}px)`;
206
- refToUse.current.style.zIndex = '2';
207
- };
208
-
209
- refToUse.current.addEventListener(
210
- 'pointerup',
211
- () => {
212
- positions.current[index] = {
213
- x: cardLeft + translateX,
214
- y: cardTop + translateY,
215
- };
216
- refToUse.current.style.left = `${cardLeft + translateX}px`;
217
- refToUse.current.style.top = `${cardTop + translateY}px`;
218
- refToUse.current.style.transform = `translateX(0px) translateY(0px)`;
219
- refToUse.current.style.cursor = 'grab';
220
-
221
- refToUse.current.removeEventListener('pointermove', onMove);
222
- applyPositions(null);
223
- },
224
- {once: true},
225
- );
226
-
227
- refToUse.current.addEventListener('pointermove', onMove);
228
- },
229
- [applyPositions, index, positions, refToUse, shouldBePositions],
230
- );
231
-
232
- const onPointerUp = useCallback((e: React.PointerEvent<HTMLDivElement>) => {
233
- e.currentTarget.releasePointerCapture(e.pointerId);
234
- }, []);
235
-
236
- const {x, y} = getPositionForIndex(index);
237
- const color = theme === 'light' ? ' #EAEAEA' : '#333';
238
- return (
239
- <div
240
- ref={refToUse}
241
- className={'transition-opacity duration-200'}
242
- onPointerDown={onPointerDown}
243
- onPointerUp={onPointerUp}
244
- style={{
245
- width: cardWidth,
246
- height: cardHeight,
247
- position: 'absolute',
248
- left: x,
249
- top: y,
250
- userSelect: 'none',
251
- border: `1px solid ${color}`,
252
- borderRadius: 13,
253
- cursor: 'grab',
254
- }}
255
- >
256
- <AbsoluteFill
257
- style={{
258
- backgroundColor: color,
259
- borderRadius: 12,
260
- }}
261
- className={'transition-opacity duration-200'}
262
- >
263
- {content}
264
- {withSwitcher ? (
265
- <>
266
- <Switcher onTap={onClickLeft} type="left" theme={theme} />
267
- <Switcher onTap={onClickRight} type="right" theme={theme} />
268
- </>
269
- ) : null}
270
- </AbsoluteFill>
271
- </div>
272
- );
273
- };
@@ -1,129 +0,0 @@
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
- };
@@ -1,157 +0,0 @@
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
- };
@@ -1,97 +0,0 @@
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
- };
@@ -1,18 +0,0 @@
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
- };
@@ -1,32 +0,0 @@
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
- };