diff --git a/app/components/AudioPlayer.tsx b/app/components/AudioPlayer.tsx index ff7d2eb..85019ac 100644 --- a/app/components/AudioPlayer.tsx +++ b/app/components/AudioPlayer.tsx @@ -2,7 +2,7 @@ import React, { useEffect, useRef, useState } from 'react'; import Image from 'next/image'; import { useAudioPlayer } from '@/app/components/AudioPlayerContext'; -import { FaPlay, FaPause, FaVolumeHigh, FaForward, FaBackward } from "react-icons/fa6"; +import { FaPlay, FaPause, FaVolumeHigh, FaForward, FaBackward, FaExpand, FaCompress, FaVolumeXmark } from "react-icons/fa6"; import ColorThief from '@neutrixs/colorthief'; import { Progress } from '@/components/ui/progress'; import { useToast } from '@/hooks/use-toast'; @@ -15,6 +15,8 @@ export const AudioPlayer: React.FC = () => { const [showVolumeSlider, setShowVolumeSlider] = useState(false); const [volume, setVolume] = useState(1); const [isClient, setIsClient] = useState(false); + const [isExpanded, setIsExpanded] = useState(false); + const [isMinimized, setIsMinimized] = useState(false); const audioCurrent = audioRef.current; const { toast } = useToast(); @@ -151,65 +153,187 @@ export const AudioPlayer: React.FC = () => { return `${minutes}:${secs}`; } - if (!isClient) { + if (!isClient || !currentTrack) { return null; } - return ( -
- {currentTrack ? ( -
- {/* Left side - Album art and track info */} -
+ // Mini player (collapsed state) + if (isMinimized) { + return ( +
+
setIsMinimized(false)} + > +
{currentTrack.name} -
-

{currentTrack.name}

-

{currentTrack.artist}

+ +
+
+
+ ); + } + + // Compact floating player (default state) + if (!isExpanded) { + return ( +
+
+
+
+ {currentTrack.name} +
+

{currentTrack.name}

+

{currentTrack.artist}

+
+
+
+ +
- {/* Center - Control buttons and progress bar */} -
- {/* Control buttons */} -
- - - -
- - {/* Progress bar below buttons - full width of this section */} -
- - {formatTime(audioCurrent?.currentTime ?? 0)} - - - - {formatTime(audioCurrent?.duration ?? 0)} - -
+ {/* Control buttons */} +
+ + +
- {/* Right side - Extra space for balance */} -
+ {/* Progress bar */} +
+ + {formatTime(audioCurrent?.currentTime ?? 0)} + + + + {formatTime(audioCurrent?.duration ?? 0)} + +
- ) : ( -
-

No track playing

+
+ ); + } + + // Full expanded player + return ( +
+
+
+

Now Playing

+
+ +
- )} -
); }; \ No newline at end of file diff --git a/app/components/ihateserverside.tsx b/app/components/ihateserverside.tsx index ececeac..27521aa 100644 --- a/app/components/ihateserverside.tsx +++ b/app/components/ihateserverside.tsx @@ -45,16 +45,14 @@ const Ihateserverside: React.FC = ({ children }) => { />
)} -
+
{children}
- {/* Audio Player */} + {/* Floating Audio Player */} {isStatusBarVisible && ( -
- -
+ )}