From fccf3c5d1393ec741d555e6db1cab75adb415bfb Mon Sep 17 00:00:00 2001 From: angel Date: Wed, 23 Jul 2025 05:50:01 +0000 Subject: [PATCH] feat: enhance FullScreenPlayer with improved lyric scrolling and background styling for mobile --- app/components/BottomNavigation.tsx | 2 +- app/components/FullScreenPlayer.tsx | 94 +++++++++++++++++++---------- 2 files changed, 62 insertions(+), 34 deletions(-) diff --git a/app/components/BottomNavigation.tsx b/app/components/BottomNavigation.tsx index 6308e92..5e3038b 100644 --- a/app/components/BottomNavigation.tsx +++ b/app/components/BottomNavigation.tsx @@ -34,7 +34,7 @@ export function BottomNavigation() { return (
-
+
{navigationItems.map((item) => { const isItemActive = isActive(item.href); const Icon = item.icon; diff --git a/app/components/FullScreenPlayer.tsx b/app/components/FullScreenPlayer.tsx index 075e70c..4bb780f 100644 --- a/app/components/FullScreenPlayer.tsx +++ b/app/components/FullScreenPlayer.tsx @@ -103,7 +103,10 @@ export const FullScreenPlayer: React.FC = ({ isOpen, onCl // Auto-scroll lyrics using lyricsRef useEffect(() => { - if (currentLyricIndex >= 0 && lyrics.length > 0 && showLyrics && lyricsRef.current) { + // Only auto-scroll if lyrics are visible + const shouldScroll = isMobile ? (activeTab === 'lyrics' && lyrics.length > 0) : (showLyrics && lyrics.length > 0); + + if (currentLyricIndex >= 0 && shouldScroll && lyricsRef.current) { const scrollTimeout = setTimeout(() => { // Find the ScrollArea viewport const scrollViewport = lyricsRef.current?.querySelector('[data-radix-scroll-area-viewport]') as HTMLElement; @@ -126,11 +129,13 @@ export const FullScreenPlayer: React.FC = ({ isOpen, onCl return () => clearTimeout(scrollTimeout); } - }, [currentLyricIndex, showLyrics, lyrics.length]); + }, [currentLyricIndex, showLyrics, lyrics.length, isMobile, activeTab]); // Reset lyrics to top when song changes useEffect(() => { - if (currentTrack && showLyrics && lyricsRef.current) { + const shouldReset = isMobile ? (activeTab === 'lyrics' && lyrics.length > 0) : (showLyrics && lyrics.length > 0); + + if (currentTrack && shouldReset && lyricsRef.current) { // Reset scroll position using lyricsRef const resetScroll = () => { const scrollViewport = lyricsRef.current?.querySelector('[data-radix-scroll-area-viewport]') as HTMLElement; @@ -151,7 +156,7 @@ export const FullScreenPlayer: React.FC = ({ isOpen, onCl return () => clearTimeout(resetTimeout); } - }, [currentTrack?.id, showLyrics, currentTrack]); // Only reset when track ID changes + }, [currentTrack?.id, showLyrics, currentTrack, isMobile, activeTab, lyrics.length]); // Only reset when track ID changes // Sync with main audio player (improved responsiveness) useEffect(() => { @@ -283,24 +288,50 @@ export const FullScreenPlayer: React.FC = ({ isOpen, onCl return (
- {/* Blurred background image */} + {/* Enhanced Blurred background image */} {currentTrack.coverArt && ( -
+
+ {/* Main background */} +
+ {/* Top gradient blur for mobile */} +
+ {/* Bottom gradient blur for mobile */} +
+
)} {/* Overlay for better contrast */} -
-
+
+ +
{/* Mobile Close Handle */} {isMobile && ( @@ -347,15 +378,15 @@ export const FullScreenPlayer: React.FC = ({ isOpen, onCl
{activeTab === 'player' && (
- {/* Smaller Album Art */} + {/* Mobile Album Art */}
{currentTrack.album} @@ -535,38 +566,35 @@ export const FullScreenPlayer: React.FC = ({ isOpen, onCl
{/* Mobile Tab Bar */} -
-
+
+
{lyrics.length > 0 && ( )}