mymusics

retro MySpace-style music player
Log | Files | Refs | README

PlayerStatus.tsx (772B)


      1 import type { PlaybackPhase } from "../hooks/useMyMusicsPlayback";
      2 
      3 type Props = {
      4   phase: PlaybackPhase;
      5   status: string;
      6   hasTrack: boolean;
      7   compact?: boolean;
      8 };
      9 
     10 export function PlayerStatus({ phase, status, hasTrack, compact }: Props) {
     11   if (phase === "loading" || phase === "buffering") {
     12     return (
     13       <p className={`player-phase${compact ? " player-phase--compact" : ""}`} role="status">
     14         {phase === "loading" ? "Loading track…" : "Buffering from Internet Archive…"}
     15       </p>
     16     );
     17   }
     18   if (status && hasTrack) {
     19     return (
     20       <p className={`hint${compact ? " hint--compact" : ""}`} role="status">
     21         {status}
     22       </p>
     23     );
     24   }
     25   if (!hasTrack && status) {
     26     return <p className="muted">{status}</p>;
     27   }
     28   return null;
     29 }