import { useTranslation } from "react-i18next"; import { Repeat, Repeat1, Shuffle, SkipBack, SkipForward } from "lucide-react"; // Presentational controls for the YouTube modal player (PlayerModal), split out of the god component — // the sibling of plexPlayerControls.tsx. No state or effects here; all behaviour comes in via props. // Persistent playback settings (stored in users.preferences). Auto-advance = what plays when a video // ends; loop = whether it repeats the current video ("one"), wraps the list at its ends ("all"), or // neither ("off"). Both apply to any queued player (feed or playlist). export type AutoMode = "off" | "next" | "prev" | "random"; export type LoopMode = "off" | "one" | "all"; export const AUTO_MODES: AutoMode[] = ["off", "next", "prev", "random"]; export const LOOP_MODES: LoopMode[] = ["off", "one", "all"]; /** The queue transport cluster — prev / counter / next, then the auto-advance and loop mode toggles. * Rendered in two places with identical logic: the modal's queue bar (`variant:"modal"`, normal glass * theme, labels always shown) and the big-view docked control bar (`variant:"docked"`, white-on-dark, * labels hidden until a breakpoint). Only the theme + label-visibility differ; the behaviour is one, * so a mode/icon change lands once. The wrapper (fragment vs. bordered row) stays at the call site. */ export function PlayerTransportControls({ variant, index, queueLength, autoMode, loopMode, onPrev, onNext, onCycleAuto, onCycleLoop, }: { variant: "docked" | "modal"; index: number; queueLength: number; autoMode: AutoMode; loopMode: LoopMode; onPrev: () => void; onNext: () => void; onCycleAuto: () => void; onCycleLoop: () => void; }) { const { t } = useTranslation(); const docked = variant === "docked"; const navBtn = docked ? "inline-flex items-center gap-1 text-white/80 enabled:hover:text-white disabled:opacity-30 transition" : "inline-flex items-center gap-1.5 text-muted enabled:hover:text-fg disabled:opacity-40 transition"; const navLabel = docked ? "hidden sm:inline" : ""; const counter = docked ? "tabular-nums text-white/70" : "text-muted tabular-nums"; const divider = docked ? "h-4 w-px bg-white/20" : "w-px h-4 bg-border"; const toggle = (on: boolean) => docked ? `inline-flex items-center gap-1 rounded-lg px-2 py-1 transition ${ on ? "bg-white/20 text-white" : "text-white/70 hover:bg-white/10 hover:text-white" }` : `inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1 transition ${ on ? "bg-accent/15 text-accent" : "text-muted hover:bg-surface hover:text-fg" }`; const toggleLabel = docked ? "hidden md:inline" : ""; return ( <> {index + 1} / {queueLength} {/* Persistent playback settings — cycle on click, saved to your account. */} ); }