import { View, Text, TouchableOpacity, PanResponder } from 'react-native' import { useRouter } from 'expo-router' import { useState, useCallback } from 'react' import { usePlayerStore } from '../src/store/playerStore' export default function NowPlayingScreen() { const router = useRouter() const currentSong = usePlayerStore(s => s.currentSong) const isPlaying = usePlayerStore(s => s.isPlaying) const progress = usePlayerStore(s => s.progress) const togglePlay = usePlayerStore(s => s.togglePlay) const toggleShuffle = usePlayerStore(s => s.toggleShuffle) const next = usePlayerStore(s => s.next) const previous = usePlayerStore(s => s.previous) const seek = usePlayerStore(s => s.seek) const shuffle = usePlayerStore(s => s.shuffle) const progressPercent = currentSong ? (progress / currentSong.duration) * 100 : 0 const panResponder = PanResponder.create({ onStartShouldSetPanResponder: () => true, onMoveShouldSetPanResponder: () => true, onPanResponderMove: (evt) => { if (!currentSong) return const x = evt.nativeEvent.locationX const ratio = Math.max(0, Math.min(x / 375, 1)) seek(currentSong.duration * ratio) }, }) return ( router.back()} className="self-start"> 🎵 {currentSong?.title || 'No song'} {currentSong?.artist} {formatTime(progress)} {currentSong ? formatTime(currentSong.duration) : '0:00'} 🔀 ⏮️ {isPlaying ? '⏸' : '▶️'} ⏭️ router.push('/shareplay' as any)}> 📢 Speaker ) } function formatTime(sec: number): string { const m = Math.floor(sec / 60) const s = Math.floor(sec % 60) return `${m}:${s.toString().padStart(2, '0')}` }