From c1a96308798935e2b7dc5b9237f722ce1ba90d98 Mon Sep 17 00:00:00 2001 From: "[dyad]" Date: Fri, 30 Jan 2026 09:03:36 +0100 Subject: [PATCH] [dyad] Added custom video titles - wrote 2 file(s), executed 1 SQL queries --- src/app/clips/[id]/page.tsx | 4 ++-- src/components/video-editor.tsx | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/app/clips/[id]/page.tsx b/src/app/clips/[id]/page.tsx index 34581c3..dff124c 100644 --- a/src/app/clips/[id]/page.tsx +++ b/src/app/clips/[id]/page.tsx @@ -13,7 +13,7 @@ type ClipPageProps = { export default async function ClipPage({ params }: ClipPageProps) { const { data: clip, error } = await supabase .from('clips') - .select('storage_path, original_file_name') + .select('storage_path, original_file_name, title') .eq('short_id', params.id) .single(); @@ -39,7 +39,7 @@ export default async function ClipPage({ params }: ClipPageProps) { - {clip.original_file_name || "Shared Clip"} + {clip.title || clip.original_file_name || "Shared Clip"} diff --git a/src/components/video-editor.tsx b/src/components/video-editor.tsx index b6259e9..31d6bae 100644 --- a/src/components/video-editor.tsx +++ b/src/components/video-editor.tsx @@ -17,6 +17,7 @@ import { Toaster } from "@/components/ui/sonner"; export function VideoEditor() { const [videoSrc, setVideoSrc] = useState(null); const [videoFile, setVideoFile] = useState(null); + const [videoTitle, setVideoTitle] = useState(""); const [duration, setDuration] = useState(0); const [trimValues, setTrimValues] = useState([0, 0]); const [isProcessing, setIsProcessing] = useState(false); @@ -59,6 +60,7 @@ export function VideoEditor() { const file = event.target.files?.[0]; if (file) { setVideoFile(file); + setVideoTitle(file.name.replace(/\.[^/.]+$/, "")); const url = URL.createObjectURL(file); setVideoSrc(url); setShareableLink(null); @@ -128,6 +130,7 @@ export function VideoEditor() { storage_path: storagePath, short_id: shortId, original_file_name: videoFile.name, + title: videoTitle, }); if (dbError) throw new Error(`Database Error: ${dbError.message}`); @@ -152,6 +155,7 @@ export function VideoEditor() { setVideoSrc(null); setVideoFile(null); setDuration(0); setTrimValues([0, 0]); setIsProcessing(false); setShareableLink(null); setProgress(0); + setVideoTitle(""); }; const copyToClipboard = () => { @@ -176,6 +180,16 @@ export function VideoEditor() {
+
+ + setVideoTitle(e.target.value)} + placeholder="Enter a title for your clip" + disabled={isProcessing} + /> +

Trim Video