AeThex-OS/client/src/os/apps/MusicApp.tsx

52 lines
2.8 KiB
TypeScript

import { useState } from 'react';
import { Music, Play, Pause, ChevronUp } from 'lucide-react';
export function MusicApp() {
const [isPlaying, setIsPlaying] = useState(false);
const [currentTrack, setCurrentTrack] = useState(0);
const tracks = [
{ name: "Neon Dreams", artist: "Synth Collective", duration: "3:42" },
{ name: "Digital Rain", artist: "Matrix OST", duration: "4:15" },
{ name: "Architect's Theme", artist: "AeThex Audio", duration: "5:01" },
];
return (
<div className="min-h-full p-3 md:p-4 bg-gradient-to-b from-purple-950/50 to-slate-950 flex flex-col">
<div className="text-center mb-4">
<div className="w-20 h-20 mx-auto bg-gradient-to-br from-purple-500 to-pink-600 rounded-lg flex items-center justify-center mb-3">
<Music className="w-10 h-10 text-white" />
</div>
<div className="text-white font-mono text-sm">{tracks[currentTrack].name}</div>
<div className="text-white/50 text-xs">{tracks[currentTrack].artist}</div>
</div>
<div className="flex items-center justify-center gap-4 mb-4">
<button onClick={() => setCurrentTrack((currentTrack - 1 + tracks.length) % tracks.length)} className="p-2 text-white/60 hover:text-white transition-colors">
<ChevronUp className="w-5 h-5 rotate-[270deg]" />
</button>
<button onClick={() => setIsPlaying(!isPlaying)} className="w-12 h-12 bg-purple-500 hover:bg-purple-400 rounded-full flex items-center justify-center transition-colors">
{isPlaying ? <Pause className="w-5 h-5 text-white" /> : <Play className="w-5 h-5 text-white ml-0.5" />}
</button>
<button onClick={() => setCurrentTrack((currentTrack + 1) % tracks.length)} className="p-2 text-white/60 hover:text-white transition-colors">
<ChevronUp className="w-5 h-5 rotate-90" />
</button>
</div>
<div className="flex-1 overflow-auto">
{tracks.map((track, i) => (
<button key={i} onClick={() => { setCurrentTrack(i); setIsPlaying(true); }} className={`w-full flex items-center gap-3 p-2 rounded hover:bg-white/10 transition-colors text-left ${i === currentTrack ? 'bg-white/10' : ''}`}>
<div className="w-8 h-8 bg-purple-500/20 rounded flex items-center justify-center">
<Music className="w-4 h-4 text-purple-400" />
</div>
<div className="flex-1 min-w-0">
<div className="text-white text-sm truncate">{track.name}</div>
<div className="text-white/50 text-xs truncate">{track.artist}</div>
</div>
<div className="text-white/30 text-xs">{track.duration}</div>
</button>
))}
</div>
<div className="mt-2 p-2 bg-white/5 rounded text-center text-white/40 text-xs">Audio playback simulated</div>
</div>
);
}