import { useParams, Link } from "react-router"; import { getMatchById, positionLabel, positionIcon, type MatchDetail, type Participant, type Position, type Team, type TierInfo, } from "../mock"; // -- 포지션 배지 -- function PosBadge({ pos, sub }: { pos: Position; sub?: boolean }) { return ( {positionLabel[pos]} ); } // -- 티어 색상 -- function tierColor(tier: string): string { if (tier.startsWith("챌린저")) return "text-amber-400"; if (tier.startsWith("그랜드마스터")) return "text-red-400"; if (tier.startsWith("마스터")) return "text-purple-400"; if (tier.startsWith("다이아")) return "text-cyan-400"; if (tier.startsWith("에메랄드")) return "text-emerald-400"; if (tier.startsWith("플래티넘")) return "text-teal-300"; if (tier.startsWith("골드")) return "text-yellow-400"; if (tier.startsWith("실버")) return "text-gray-300"; return "text-amber-700"; } // -- 티어 셀 (전시즌 / 현재 / 최고) -- function TierCell({ tier }: { tier: TierInfo }) { return (
{tier.previousSeason} → {tier.current} ({tier.peak})
); } // -- 상태 배지 -- function statusBadge(status: MatchDetail["status"]) { switch (status) { case "recruiting": return { label: "모집 중", cls: "bg-green-500/15 text-green-500 border-green-500/20", }; case "team-built": return { label: "팀빌딩 완료", cls: "bg-amber-500/15 text-amber-500 border-amber-500/20", }; case "finished": return { label: "종료", cls: "bg-base-content/8 text-base-content/40 border-base-content/10", }; } } // -- 참가자 행 -- function ParticipantRow({ p, index, assignedPos, }: { p: Participant; index: number; assignedPos?: Position; }) { return ( {index + 1}
{p.summonerName} #{p.tag}
{assignedPos ? ( ) : ( <> )} ); } // -- 참가자 테이블 (팀빌딩 전) -- function ParticipantTable({ participants }: { participants: Participant[] }) { return (
{participants.map((p, i) => ( ))}
# 소환사 전 시즌 → 현재 (최고) 주 포지션 부 포지션
); } // -- 팀 카드 (팀빌딩 후) -- function TeamCard({ team, side, isWinner, }: { team: Team; side: "blue" | "red"; isWinner?: boolean; }) { const borderColor = side === "blue" ? "border-blue-500/25" : "border-red-500/25"; const headerBg = side === "blue" ? "bg-blue-500/8" : "bg-red-500/8"; const sideColor = side === "blue" ? "text-blue-400" : "text-red-400"; const accentBar = side === "blue" ? "bg-blue-500" : "bg-red-500"; return (
{team.name} {isWinner && ( WIN )}
{team.participants.map((p, i) => ( ))}
# 소환사 전 시즌 → 현재 (최고) 포지션
); } // -- 사이드바 카드 -- function SideCard({ title, children, }: { title: string; children: React.ReactNode; }) { return (

{title}

{children}
); } // -- 메인 -- export default function MatchDetailPage() { const { id } = useParams(); const match = getMatchById(Number(id)); if (!match) { return (

내전을 찾을 수 없습니다

홈으로 돌아가기
); } const si = statusBadge(match.status); return (
{/* 뒤로가기 */} 목록으로 {/* 헤더 */}

{match.title}

{si.label}

{match.description}

{match.date} {match.time} | {match.participants.length}/{match.maxParticipants}명 | {match.map}
{/* 결과 배너 (종료된 경우) */} {match.status === "finished" && match.result && (
{match.result.blueScore}
블루팀
VS
{match.result.redScore}
레드팀
{match.result.winner} 승리
)}
{/* 좌측: 참가자 / 팀 */}
{match.status === "recruiting" ? (

참가자 ({match.participants.length}/{match.maxParticipants})

{match.participants.length < match.maxParticipants && (
{match.maxParticipants - match.participants.length}자리 남음
)}
) : (
{match.teams?.map((team, i) => ( ))}
)}
{/* 우측: 사이드바 */}
{/* 일정 */} {match.schedule && match.schedule.length > 0 && (
    {match.schedule.map((s, i) => (
  • {s.time} {s.label}
  • ))}
)} {/* 상품 */} {match.prizes && match.prizes.length > 0 && (
    {match.prizes.map((prize, i) => (
  • ▸ {prize}
  • ))}
)} {/* 안내사항 */} {match.notices && match.notices.length > 0 && (
    {match.notices.map((notice, i) => (
  • • {notice}
  • ))}
)}
); }