diff --git a/frontend/public/audio/BEAR ATTACK.mp3 b/frontend/public/audio/BEAR ATTACK.mp3 new file mode 100644 index 0000000..d87c1ac Binary files /dev/null and b/frontend/public/audio/BEAR ATTACK.mp3 differ diff --git a/frontend/public/audio/Bearz Day.mp3 b/frontend/public/audio/Bearz Day.mp3 new file mode 100644 index 0000000..bc53a7f Binary files /dev/null and b/frontend/public/audio/Bearz Day.mp3 differ diff --git a/frontend/public/audio/잠실 G-Thang.mp3 b/frontend/public/audio/잠실 G-Thang.mp3 new file mode 100644 index 0000000..2b74059 Binary files /dev/null and b/frontend/public/audio/잠실 G-Thang.mp3 differ diff --git a/frontend/public/audio/잠실의 곰들.mp3 b/frontend/public/audio/잠실의 곰들.mp3 new file mode 100644 index 0000000..a0ed80d Binary files /dev/null and b/frontend/public/audio/잠실의 곰들.mp3 differ diff --git a/frontend/src/components/MusicBar.tsx b/frontend/src/components/MusicBar.tsx index 9c25ae1..dadd026 100644 --- a/frontend/src/components/MusicBar.tsx +++ b/frontend/src/components/MusicBar.tsx @@ -3,7 +3,7 @@ import { useLocation } from "react-router-dom"; import { usePlayer } from "@/lib/usePlayer"; import { useLang } from "@/lib/useLang"; import { dict } from "@/lib/i18n"; -import { VISIBLE_PATHS, PATH_PLAYLISTS } from "@/lib/playlist"; +import { getTracksForPath } from "@/lib/playlist"; // --------------------------------------------------------------------------- // 시간 포맷 @@ -147,18 +147,12 @@ export default function MusicBar() { // 경로가 바뀌면 해당 경로의 플레이리스트 로드, 없으면 초기화 useEffect(() => { - const tracks = PATH_PLAYLISTS[pathname]; - loadPlaylist(tracks ?? []); + loadPlaylist(getTracksForPath(pathname)); }, [pathname, loadPlaylist]); if (!hasTrack) return null; - if (VISIBLE_PATHS.length > 0) { - const visible = VISIBLE_PATHS.some( - (p: string) => pathname === p || pathname.startsWith(p) - ); - if (!visible) return null; - } + if (getTracksForPath(pathname).length === 0) return null; const handleProgressClick = (e: React.MouseEvent) => { const rect = e.currentTarget.getBoundingClientRect(); diff --git a/frontend/src/lib/playlist.ts b/frontend/src/lib/playlist.ts index 93184e6..2dcd161 100644 --- a/frontend/src/lib/playlist.ts +++ b/frontend/src/lib/playlist.ts @@ -27,5 +27,19 @@ export const PATH_PLAYLISTS: Record = { ], }; -// VISIBLE_PATHS — PATH_PLAYLISTS 키에서 자동 도출 (직접 수정 불필요) -export const VISIBLE_PATHS: string[] = Object.keys(PATH_PLAYLISTS); +// 두산 베어스 응원가 — 특정 경기가 아니라 두산(OB) 전 경기 공통 적용 +const DOOSAN_TRACKS: Track[] = [ + { title: "잠실의 곰들", artist: "aio2o", src: "/audio/잠실의 곰들.mp3" }, + { title: "BEAR ATTACK", artist: "aio2o", src: "/audio/BEAR ATTACK.mp3" }, + { title: "잠실 G-Thang", artist: "aio2o", src: "/audio/잠실 G-Thang.mp3" }, + { title: "Bearz Day", artist: "aio2o", src: "/audio/Bearz Day.mp3" }, +]; + +// 경로 → 트랙 목록. 정확일치(PATH_PLAYLISTS) 우선, 그 외 KBO 두산 경기 +// (match_id 'KBO_{팀A}_{팀B}_{YYYYMMDD}' 에 OB 포함)면 두산 플레이리스트. +export function getTracksForPath(pathname: string): Track[] { + const exact = PATH_PLAYLISTS[pathname]; + if (exact) return exact; + if (/^\/match\/KBO_(OB_[A-Z]+|[A-Z]+_OB)_\d{8}$/.test(pathname)) return DOOSAN_TRACKS; + return []; +}