🎥 Make videos programmatically with React
awesome
Jonny Burger50763052750e
diff --git a/packages/convert/app/components/Probe.tsx b/packages/convert/app/components/Probe.tsxindex 529164d3de..53b3b0e4af 100644--- a/packages/convert/app/components/Probe.tsx+++ b/packages/convert/app/components/Probe.tsx@@ -8,6 +8,7 @@ import {parseMedia} from '@remotion/media-parser';import React, {useCallback, useEffect, useMemo, useState} from 'react';import {AudioTrackOverview} from './AudioTrackOverview';import {ContainerOverview} from './ContainerOverview';+import {SourceLabel} from './SourceLabel';import {TrackSwitcher} from './TrackSwitcher';import {VideoTrackOverview} from './VideoTrackOverview';import {Button} from './ui/button';@@ -121,7 +122,9 @@ export const Probe: React.FC<{<CardTitle title={name ?? undefined}>{name ? name : <Skeleton className="h-5 w-[220px] inline-block" />}</CardTitle>- <CardDescription>From URL</CardDescription>+ <CardDescription>+ <SourceLabel src={src} />+ </CardDescription></CardHeader>{sortedTracks.length && probeDetails ? (<div className="pl-6 pr-6">diff --git a/packages/convert/app/components/SourceLabel.tsx b/packages/convert/app/components/SourceLabel.tsxnew file mode 100644index 0000000000..8ca79d7b87--- /dev/null+++ b/packages/convert/app/components/SourceLabel.tsx@@ -0,0 +1,29 @@+import React from 'react';++export const SourceLabel: React.FC<{+ readonly src: string | File;+}> = ({src}) => {+ if (src instanceof File) {+ return <div>From file</div>;+ }++ const url = new URL(src as string);++ const origin = url.origin+ .replace(/^https?:\/\//, '')+ .replace(/^http:\/\//, '');++ return (+ <div>+ From{' '}+ <a+ href={src}+ title={src}+ target="_blank"+ className="font-semibold hover:underline"+ >+ {origin}+ </a>+ </div>+ );+};diff --git a/packages/convert/app/components/ui/badge.tsx b/packages/convert/app/components/ui/badge.tsxnew file mode 100644index 0000000000..9b213de3f3--- /dev/null+++ b/packages/convert/app/components/ui/badge.tsx@@ -0,0 +1,36 @@+import * as React from "react"+import { cva, type VariantProps } from "class-variance-authority"++import { cn } from "~/lib/utils"++const badgeVariants = cva(+ "inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",+ {+ variants: {+ variant: {+ default:+ "border-transparent bg-primary text-primary-foreground hover:bg-primary/80",+ secondary:+ "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",+ destructive:+ "border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",+ outline: "text-foreground",+ },+ },+ defaultVariants: {+ variant: "default",+ },+ }+)++export interface BadgeProps+ extends React.HTMLAttributes<HTMLDivElement>,+ VariantProps<typeof badgeVariants> {}++function Badge({ className, variant, ...props }: BadgeProps) {+ return (+ <div className={cn(badgeVariants({ variant }), className)} {...props} />+ )+}++export { Badge, badgeVariants }