From efefbcec3dd4b006217b078066c0b903cfc505af Mon Sep 17 00:00:00 2001 From: "soroush.asadi" Date: Thu, 11 Jun 2026 17:23:26 +0330 Subject: [PATCH] Lobby: leagues are play buttons w/ arrow; remove background music feature - OnlineLobbyScreen: each league row is now a tappable play button (queues a ranked match at that league's stake) with a forward arrow; the cheapest enterable league is highlighted gold. Drops the redundant separate "ranked random" CTA and the select-then-play step. - Remove the background-music feature entirely: deleted the floating MusicToggle, the TopBar music button, and the Profile audio music toggle + style picker. sound.startMusic() is now an inert no-op so music never plays (sfx unchanged). Co-Authored-By: Claude Opus 4.8 --- src/components/online/MusicToggle.tsx | 38 ----- src/components/online/TopBar.tsx | 20 +-- src/components/screens/OnlineLobbyScreen.tsx | 140 ++++++++----------- src/components/screens/ProfileScreen.tsx | 27 +--- src/lib/sound.ts | 39 +----- 5 files changed, 66 insertions(+), 198 deletions(-) delete mode 100644 src/components/online/MusicToggle.tsx diff --git a/src/components/online/MusicToggle.tsx b/src/components/online/MusicToggle.tsx deleted file mode 100644 index 89767af..0000000 --- a/src/components/online/MusicToggle.tsx +++ /dev/null @@ -1,38 +0,0 @@ -"use client"; - -import { Music } from "lucide-react"; -import { useSoundStore } from "@/lib/sound-store"; -import { useUIStore } from "@/lib/ui-store"; -import { useI18n } from "@/lib/i18n"; - -/** - * Always-available music mute toggle (enable/disable from anywhere). Floats in a - * corner on every screen except the game table, which has its own audio control - * in its HUD. - */ -export function MusicToggle() { - const { t } = useI18n(); - const music = useSoundStore((s) => s.music); - const toggleMusic = useSoundStore((s) => s.toggleMusic); - const screen = useUIStore((s) => s.screen); - - if (screen === "game") return null; - - return ( - - ); -} diff --git a/src/components/online/TopBar.tsx b/src/components/online/TopBar.tsx index 07aa05b..1cab8ec 100644 --- a/src/components/online/TopBar.tsx +++ b/src/components/online/TopBar.tsx @@ -1,8 +1,7 @@ "use client"; -import { Bell, Crown, Gift, Music, Store } from "lucide-react"; +import { Bell, Crown, Gift, Store } from "lucide-react"; import { useSessionStore } from "@/lib/session-store"; -import { useSoundStore } from "@/lib/sound-store"; import { useUIStore } from "@/lib/ui-store"; import { useNotifStore } from "@/lib/notification-store"; import { useI18n } from "@/lib/i18n"; @@ -15,8 +14,6 @@ export function TopBar() { const go = useUIStore((s) => s.go); const openDaily = useUIStore((s) => s.openDaily); const unread = useNotifStore((s) => s.unread); - const music = useSoundStore((s) => s.music); - const toggleMusic = useSoundStore((s) => s.toggleMusic); const { t } = useI18n(); if (!profile) return null; @@ -54,21 +51,6 @@ export function TopBar() {
- - ); - })} -
- {!lockedLeague && coins < entry && ( -

{t("lobby.needCoins")}

- )} + + + )} + + ); + })} - - - - - - - {t("lobby.random")} - {t("lobby.randomDesc")} - - - {entry} - - - ); } diff --git a/src/components/screens/ProfileScreen.tsx b/src/components/screens/ProfileScreen.tsx index dda4ea6..913cf3d 100644 --- a/src/components/screens/ProfileScreen.tsx +++ b/src/components/screens/ProfileScreen.tsx @@ -1,7 +1,7 @@ "use client"; import { motion } from "framer-motion"; -import { Check, ChevronLeft, Crown, Eye, EyeOff, Lock, LogOut, Music, Pencil, Star, Upload, Users, Volume2 } from "lucide-react"; +import { Check, ChevronLeft, Crown, Eye, EyeOff, Lock, LogOut, Pencil, Star, Upload, Users, Volume2 } from "lucide-react"; import { useRef, useState } from "react"; import { ScreenHeader, ScreenShell } from "@/components/online/ScreenHeader"; import { RankBadge } from "@/components/online/RankBadge"; @@ -509,34 +509,11 @@ function SocialSettings() { function SoundSettings() { const { t } = useI18n(); - const { sfx, music, musicTrack, toggleSfx, toggleMusic, setMusicTrack } = useSoundStore(); - const tracks = [ - { id: "santoor" as const, label: t("settings.trackSantoor") }, - { id: "playful" as const, label: t("settings.trackPlayful") }, - ]; + const { sfx, toggleSfx } = useSoundStore(); return (

{t("settings.audio")}

} label={t("settings.sound")} on={sfx} onClick={toggleSfx} /> - } label={t("settings.music")} on={music} onClick={toggleMusic} /> - {/* music style picker */} -
-
{t("settings.musicStyle")}
-
- {tracks.map((tr) => ( - - ))} -
-
); } diff --git a/src/lib/sound.ts b/src/lib/sound.ts index 009f1d0..1d51369 100644 --- a/src/lib/sound.ts +++ b/src/lib/sound.ts @@ -210,43 +210,8 @@ class SoundManager { }, }; - startMusic() { - if (!this.musicEnabled || this.musicTimer || !this.ctx || !this.musicGain) return; - const playNote = () => { - if (!this.ctx || !this.musicGain) return; - const cfg = this.TRACKS[this.musicTrack]; - const freq = cfg.notes[this.step % cfg.notes.length]; - this.step++; - const osc = this.ctx.createOscillator(); - const g = this.ctx.createGain(); - const t = this.ctx.currentTime; - osc.type = cfg.type; - osc.frequency.value = freq; - g.gain.setValueAtTime(0.0001, t); - g.gain.exponentialRampToValueAtTime(cfg.peak, t + cfg.attack); - g.gain.exponentialRampToValueAtTime(0.0001, t + cfg.dur); - osc.connect(g); - g.connect(this.musicGain); - osc.start(t); - osc.stop(t + cfg.dur + 0.1); - // soft fifth harmony (santoor) every other note - if (cfg.fifth && this.step % 2 === 0) { - const o2 = this.ctx.createOscillator(); - const g2 = this.ctx.createGain(); - o2.type = "sine"; - o2.frequency.value = freq * 1.5; - g2.gain.setValueAtTime(0.0001, t); - g2.gain.exponentialRampToValueAtTime(0.22, t + 0.3); - g2.gain.exponentialRampToValueAtTime(0.0001, t + 1.4); - o2.connect(g2); - g2.connect(this.musicGain); - o2.start(t); - o2.stop(t + 1.5); - } - }; - playNote(); - this.musicTimer = setInterval(playNote, this.TRACKS[this.musicTrack].gap); - } + /** Background music was removed from the game — these are inert no-ops. */ + startMusic() {} stopMusic() { if (this.musicTimer) {