From 87793d35f1fe58d22fb43ba702db7c5d76d9de4f Mon Sep 17 00:00:00 2001 From: dbahiense Date: Thu, 25 Jul 2024 13:46:08 -0300 Subject: [PATCH] generate podcast feature --- app/(root)/create-podcast/page.tsx | 174 +++++++++++++++++++++++++++-- 1 file changed, 166 insertions(+), 8 deletions(-) diff --git a/app/(root)/create-podcast/page.tsx b/app/(root)/create-podcast/page.tsx index f4112de..60f81d5 100644 --- a/app/(root)/create-podcast/page.tsx +++ b/app/(root)/create-podcast/page.tsx @@ -1,13 +1,171 @@ -import React from 'react' +"use client" + +import { zodResolver } from "@hookform/resolvers/zod" +import { useForm } from "react-hook-form" +import { z } from "zod" + +import { Button } from "@/components/ui/button" +import { + Form, + FormControl, + FormDescription, + FormField, + FormItem, + FormLabel, + FormMessage, +} from "@/components/ui/form" +import { Input } from "@/components/ui/input" +import { Label } from "@/components/ui/label" +import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select" +import { useState } from "react" +import { Textarea } from "@/components/ui/textarea" +import GeneratePodcast from "@/components/GeneratePodcast" +import GenerateThumbnail from "@/components/GenerateThumbnail" +import { Loader } from "lucide-react" +import { Id } from "@/convex/_generated/dataModel" +import { cn } from "@/lib/utils" + +const voiceCategories = ['alloy', 'shimmer', 'nova', 'echo', 'fable', 'onyx']; + +const formSchema = z.object({ + podcastTitle: z.string().min(3, { + message: "Title must be at least 3 characters.", + }), + podcastDescription: z.string().min(3, { + message: "Description must be at least 3 characters.", + }), +}) + +const CreatPodcast = () => { + const [imagePrompt, setImagePrompt] = useState(''); + const [imageStorageId, setImageStorageId] = useState | null>(null) + const [imageUrl, setImageUrl] = useState(''); + + const [audioUrl, setAudioUrl] = useState(''); + const [audioStorageId, setAudioStorageId] = useState | null>(null) + const [audioDuration, setAudioDuration] = useState(0); + + const [voiceType, setVoiceType] = useState(null); + const [voicePrompt, setVoicePrompt] = useState(''); + + const [isSubmitting, setIsSubmitting] = useState(false); + + //define form + const form = useForm>({ + resolver: zodResolver(formSchema), + defaultValues: { + podcastTitle: "", + podcastDescription: "", + }, + }) + + //define submit handler + function onSubmit(values: z.infer) { + console.log(values) + } -const CreatePodcast = () => { return ( -
-
-

Create Podcast

-
-
+ <> +
+

Create Podcast

+
+ +
+ +
+ ( + + Title + + + + + + )} + /> + +
+ + + +
+ + ( + + Description + +