Skip to content

🎥 Make videos programmatically with React

better mobile UI

Jonny Burgerf51985ff087f
diff --git a/packages/convert/app/components/Probe.tsx b/packages/convert/app/components/Probe.tsx
index a50f1b47d2..062bcbd66e 100644
--- a/packages/convert/app/components/Probe.tsx
+++ b/packages/convert/app/components/Probe.tsx
@@ -68,15 +68,17 @@ export const Probe: React.FC<{
<Card
className={`w-full lg:${probeDetails ? 'w-[800px]' : 'w-[350px]'} overflow-hidden`}
>
- <VideoThumbnail ref={videoThumbnailRef} />
- <CardHeader className="border-b-2 border-black p-3 lg:p-4">
- <CardTitle title={name ?? undefined}>
- {name ? name : <Skeleton className="h-5 w-[220px] inline-block" />}
- </CardTitle>
- <CardDescription className="!mt-0">
- <SourceLabel src={src} />
- </CardDescription>
- </CardHeader>
+ <div className="flex flex-row lg:flex-col w-full border-b-2 border-black">
+ <VideoThumbnail ref={videoThumbnailRef} />
+ <CardHeader className=" p-3 lg:p-4 w-full">
+ <CardTitle title={name ?? undefined}>
+ {name ? name : <Skeleton className="h-5 w-[220px] inline-block" />}
+ </CardTitle>
+ <CardDescription className="!mt-0">
+ <SourceLabel src={src} />
+ </CardDescription>
+ </CardHeader>
+ </div>
{sortedTracks.length && probeDetails ? (
<div className="pr-6 border-b-2 border-black">
<TrackSwitcher
diff --git a/packages/convert/app/components/VideoThumbnail.tsx b/packages/convert/app/components/VideoThumbnail.tsx
index 441e742d16..452d15abfe 100644
--- a/packages/convert/app/components/VideoThumbnail.tsx
+++ b/packages/convert/app/components/VideoThumbnail.tsx
@@ -1,5 +1,6 @@
import {FastAverageColor} from 'fast-average-color';
import React, {useCallback, useImperativeHandle, useRef, useState} from 'react';
+import {useIsNarrow} from '~/lib/is-narrow';
const THUMBNAIL_HEIGHT = Math.round((350 / 16) * 9);
@@ -48,15 +49,22 @@ const VideoThumbnailRefForward: React.ForwardRefRenderFunction<
[drawThumbnail],
);
+ const isNarrow = useIsNarrow();
+
+ const scale = isNarrow ? 0.5 : 1;
+
return (
- <div className="border-b-2 border-black" style={{height: THUMBNAIL_HEIGHT}}>
+ <div
+ className="border-b-2 border-black"
+ style={{height: THUMBNAIL_HEIGHT * scale}}
+ >
<div className="flex justify-center" style={{backgroundColor: color}}>
<canvas
ref={ref}
height={THUMBNAIL_HEIGHT}
style={{
- maxHeight: THUMBNAIL_HEIGHT,
- width,
+ maxHeight: THUMBNAIL_HEIGHT * scale,
+ width: width * scale,
}}
/>
</div>