Skip to content

🎥 Make videos programmatically with React

awesome

Jonny Burger81abf4287556
diff --git a/packages/convert/app/components/DataTable.tsx b/packages/convert/app/components/DataTable.tsx
index 7f4e6d04ea..274bbc5609 100644
--- a/packages/convert/app/components/DataTable.tsx
+++ b/packages/convert/app/components/DataTable.tsx
@@ -74,7 +74,7 @@ export const TableDemo: React.FC<{
<TableRow>
<TableCell colSpan={3}>Frame Rate</TableCell>
<TableCell className="text-right">
- {dimensions === null ? (
+ {fps === null ? (
<Skeleton className="h-3 w-[100px] inline-block" />
) : (
<>{fps} FPS</>
diff --git a/packages/convert/app/components/Probe.tsx b/packages/convert/app/components/Probe.tsx
index 4752d9d302..ad63a935c6 100644
--- a/packages/convert/app/components/Probe.tsx
+++ b/packages/convert/app/components/Probe.tsx
@@ -15,6 +15,7 @@ import {
CardHeader,
CardTitle,
} from './ui/card';
+import {Separator} from './ui/separator';
export const Probe: React.FC<{
readonly src: string;
@@ -33,6 +34,7 @@ export const Probe: React.FC<{
null,
);
const [fps, setFps] = useState<number | null>(null);
+ const [name, setName] = useState<string | null>(null);
const getStart = useCallback(() => {
parseMedia({
@@ -44,6 +46,7 @@ export const Probe: React.FC<{
durationInSeconds: true,
audioCodec: true,
fps: true,
+ name: true,
},
}).then((data) => {
setDimensions(data.dimensions);
@@ -52,6 +55,7 @@ export const Probe: React.FC<{
setSize(data.size);
setDurationInSeconds(data.durationInSeconds);
setFps(data.fps);
+ setName(data.name);
});
}, [src]);
@@ -68,10 +72,15 @@ export const Probe: React.FC<{
return (
<Card className={probeDetails ? 'w-[800px]' : 'w-[350px]'}>
<CardHeader>
- <CardTitle title={title}>{title}</CardTitle>
+ <CardTitle title={title}>{name}</CardTitle>
<CardDescription>From URL</CardDescription>
</CardHeader>
<CardContent>
+ <div className="flex flex-row">
+ <Button variant={'secondary'}>Overview</Button>
+ <Separator orientation="vertical" />
+ <Button variant={'link'}>Track 1</Button>
+ </div>
<TableDemo
container="MP4"
dimensions={dimensions}
@@ -85,7 +94,7 @@ export const Probe: React.FC<{
<CardFooter className="flex justify-between">
<div className="flex-1" />
<Button onClick={onClick} variant={'link'}>
- Show details
+ {probeDetails ? 'Hide details' : 'Show details'}
</Button>
</CardFooter>
</Card>
diff --git a/packages/convert/app/components/ui/separator.tsx b/packages/convert/app/components/ui/separator.tsx
new file mode 100644
index 0000000000..464677ff8c
--- /dev/null
+++ b/packages/convert/app/components/ui/separator.tsx
@@ -0,0 +1,29 @@
+import * as React from "react"
+import * as SeparatorPrimitive from "@radix-ui/react-separator"
+
+import { cn } from "~/lib/utils"
+
+const Separator = React.forwardRef<
+ React.ElementRef<typeof SeparatorPrimitive.Root>,
+ React.ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root>
+>(
+ (
+ { className, orientation = "horizontal", decorative = true, ...props },
+ ref
+ ) => (
+ <SeparatorPrimitive.Root
+ ref={ref}
+ decorative={decorative}
+ orientation={orientation}
+ className={cn(
+ "shrink-0 bg-border",
+ orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]",
+ className
+ )}
+ {...props}
+ />
+ )
+)
+Separator.displayName = SeparatorPrimitive.Root.displayName
+
+export { Separator }
diff --git a/packages/convert/package.json b/packages/convert/package.json
index 6e56a584a2..684a8dde69 100644
--- a/packages/convert/package.json
+++ b/packages/convert/package.json
@@ -13,6 +13,7 @@
"dependencies": {
"@radix-ui/react-label": "^2.1.0",
"@radix-ui/react-select": "^2.1.1",
+ "@radix-ui/react-separator": "^1.1.0",
"@radix-ui/react-slot": "^1.1.0",
"@remix-run/node": "^2.11.2",
"@remix-run/react": "^2.11.2",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index afe6fcb3d2..bdf73f6937 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -336,6 +336,9 @@ importers:
'@radix-ui/react-select':
specifier: ^2.1.1
+ '@radix-ui/react-separator':
+ specifier: ^1.1.0
'@radix-ui/react-slot':
specifier: ^1.1.0
version: 1.1.0(@types/[email protected])([email protected])
@@ -9163,6 +9166,26 @@ packages:
react-remove-scroll: 2.5.7(@types/[email protected])([email protected])
dev: false
+ resolution: {integrity: sha512-3uBAs+egzvJBDZAzvb/n4NxxOYpnspmWxO2u5NbZ8Y6FM/NdrGSF9bop3Cf6F6C71z1rTSn8KV0Fo2ZVd79lGA==}
+ peerDependencies:
+ '@types/react': '*'
+ '@types/react-dom': '*'
+ react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ react-dom: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ peerDependenciesMeta:
+ '@types/react':
+ optional: true
+ '@types/react-dom':
+ optional: true
+ dependencies:
+ '@radix-ui/react-primitive': 2.0.0(@types/[email protected])(@types/[email protected])([email protected])([email protected])
+ '@types/react': 18.3.1
+ '@types/react-dom': 18.3.0
+ react: 18.3.1
+ react-dom: 18.3.1([email protected])
+ dev: false
+
resolution: {integrity: sha512-FUCf5XMfmW4dtYl69pdS4DbxKy8nj4M7SafBgPllysxmdachynNflAdp/gCsnYWNDnge6tI9onzMp5ARYc1KNw==}
peerDependencies: