diff --git a/app/layout.tsx b/app/layout.tsx index 0734c66..9efe64a 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -41,7 +41,7 @@ export default function RootLayout({ disableTransitionOnChange >
- {children} +
{children}
diff --git a/app/page.tsx b/app/page.tsx index 35e88e7..398d8dd 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -5,7 +5,7 @@ import { SubscribeSection } from "@/components/subscribe-section"; export default function Home() { return ( -
+
diff --git a/app/podcast/[id]/page.tsx b/app/podcast/[id]/page.tsx index 77ef652..729b1f3 100644 --- a/app/podcast/[id]/page.tsx +++ b/app/podcast/[id]/page.tsx @@ -15,9 +15,9 @@ import Link from "next/link"; export default function Podcast() { return ( -
-
-
+
+
+
-
+
-
+

diff --git a/components/podcast-hero.tsx b/components/podcast-hero.tsx index c2cab99..47c3241 100644 --- a/components/podcast-hero.tsx +++ b/components/podcast-hero.tsx @@ -4,8 +4,8 @@ import Image from "next/image"; export function PodcastHero() { return ( -
-
+
+
diff --git a/components/podcast-player.tsx b/components/podcast-player.tsx index 9c313ef..609cf7d 100644 --- a/components/podcast-player.tsx +++ b/components/podcast-player.tsx @@ -12,14 +12,55 @@ import { Volume2, } from "lucide-react"; import Image from "next/image"; -import { useState } from "react"; +import { useRef, useState, useEffect } from "react"; export function PodcastPlayer() { + const audioRef = useRef(null); const [isPlaying, setIsPlaying] = useState(false); + const [currentTime, setCurrentTime] = useState(0); + const [duration, setDuration] = useState(0); // Add duration state + + // Update current time and duration as the audio plays + useEffect(() => { + const audio = audioRef.current; + if (!audio) return; + + const updateTime = () => setCurrentTime(audio.currentTime); + const updateDuration = () => setDuration(audio.duration); + + audio.addEventListener("timeupdate", updateTime); + audio.addEventListener("loadedmetadata", updateDuration); + + return () => { + audio.removeEventListener("timeupdate", updateTime); + audio.removeEventListener("loadedmetadata", updateDuration); + }; + }, []); + + const handlePlaying = () => { + if (isPlaying) { + audioRef.current?.pause(); + } else { + audioRef.current?.play(); + } + setIsPlaying(!isPlaying); + }; + + const formatTime = (time: number) => { + if (isNaN(time)) return "0:00"; // Handle NaN case + const minutes = Math.floor(time / 60); + const seconds = Math.floor(time % 60); + return `${minutes}:${seconds.toString().padStart(2, "0")}`; + }; return (
-
+