두산 응원가 4곡 추가 — KBO 두산(OB) 전 경기 플레이리스트

경로 정확일치 방식은 경기 날짜마다 등록이 필요해, 두산 경기
(match_id 에 OB 포함)면 공통 플레이리스트를 반환하는 리졸버로 확장.
월드컵 경기별 목록(PATH_PLAYLISTS)은 기존대로 우선 적용.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
jwkim 2026-08-19 11:21:36 +09:00
parent 22e2e8c29c
commit d97023629e
6 changed files with 19 additions and 11 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -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<HTMLDivElement>) => {
const rect = e.currentTarget.getBoundingClientRect();

View File

@ -27,5 +27,19 @@ export const PATH_PLAYLISTS: Record<string, Track[]> = {
],
};
// 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 [];
}