Make shuffle reorder and restore the play queue, add off/all/one repeat playback, and remove Resonant Radio UI.

Hop-State: A_06FNNZKG8MKNEJA6QXQ1ZER
Hop-Proposal: R_06FNNZJMKS1Z9RBS9ADD3ER
Hop-Task: T_06FNNXTJEGA5TEAZ2GA55X0
Hop-Attempt: AT_06FNNXTJEHPH9SQPGKC0P9G
This commit is contained in:
2026-07-13 03:20:52 -07:00
committed by Hop
parent f34266b704
commit a4b66954bd
6 changed files with 274 additions and 44 deletions
+18
View File
@@ -0,0 +1,18 @@
export type RepeatMode = "off" | "all" | "one";
export function nextRepeatMode(mode: RepeatMode): RepeatMode {
if (mode === "off") return "all";
if (mode === "all") return "one";
return "off";
}
export function shuffleTracks<T>(items: readonly T[], random: () => number = Math.random): T[] {
const shuffled = [...items];
for (let index = shuffled.length - 1; index > 0; index -= 1) {
const swapIndex = Math.floor(random() * (index + 1));
[shuffled[index], shuffled[swapIndex]] = [shuffled[swapIndex], shuffled[index]];
}
return shuffled;
}