Skip to content

🎥 Make videos programmatically with React

test stuff

Jonny Burgera47d5dec05bc
diff --git a/packages/convert/app/components/ConvertUi.tsx b/packages/convert/app/components/ConvertUi.tsx
index 40c09bb1e2..89c0a80e59 100644
--- a/packages/convert/app/components/ConvertUi.tsx
+++ b/packages/convert/app/components/ConvertUi.tsx
@@ -58,8 +58,9 @@ export default function ConvertUI({src}: {readonly src: string}) {
to: container as 'webm',
signal: abortController.signal,
})
- .then(() => {
- setState({type: 'done'});
+ .then(({save}) => {
+ // TODO: When to remove?
+ setState({type: 'done', download: save});
})
.catch((e) => {
setState({type: 'idle'});
@@ -157,7 +158,11 @@ export default function ConvertUI({src}: {readonly src: string}) {
</div>
</div>
<div className="h-4" />
- <Button className="block w-full" type="button" onClick={onClick}>
+ <Button
+ className="block w-full font-brand"
+ type="button"
+ onClick={onClick}
+ >
Convert
</Button>
</>
diff --git a/packages/convert/app/components/FileAvailable.tsx b/packages/convert/app/components/FileAvailable.tsx
index 209c0958e2..a20c8aa103 100644
--- a/packages/convert/app/components/FileAvailable.tsx
+++ b/packages/convert/app/components/FileAvailable.tsx
@@ -1,6 +1,7 @@
import React, {useCallback, useState} from 'react';
import ConvertUI from './ConvertUi';
import {Probe} from './Probe';
+import {Button} from './ui/button';
export const FileAvailable: React.FC<{
readonly src: string;
@@ -15,7 +16,20 @@ export const FileAvailable: React.FC<{
return (
<>
<div>
- <a onClick={clear}>Choose another file</a>
+ <Button variant="link" onClick={clear}>
+ <svg
+ xmlns="http://www.w3.org/2000/svg"
+ viewBox="0 0 448 512"
+ style={{height: 16}}
+ >
+ <path
+ fill="currentcolor"
+ d="M18.2 273l-17-17 17-17L171.8 85.4l17-17 33.9 33.9-17 17L93.1 232 424 232l24 0 0 48-24 0L93.1 280 205.8 392.6l17 17-33.9 33.9-17-17L18.2 273z"
+ />
+ </svg>
+ <div className="w-2" />
+ Choose another file
+ </Button>
<div className="gap-16 flex flex-row items-center justify-center">
<Probe
src={src}
diff --git a/packages/convert/app/lib/config.ts b/packages/convert/app/lib/config.ts
index 29f5e83bc3..ef9c0f6d08 100644
--- a/packages/convert/app/lib/config.ts
+++ b/packages/convert/app/lib/config.ts
@@ -1,4 +1,3 @@
-export const TEST_FAST =
- typeof window !== 'undefined' && window.location.search.includes('fast');
+export const TEST_FAST = false;
export const SAMPLE_FILE =
'https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4';
diff --git a/packages/convert/app/lib/convert-state.ts b/packages/convert/app/lib/convert-state.ts
index 1c824f3824..bc09b9ecda 100644
--- a/packages/convert/app/lib/convert-state.ts
+++ b/packages/convert/app/lib/convert-state.ts
@@ -7,4 +7,5 @@ export type ConvertState =
| {type: 'in-progress'; abortConversion: () => void; state: ConvertMediaState}
| {
type: 'done';
+ download: () => void;
};
diff --git a/packages/convert/package.json b/packages/convert/package.json
index 2b0fa6ab0d..00da8a8910 100644
--- a/packages/convert/package.json
+++ b/packages/convert/package.json
@@ -8,6 +8,7 @@
"build-page": "remix vite:build",
"dev": "remix vite:dev",
"typecheck": "tsc",
+ "test": "bun test test",
"lint": "tsc && eslint --cache --cache-location ./node_modules/.cache/eslint ."
},
"dependencies": {
diff --git a/packages/convert/test/ensure-prod-flags.test.ts b/packages/convert/test/ensure-prod-flags.test.ts
new file mode 100644
index 0000000000..7700b4f684
--- /dev/null
+++ b/packages/convert/test/ensure-prod-flags.test.ts
@@ -0,0 +1,6 @@
+import {expect, test} from 'bun:test';
+import {TEST_FAST} from '~/lib/config';
+
+test('Should not have convert fast enabled', () => {
+ expect(TEST_FAST).toBe(false);
+});
diff --git a/packages/convert/tsconfig.json b/packages/convert/tsconfig.json
index 4717142e53..3a53c11fd0 100644
--- a/packages/convert/tsconfig.json
+++ b/packages/convert/tsconfig.json
@@ -6,7 +6,8 @@
"**/.server/**/*.ts",
"**/.server/**/*.tsx",
"**/.client/**/*.ts",
- "**/.client/**/*.tsx"
+ "**/.client/**/*.tsx",
+ "test"
],
"compilerOptions": {
"lib": ["DOM", "DOM.Iterable", "ES2022"],