feat(web): refresh the app with Astryx and coral branding
This commit is contained in:
1 parent
f649490cd2
commit
da7b502936
140 files changed
+4531
-2368
No files matched your search
@@ -1,7 +1,18 @@
|
||||
import { lazy, Suspense, useState } from "react";
|
||||
import { useQueryClient } from "@tanstack/react-query";
|
||||
import { ChevronDown, ChevronUp } from "lucide-react";
|
||||
import { Link, useLocation, useParams, useSearchParams } from "react-router";
|
||||
import { ChevronDown, ChevronUp, RefreshCw, X } from "lucide-react";
|
||||
import { useLocation, useParams, useSearchParams } from "react-router";
|
||||
import {
|
||||
Chip,
|
||||
EmptyNote,
|
||||
ErrorNote,
|
||||
MetaDot,
|
||||
PageBody,
|
||||
PageHero,
|
||||
Panel,
|
||||
PanelHeader,
|
||||
PlainPage,
|
||||
} from "../ui";
|
||||
import {
|
||||
useChampionStats,
|
||||
useDdragonManifest,
|
||||
@@ -52,6 +63,7 @@ import {
|
||||
RuneStyleIcon,
|
||||
SummonerSpellIcon,
|
||||
} from "../components/ItemTooltip";
|
||||
import { Btn } from "../ui/Btn";
|
||||
// recharts가 무거워 메인 번들에서 분리한다 (전적 페이지에서만 로드).
|
||||
const TierHistoryChart = lazy(() => import("../components/TierHistoryChart"));
|
||||
|
||||
@@ -128,18 +140,18 @@ function formatRefreshError(error: unknown) {
|
||||
}
|
||||
|
||||
function ratioClass(value: number) {
|
||||
if (value >= 55) return "text-blue-400";
|
||||
if (value >= 50) return "text-amber-400";
|
||||
return "text-base-content/50";
|
||||
if (value >= 60) return "text-loss";
|
||||
if (value >= 50) return "text-win";
|
||||
return "text-content-muted";
|
||||
}
|
||||
|
||||
function kdaClass(value: number) {
|
||||
if (value >= 4) return "text-amber-400";
|
||||
if (value >= 3) return "text-emerald-400";
|
||||
return "text-base-content/60";
|
||||
if (value >= 5) return "text-gold";
|
||||
if (value >= 3) return "text-leaf";
|
||||
return "text-content-muted";
|
||||
}
|
||||
|
||||
function FilterButton({
|
||||
function QueueTab({
|
||||
active,
|
||||
children,
|
||||
onClick,
|
||||
@@ -151,11 +163,13 @@ function FilterButton({
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
role="tab"
|
||||
aria-selected={active}
|
||||
onClick={onClick}
|
||||
className={`px-3 py-2 text-xs font-semibold border-b-2 transition-colors ${
|
||||
className={`h-10 flex-none whitespace-nowrap rounded-[10px] px-4 text-sm font-bold transition-colors ${
|
||||
active
|
||||
? "border-primary text-primary bg-primary/5"
|
||||
: "border-transparent text-base-content/45 hover:text-base-content"
|
||||
? "bg-secondary text-secondary-content dark:bg-white dark:text-[#14161b]"
|
||||
: "text-content-muted hover:bg-sunken hover:text-content"
|
||||
}`}
|
||||
>
|
||||
{children}
|
||||
@@ -206,20 +220,22 @@ function SummaryCard({
|
||||
label,
|
||||
value,
|
||||
sub,
|
||||
valueClassName = "text-content",
|
||||
}: {
|
||||
label: string;
|
||||
value: React.ReactNode;
|
||||
sub?: React.ReactNode;
|
||||
valueClassName?: string;
|
||||
}) {
|
||||
return (
|
||||
<div className="border border-base-content/8 bg-base-100 p-4">
|
||||
<div className="text-xs font-bold uppercase tracking-wider text-base-content/30">
|
||||
{label}
|
||||
</div>
|
||||
<div className="mt-2 text-2xl font-bold text-base-content tabular-nums">
|
||||
<div className="px-4 py-3.5 sm:px-5">
|
||||
<div className="text-xs font-semibold text-content-subtle">{label}</div>
|
||||
<div
|
||||
className={`tabular mt-1 text-[22px] font-extrabold leading-tight ${valueClassName}`}
|
||||
>
|
||||
{value}
|
||||
</div>
|
||||
{sub && <div className="mt-1 text-xs text-base-content/40">{sub}</div>}
|
||||
{sub && <div className="tabular mt-0.5 text-xs text-content-muted">{sub}</div>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -293,8 +309,8 @@ function ChampionStatsTable({
|
||||
{row.games}
|
||||
</td>
|
||||
<td className="px-3 py-3 text-center text-xs tabular-nums text-base-content/55">
|
||||
<span className="text-blue-400">{row.wins}</span> /{" "}
|
||||
<span className="text-red-400">{row.losses}</span>
|
||||
<span className="text-win">{row.wins}</span> /{" "}
|
||||
<span className="text-loss">{row.losses}</span>
|
||||
</td>
|
||||
<td
|
||||
className={`px-3 py-3 text-center text-sm font-bold tabular-nums ${kdaClass(row.kda)}`}
|
||||
@@ -522,8 +538,8 @@ function DetailStatBar({
|
||||
|
||||
function TeamHeader({ team }: { team: ApiRecentMatchTeam }) {
|
||||
const sideLabel = team.side === 100 ? "블루팀" : "레드팀";
|
||||
const sideClass = team.side === 100 ? "text-blue-400" : "text-red-400";
|
||||
const resultClass = team.win ? "text-blue-400" : "text-red-400";
|
||||
const sideClass = team.side === 100 ? "text-win" : "text-loss";
|
||||
const resultClass = team.win ? "text-win" : "text-loss";
|
||||
|
||||
return (
|
||||
<div className="px-3 py-1.5 flex flex-wrap items-center justify-between gap-2 border-b border-base-content/10">
|
||||
@@ -639,7 +655,7 @@ function ParticipantRow({
|
||||
<div className="font-bold text-base-content">
|
||||
{participant.kills}
|
||||
<span className="text-base-content/25"> / </span>
|
||||
<span className="text-red-400">{participant.deaths}</span>
|
||||
<span className="text-loss">{participant.deaths}</span>
|
||||
<span className="text-base-content/25"> / </span>
|
||||
{participant.assists}
|
||||
</div>
|
||||
@@ -862,16 +878,34 @@ function RecentMatchCard({
|
||||
const [expanded, setExpanded] = useState(false);
|
||||
const championName =
|
||||
championDisplayName(manifest, match.championId) ?? String(match.championId);
|
||||
const accent = match.win ? "border-l-blue-500" : "border-l-red-500";
|
||||
const resultClass = match.win ? "text-blue-400" : "text-red-400";
|
||||
const outcome = match.remake ? "remake" : match.win ? "win" : "loss";
|
||||
const surface = {
|
||||
win: "border-win-line bg-win-tint",
|
||||
loss: "border-loss-line bg-loss-tint",
|
||||
remake: "border-line bg-card",
|
||||
}[outcome];
|
||||
const bar = { win: "bg-win", loss: "bg-loss", remake: "bg-content-disabled" }[
|
||||
outcome
|
||||
];
|
||||
const resultClass = {
|
||||
win: "text-win",
|
||||
loss: "text-loss",
|
||||
remake: "text-content-muted",
|
||||
}[outcome];
|
||||
const toggleSurface = {
|
||||
win: "lg:bg-win/15 lg:text-win",
|
||||
loss: "lg:bg-loss/15 lg:text-loss",
|
||||
remake: "lg:bg-sunken-strong",
|
||||
}[outcome];
|
||||
|
||||
return (
|
||||
<article
|
||||
className={`border border-l-4 ${accent} border-base-content/10 bg-base-100`}
|
||||
className={`relative overflow-hidden rounded-box border ${surface}`}
|
||||
>
|
||||
<div className="p-3 grid lg:grid-cols-[120px_1fr_120px_1.5fr_40px] gap-3 items-center">
|
||||
<span aria-hidden="true" className={`absolute inset-y-0 left-0 w-1.5 ${bar}`} />
|
||||
<div className="grid items-center gap-3 py-3 pl-5 pr-3 lg:grid-cols-[112px_1fr_120px_1.5fr_36px] lg:pr-0">
|
||||
<div className="text-center lg:text-left">
|
||||
<div className={`text-sm font-bold ${resultClass}`}>
|
||||
<div className={`text-sm font-extrabold ${resultClass}`}>
|
||||
{match.remake ? "다시하기" : match.win ? "승리" : "패배"}
|
||||
</div>
|
||||
<div className="text-xs font-bold text-base-content/45 mt-1">
|
||||
@@ -912,7 +946,7 @@ function RecentMatchCard({
|
||||
<div className="text-lg font-bold tabular-nums">
|
||||
<span>{match.kills}</span>
|
||||
<span className="text-base-content/25"> / </span>
|
||||
<span className="text-red-400">{match.deaths}</span>
|
||||
<span className="text-loss">{match.deaths}</span>
|
||||
<span className="text-base-content/25"> / </span>
|
||||
<span>{match.assists}</span>
|
||||
</div>
|
||||
@@ -964,11 +998,11 @@ function RecentMatchCard({
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex justify-end">
|
||||
<div className="flex justify-end lg:-my-3 lg:self-stretch">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setExpanded((current) => !current)}
|
||||
className="flex h-10 w-full items-center justify-center gap-1 border border-base-content/10 text-base-content/35 transition-colors hover:text-base-content/70 sm:w-auto sm:px-3 lg:h-14 lg:w-8 lg:border-0 lg:px-0"
|
||||
className={`flex h-10 w-full items-center justify-center gap-1 rounded-field border border-line-strong bg-card text-content-muted transition-colors hover:text-content sm:w-auto sm:px-3 lg:h-full lg:w-9 lg:rounded-none lg:border-0 lg:px-0 ${toggleSurface}`}
|
||||
aria-expanded={expanded}
|
||||
aria-label={expanded ? "상세 전적 접기" : "상세 전적 펼치기"}
|
||||
>
|
||||
@@ -984,7 +1018,7 @@ function RecentMatchCard({
|
||||
</div>
|
||||
</div>
|
||||
{expanded && (
|
||||
<div className="border-t border-base-content/10 bg-base-200/30">
|
||||
<div className="border-t border-line bg-card">
|
||||
<MatchDetailTabs
|
||||
match={match}
|
||||
manifest={manifest}
|
||||
@@ -1098,6 +1132,7 @@ export default function UserHistoryPage() {
|
||||
const [refreshResult, setRefreshResult] =
|
||||
useState<ApiEnqueueRefreshResult | null>(null);
|
||||
const [refreshNotice, setRefreshNotice] = useState<string | null>(null);
|
||||
const view = searchParams.get("view") === "champions" ? "champions" : "matches";
|
||||
const queueGroupParam = searchParams.get("queueGroup");
|
||||
const rankParam = searchParams.get("rank");
|
||||
const queueGroup: RiotQueueGroup = isRiotQueueGroup(queueGroupParam)
|
||||
@@ -1292,7 +1327,7 @@ export default function UserHistoryPage() {
|
||||
if (!DEFAULT_COMMUNITY_ID) {
|
||||
return (
|
||||
<main className="max-w-6xl mx-auto px-4 py-20 text-center">
|
||||
<span className="text-sm text-amber-600">
|
||||
<span className="text-sm text-gold">
|
||||
`VITE_DEFAULT_COMMUNITY_ID` 설정이 필요합니다.
|
||||
</span>
|
||||
</main>
|
||||
@@ -1305,12 +1340,17 @@ export default function UserHistoryPage() {
|
||||
|
||||
if (profileQuery.error || !profile) {
|
||||
return (
|
||||
<main className="max-w-6xl mx-auto px-4 py-20 text-center">
|
||||
<h2 className="text-lg font-bold mb-2">소환사를 찾을 수 없습니다</h2>
|
||||
<Link to="/" className="btn btn-ghost btn-sm mt-4">
|
||||
홈으로 돌아가기
|
||||
</Link>
|
||||
</main>
|
||||
<PlainPage>
|
||||
<EmptyNote
|
||||
title="소환사를 찾을 수 없습니다"
|
||||
description="계정 연결이 해제됐거나 잘못된 주소일 수 있습니다."
|
||||
action={
|
||||
<Btn to="/" variant="secondary">
|
||||
내전 목록으로
|
||||
</Btn>
|
||||
}
|
||||
/>
|
||||
</PlainPage>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1319,212 +1359,266 @@ export default function UserHistoryPage() {
|
||||
Boolean(refreshNotice?.startsWith("갱신 실패"));
|
||||
|
||||
return (
|
||||
<main className="max-w-6xl mx-auto px-4 sm:px-6 py-6">
|
||||
<Link
|
||||
to={backTo}
|
||||
className="inline-flex items-center gap-1 text-xs text-base-content/40 hover:text-base-content transition-colors mb-6"
|
||||
>
|
||||
← 이전으로
|
||||
</Link>
|
||||
|
||||
<section className="border border-base-content/10 bg-base-100 p-6 mb-6">
|
||||
<div className="flex flex-col sm:flex-row sm:items-center gap-4">
|
||||
<div className="w-16 h-16 bg-base-content/10 overflow-hidden shrink-0">
|
||||
<>
|
||||
<PageHero
|
||||
width="xl"
|
||||
crumbs={[{ label: "이전 화면", to: backTo }, { label: "소환사 전적" }]}
|
||||
media={
|
||||
<div className="relative shrink-0">
|
||||
<img
|
||||
src={profileIconUrl(ddragon, profile.profileIconId)}
|
||||
alt=""
|
||||
className="w-full h-full object-cover"
|
||||
className="size-[72px] rounded-2xl bg-ink-raised object-cover ring-2 ring-white/15 sm:size-[88px]"
|
||||
/>
|
||||
<span className="tabular absolute -bottom-2 left-1/2 -translate-x-1/2 rounded-full bg-ink-raised px-2 py-0.5 text-[11px] font-bold text-on-ink ring-1 ring-white/20">
|
||||
{profile.summonerLevel}
|
||||
</span>
|
||||
</div>
|
||||
<div className="flex-1 min-w-0">
|
||||
<div className="flex flex-wrap items-center gap-2">
|
||||
<h1 className="text-2xl font-bold text-base-content">
|
||||
{profile.gameName}
|
||||
</h1>
|
||||
<span className="text-sm text-base-content/35">
|
||||
#{profile.tagLine}
|
||||
</span>
|
||||
</div>
|
||||
<div className="mt-2 flex flex-wrap items-center gap-3 text-xs text-base-content/40">
|
||||
<span>Lv.{profile.summonerLevel}</span>
|
||||
<ResponsiveTierLabel tier={primaryTier} />
|
||||
<span>시즌: {profile.season.label}</span>
|
||||
<span>최근 저장: {formatLastFetched(profile.lastFetchedAt)}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex flex-col gap-2 text-xs sm:items-end">
|
||||
<p className="text-base-content/35 sm:text-right">
|
||||
{isInternalQueue
|
||||
? "내전 기록이 안 보이면 다시 불러오세요."
|
||||
: "버튼을 누르면 최신 전적으로 갱신됩니다."}
|
||||
</p>
|
||||
<button
|
||||
type="button"
|
||||
className="bg-primary px-3 py-2 text-xs font-bold text-primary-content transition-colors hover:bg-primary/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary disabled:opacity-40"
|
||||
disabled={refreshMutation.isPending || !userId}
|
||||
onClick={handleRefresh}
|
||||
>
|
||||
{isInternalQueue
|
||||
? "내전 기록 다시 불러오기"
|
||||
: refreshMutation.isPending
|
||||
? "요청 중..."
|
||||
: "정보 갱신"}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
{(refreshNotice || refreshSocket.error) && (
|
||||
<div
|
||||
className={`mt-4 border px-3 py-2 text-xs ${
|
||||
refreshNoticeIsError
|
||||
? "border-red-400/30 bg-red-400/5 text-red-300"
|
||||
: "border-primary/15 bg-primary/5 text-base-content/55"
|
||||
}`}
|
||||
}
|
||||
title={
|
||||
<>
|
||||
{profile.gameName}
|
||||
<span className="ml-1.5 text-lg font-semibold text-on-ink-muted">
|
||||
#{profile.tagLine}
|
||||
</span>
|
||||
</>
|
||||
}
|
||||
meta={
|
||||
<>
|
||||
<ResponsiveTierLabel tier={primaryTier} />
|
||||
<MetaDot />
|
||||
<span>{profile.season.label}</span>
|
||||
<MetaDot />
|
||||
<span>최근 갱신 {formatLastFetched(profile.lastFetchedAt)}</span>
|
||||
</>
|
||||
}
|
||||
actions={
|
||||
<Btn
|
||||
variant="primary"
|
||||
size="lg"
|
||||
disabled={refreshMutation.isPending || !userId}
|
||||
loading={refreshMutation.isPending}
|
||||
icon={<RefreshCw className="size-4" aria-hidden="true" />}
|
||||
onClick={handleRefresh}
|
||||
>
|
||||
{refreshNotice ?? refreshSocket.error}
|
||||
</div>
|
||||
)}
|
||||
</section>
|
||||
|
||||
{profile.tierHistory.length > 0 && (
|
||||
<Suspense
|
||||
fallback={
|
||||
<div className="mb-6 h-[180px] border border-base-content/10 bg-base-100" />
|
||||
}
|
||||
>
|
||||
<TierHistoryChart entries={profile.tierHistory} />
|
||||
</Suspense>
|
||||
)}
|
||||
|
||||
<section className="border border-base-content/10 bg-base-100 mb-6">
|
||||
<div className="flex flex-wrap border-b border-base-content/8">
|
||||
{QUEUE_GROUP_TABS.map((tab) => (
|
||||
<FilterButton
|
||||
key={tab.value}
|
||||
active={queueGroup === tab.value}
|
||||
onClick={() =>
|
||||
updateSearch({ queueGroup: tab.value, championId: null })
|
||||
}
|
||||
{isInternalQueue ? "내전 기록 다시 불러오기" : "전적 갱신"}
|
||||
</Btn>
|
||||
}
|
||||
/>
|
||||
<PageBody width="xl" className="space-y-5">
|
||||
{(refreshNotice || refreshSocket.error) &&
|
||||
(refreshNoticeIsError ? (
|
||||
<ErrorNote
|
||||
title="전적을 갱신하지 못했습니다"
|
||||
description={refreshNotice ?? refreshSocket.error}
|
||||
/>
|
||||
) : (
|
||||
<div
|
||||
role="status"
|
||||
className="lts-panel flex items-center gap-2 px-4 py-3 text-sm text-content-muted"
|
||||
>
|
||||
{tab.label}
|
||||
</FilterButton>
|
||||
<RefreshCw className="size-4 text-primary" aria-hidden="true" />
|
||||
{refreshNotice}
|
||||
</div>
|
||||
))}
|
||||
|
||||
<div className="lts-panel sticky top-[60px] z-30 p-1">
|
||||
<div
|
||||
className="no-scrollbar flex gap-1 overflow-x-auto"
|
||||
role="tablist"
|
||||
aria-label="게임 모드"
|
||||
>
|
||||
{QUEUE_GROUP_TABS.map((tab) => (
|
||||
<QueueTab
|
||||
key={tab.value}
|
||||
active={queueGroup === tab.value}
|
||||
onClick={() =>
|
||||
updateSearch({ queueGroup: tab.value, championId: null })
|
||||
}
|
||||
>
|
||||
{tab.label}
|
||||
</QueueTab>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex flex-wrap items-center justify-between gap-3 px-3 py-2">
|
||||
|
||||
<div className="flex flex-wrap items-center justify-between gap-3">
|
||||
{!isInternalQueue ? (
|
||||
<div className="flex flex-wrap">
|
||||
<div
|
||||
className="flex flex-wrap gap-1.5"
|
||||
role="group"
|
||||
aria-label="큐 종류"
|
||||
>
|
||||
{RANK_FILTER_TABS.map((tab) => (
|
||||
<FilterButton
|
||||
<Chip
|
||||
key={tab.value}
|
||||
active={rank === tab.value}
|
||||
selected={rank === tab.value}
|
||||
onClick={() =>
|
||||
updateSearch({ rank: tab.value, championId: null })
|
||||
}
|
||||
>
|
||||
{tab.label}
|
||||
</FilterButton>
|
||||
</Chip>
|
||||
))}
|
||||
</div>
|
||||
) : (
|
||||
<div className="px-3 py-2 text-xs text-base-content/40">
|
||||
내전 탭은 토너먼트 코드 결과 수집 데이터를 기준으로 집계합니다.
|
||||
</div>
|
||||
<p className="text-[13px] text-content-muted">
|
||||
토너먼트 코드로 수집한 내전 결과만 집계합니다.
|
||||
</p>
|
||||
)}
|
||||
{selectedChampionName && (
|
||||
<button
|
||||
type="button"
|
||||
className="text-xs px-2.5 py-1 border border-primary/30 text-primary bg-primary/5"
|
||||
onClick={() => updateSearch({ championId: null })}
|
||||
>
|
||||
{selectedChampionName} 필터 해제
|
||||
</button>
|
||||
)}
|
||||
{profile.seasons.length > 0 && (
|
||||
<select
|
||||
value={filters.seasonId ?? profile.season.id}
|
||||
onChange={(event) =>
|
||||
updateSearch({ seasonId: event.target.value, championId: null })
|
||||
}
|
||||
className="border border-base-content/10 bg-transparent px-3 py-2 text-xs"
|
||||
>
|
||||
{profile.seasons.map((season) => (
|
||||
<option key={season.id} value={season.id}>
|
||||
{season.label}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
)}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section className="mb-6">
|
||||
<h2 className="text-sm font-bold text-base-content mb-3">
|
||||
최근 {summary?.windowSize ?? 20}게임 전적 요약
|
||||
</h2>
|
||||
<div className="grid sm:grid-cols-2 lg:grid-cols-5 gap-3">
|
||||
<SummaryCard
|
||||
label="승률"
|
||||
value={`${summary?.winRate ?? 0}%`}
|
||||
sub={`${summary?.wins ?? 0}승 ${summary?.losses ?? 0}패`}
|
||||
/>
|
||||
<SummaryCard
|
||||
label="KDA"
|
||||
value={summary?.kda ?? 0}
|
||||
sub={`${summary?.avgKills ?? 0} / ${summary?.avgDeaths ?? 0} / ${summary?.avgAssists ?? 0}`}
|
||||
/>
|
||||
<SummaryCard
|
||||
label="최고 평점"
|
||||
value={summary?.bestRating?.rating ?? "-"}
|
||||
sub={
|
||||
summary?.bestRating
|
||||
? `${summary.bestRating.kills}/${summary.bestRating.deaths}/${summary.bestRating.assists}`
|
||||
: "기록 없음"
|
||||
}
|
||||
/>
|
||||
<SummaryCard
|
||||
label="연승/연패"
|
||||
value={
|
||||
summary?.streak
|
||||
? `${summary.streak.count}${summary.streak.type === "win" ? "연승" : "연패"}`
|
||||
: "-"
|
||||
}
|
||||
sub="가장 최근 경기 기준"
|
||||
/>
|
||||
<div className="border border-base-content/8 bg-base-100 p-4">
|
||||
<div className="text-xs font-bold uppercase tracking-wider text-base-content/30">
|
||||
자주 플레이한 챔피언
|
||||
</div>
|
||||
<div className="mt-3 flex items-center gap-3">
|
||||
{(summary?.topChampions ?? []).map((champion) => (
|
||||
<button
|
||||
type="button"
|
||||
key={champion.championId}
|
||||
className="text-center group"
|
||||
onClick={() =>
|
||||
updateSearch({ championId: champion.championId })
|
||||
}
|
||||
>
|
||||
<ChampionIcon
|
||||
championId={champion.championId}
|
||||
manifest={ddragon}
|
||||
/>
|
||||
<div className="mt-1 text-xs text-base-content/40 group-hover:text-primary">
|
||||
{champion.winRate}%
|
||||
</div>
|
||||
</button>
|
||||
))}
|
||||
{(summary?.topChampions ?? []).length === 0 && (
|
||||
<span className="text-xs text-base-content/25">기록 없음</span>
|
||||
)}
|
||||
</div>
|
||||
<div className="flex flex-wrap items-center gap-2">
|
||||
{selectedChampionName && (
|
||||
<Chip
|
||||
selected
|
||||
onClick={() => updateSearch({ championId: null })}
|
||||
aria-label={`${selectedChampionName} 필터 해제`}
|
||||
>
|
||||
{selectedChampionName}
|
||||
<X className="size-3.5" aria-hidden="true" />
|
||||
</Chip>
|
||||
)}
|
||||
{profile.seasons.length > 0 && (
|
||||
<select
|
||||
aria-label="시즌"
|
||||
value={filters.seasonId ?? profile.season.id}
|
||||
onChange={(event) =>
|
||||
updateSearch({
|
||||
seasonId: event.target.value,
|
||||
championId: null,
|
||||
})
|
||||
}
|
||||
className="lts-select !w-auto"
|
||||
>
|
||||
{profile.seasons.map((season) => (
|
||||
<option key={season.id} value={season.id}>
|
||||
{season.label}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section className="mb-6">
|
||||
{profile.tierHistory.length > 0 && !isInternalQueue && (
|
||||
<Suspense fallback={<div className="lts-panel h-[180px]" />}>
|
||||
<TierHistoryChart entries={profile.tierHistory} />
|
||||
</Suspense>
|
||||
)}
|
||||
|
||||
<Panel>
|
||||
<PanelHeader
|
||||
title={`최근 ${summary?.windowSize ?? 20}게임 요약`}
|
||||
description={
|
||||
selectedChampionName
|
||||
? `${selectedChampionName} 경기만 집계`
|
||||
: undefined
|
||||
}
|
||||
/>
|
||||
<div className="grid grid-cols-2 divide-line max-lg:[&>*:nth-child(n+3)]:border-t max-lg:[&>*:nth-child(even)]:border-l lg:grid-cols-[repeat(4,minmax(0,1fr))_minmax(0,1.5fr)] lg:divide-x">
|
||||
<SummaryCard
|
||||
label="승률"
|
||||
value={summary ? `${summary.winRate}%` : "—"}
|
||||
valueClassName={summary ? ratioClass(summary.winRate) : undefined}
|
||||
sub={`${summary?.wins ?? 0}승 ${summary?.losses ?? 0}패`}
|
||||
/>
|
||||
<SummaryCard
|
||||
label="KDA"
|
||||
value={summary?.kda ?? "—"}
|
||||
valueClassName={summary ? kdaClass(summary.kda) : undefined}
|
||||
sub={`${summary?.avgKills ?? 0} / ${summary?.avgDeaths ?? 0} / ${summary?.avgAssists ?? 0}`}
|
||||
/>
|
||||
<SummaryCard
|
||||
label="최고 평점"
|
||||
value={summary?.bestRating?.rating ?? "—"}
|
||||
sub={
|
||||
summary?.bestRating
|
||||
? `${summary.bestRating.kills}/${summary.bestRating.deaths}/${summary.bestRating.assists}`
|
||||
: "기록 없음"
|
||||
}
|
||||
/>
|
||||
<SummaryCard
|
||||
label="흐름"
|
||||
value={
|
||||
summary?.streak
|
||||
? `${summary.streak.count}${summary.streak.type === "win" ? "연승" : "연패"}`
|
||||
: "—"
|
||||
}
|
||||
valueClassName={
|
||||
summary?.streak
|
||||
? summary.streak.type === "win"
|
||||
? "text-win"
|
||||
: "text-loss"
|
||||
: undefined
|
||||
}
|
||||
sub="가장 최근 경기 기준"
|
||||
/>
|
||||
<div className="col-span-2 px-4 py-3.5 sm:px-5 lg:col-span-1">
|
||||
<div className="text-xs font-semibold text-content-subtle">
|
||||
자주 플레이한 챔피언
|
||||
</div>
|
||||
<div className="mt-2 flex items-center gap-4">
|
||||
{(summary?.topChampions ?? []).map((champion) => (
|
||||
<button
|
||||
type="button"
|
||||
key={champion.championId}
|
||||
className="group flex items-center gap-2 text-left"
|
||||
aria-label={`${championDisplayName(ddragon, champion.championId) ?? champion.championId} 경기만 보기`}
|
||||
onClick={() =>
|
||||
updateSearch({ championId: champion.championId })
|
||||
}
|
||||
>
|
||||
<ChampionIcon
|
||||
championId={champion.championId}
|
||||
manifest={ddragon}
|
||||
className="rounded-full ring-2 ring-transparent transition-shadow group-hover:ring-primary"
|
||||
/>
|
||||
<span
|
||||
className={`tabular text-sm font-bold ${ratioClass(champion.winRate)}`}
|
||||
>
|
||||
{champion.winRate}%
|
||||
</span>
|
||||
</button>
|
||||
))}
|
||||
{(summary?.topChampions ?? []).length === 0 && (
|
||||
<span className="text-xs text-content-subtle">기록 없음</span>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Panel>
|
||||
|
||||
<div
|
||||
className="flex items-center gap-1.5"
|
||||
role="tablist"
|
||||
aria-label="전적 보기"
|
||||
>
|
||||
<Chip
|
||||
role="tab"
|
||||
aria-selected={view === "matches"}
|
||||
selected={view === "matches"}
|
||||
onClick={() => updateSearch({ view: null })}
|
||||
>
|
||||
매치 히스토리
|
||||
</Chip>
|
||||
<Chip
|
||||
role="tab"
|
||||
aria-selected={view === "champions"}
|
||||
selected={view === "champions"}
|
||||
onClick={() => updateSearch({ view: "champions" })}
|
||||
>
|
||||
챔피언 통계
|
||||
</Chip>
|
||||
<span className="ml-auto text-xs text-content-subtle">
|
||||
최근 저장 {formatLastFetched(historyLastFetchedAt)}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
{view === "champions" && (
|
||||
<section>
|
||||
<div className="flex flex-col sm:flex-row sm:items-end sm:justify-between gap-3 mb-3">
|
||||
<div>
|
||||
<h2 className="text-sm font-bold text-base-content">챔피언 통계</h2>
|
||||
<p className="mt-1 text-xs text-base-content/35">
|
||||
<h2 className="sr-only">챔피언 통계</h2>
|
||||
<p className="text-xs text-content-subtle">
|
||||
저장된 데이터를 기준으로 집계합니다. 최신 데이터가 반영되지 않을
|
||||
수 있습니다.
|
||||
</p>
|
||||
@@ -1534,14 +1628,14 @@ export default function UserHistoryPage() {
|
||||
value={championSearch}
|
||||
onChange={(event) => setChampionSearch(event.target.value)}
|
||||
placeholder="챔피언 검색"
|
||||
className="border border-base-content/10 bg-transparent px-3 py-2 text-xs focus:outline-none focus:border-primary/30"
|
||||
className="lts-input"
|
||||
/>
|
||||
<select
|
||||
value={sortKey}
|
||||
onChange={(event) =>
|
||||
setSortKey(event.target.value as ChampionSortKey)
|
||||
}
|
||||
className="border border-base-content/10 bg-transparent px-3 py-2 text-xs"
|
||||
className="lts-select"
|
||||
>
|
||||
{(Object.keys(SORT_LABELS) as ChampionSortKey[]).map((key) => (
|
||||
<option key={key} value={key}>
|
||||
@@ -1561,20 +1655,21 @@ export default function UserHistoryPage() {
|
||||
/>
|
||||
</section>
|
||||
|
||||
)}
|
||||
|
||||
{view === "matches" && (
|
||||
<section>
|
||||
<div className="flex items-center justify-between gap-3 mb-3">
|
||||
<h2 className="text-sm font-bold text-base-content">매치 히스토리</h2>
|
||||
<span className="text-xs text-base-content/35">
|
||||
최근 저장: {formatLastFetched(historyLastFetchedAt)}
|
||||
</span>
|
||||
</div>
|
||||
<h2 className="sr-only">매치 히스토리</h2>
|
||||
|
||||
{matchesLoading ? (
|
||||
<MatchListSkeleton />
|
||||
) : matches.length === 0 ? (
|
||||
<div className="border border-base-content/10 bg-base-100 px-4 py-10 text-center text-sm text-base-content/35">
|
||||
조건에 맞는 최근 경기 기록이 없습니다.
|
||||
</div>
|
||||
<Panel>
|
||||
<EmptyNote
|
||||
title="조건에 맞는 경기 기록이 없습니다"
|
||||
description="큐 종류나 시즌을 바꾸거나 전적을 갱신해 보세요."
|
||||
/>
|
||||
</Panel>
|
||||
) : (
|
||||
<div className="space-y-2">
|
||||
{matches.map((match) => (
|
||||
@@ -1591,20 +1686,24 @@ export default function UserHistoryPage() {
|
||||
)}
|
||||
|
||||
{hasNextPage && (
|
||||
<button
|
||||
type="button"
|
||||
className="mt-3 w-full border border-base-content/15 bg-base-100 py-3 text-sm font-bold text-base-content/60 hover:border-primary/30 hover:text-primary disabled:opacity-40"
|
||||
<Btn
|
||||
variant="secondary"
|
||||
size="lg"
|
||||
className="mt-3 w-full"
|
||||
disabled={isFetchingNextPage}
|
||||
loading={isFetchingNextPage}
|
||||
onClick={() =>
|
||||
isInternalQueue
|
||||
? internalHistoryQuery.fetchNextPage()
|
||||
: recentMatchesQuery.fetchNextPage()
|
||||
}
|
||||
>
|
||||
{isFetchingNextPage ? "불러오는 중..." : "+ 더 보기"}
|
||||
</button>
|
||||
더 보기
|
||||
</Btn>
|
||||
)}
|
||||
</section>
|
||||
</main>
|
||||
)}
|
||||
</PageBody>
|
||||
</>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user