From cadc009915a46598a0e3bd811d7bff33210d04be Mon Sep 17 00:00:00 2001 From: Giulio Colleluori Date: Sat, 16 Nov 2024 17:46:43 -0500 Subject: [PATCH] fix issues --- Dockerfile | 1 + src/App.tsx | 8 +- src/components/CustomPodcast.tsx | 39 ++++++--- src/components/TopicPodcast.tsx | 146 +++++++++++++++++++++++++++++++ 4 files changed, 180 insertions(+), 14 deletions(-) create mode 100644 src/components/TopicPodcast.tsx diff --git a/Dockerfile b/Dockerfile index b51cfb2..1abfc8c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,6 +8,7 @@ WORKDIR /app RUN apt-get update && apt-get install -y \ build-essential \ curl \ + ffmpeg \ && rm -rf /var/lib/apt/lists/* # Install Node.js and npm diff --git a/src/App.tsx b/src/App.tsx index 1f76f2a..4fe8d51 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -2,7 +2,7 @@ import { useState, useEffect } from "react"; import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; import { CustomPodcast } from "@/components/CustomPodcast"; import { APIKeys } from "@/components/APIKeys"; -import { NewsPodcast } from "@/components/NewsPodcast"; +import { TopicPodcast } from "@/components/TopicPodcast"; import { Toaster } from "@/components/ui/toaster"; export default function App() { @@ -57,13 +57,13 @@ export default function App() { Custom Podcast - News Podcast + Topic Research - - + + diff --git a/src/components/CustomPodcast.tsx b/src/components/CustomPodcast.tsx index 6af83bf..5067a62 100644 --- a/src/components/CustomPodcast.tsx +++ b/src/components/CustomPodcast.tsx @@ -150,11 +150,8 @@ export function CustomPodcast() { localStorage.setItem("podcast_urls", JSON.stringify(parsedUrls)); }, [parsedUrls]); - const onPaste = (e: React.ClipboardEvent) => { - e.preventDefault(); - const pastedText = e.clipboardData.getData("text"); - const urls = extractUrls(pastedText); - + const handleUrlInput = (text: string) => { + const urls = extractUrls(text); if (urls.length > 0) { setParsedUrls((prev) => [...new Set([...prev, ...urls])]); form.setValue("urls", "", { shouldValidate: true }); @@ -165,6 +162,20 @@ export function CustomPodcast() { } }; + const onPaste = (e: React.ClipboardEvent) => { + e.preventDefault(); + const pastedText = e.clipboardData.getData("text"); + handleUrlInput(pastedText); + }; + + const onKeyDown = (e: React.KeyboardEvent) => { + if (e.key === "Enter" && !e.shiftKey) { + e.preventDefault(); + const inputText = form.getValues("urls"); + handleUrlInput(inputText); + } + }; + const removeUrl = (index: number) => { // Prevent event propagation event?.preventDefault(); @@ -362,9 +373,10 @@ export function CustomPodcast() {