feat: refine match game detail ux

This commit is contained in:
dahyeon committed 2026-06-20 01:04:03 -07:00
1 parent 747adfcb11
commit 0434a5db66
9 files changed
+156 -206

No files matched your search

@@ -33,6 +33,7 @@ function record(matchId: mongoose.Types.ObjectId): InternalRecord {
gameDuration: 1_800, gameDuration: 1_800,
userId: new mongoose.Types.ObjectId().toString(), userId: new mongoose.Types.ObjectId().toString(),
summonerName: 'Player', summonerName: 'Player',
tagLine: 'KR1',
profileIconId: 1, profileIconId: 1,
teamIndex: 1, teamIndex: 1,
side: 'blue', side: 'blue',
@@ -186,7 +187,7 @@ describe('CommunityStatsService', () => {
}); });
expect(matchStatsService.buildAndUpsert).not.toHaveBeenCalled(); expect(matchStatsService.buildAndUpsert).not.toHaveBeenCalled();
expect(cacheService.setDetail).toHaveBeenCalledWith( expect(cacheService.setDetail).toHaveBeenCalledWith(
expect.stringContaining(':r2:'), expect.stringContaining(':r3:'),
response, response,
); );
}); });
@@ -36,7 +36,7 @@ const DEFAULT_LIST_LIMIT = 20;
const MAX_LIST_LIMIT = 50; const MAX_LIST_LIMIT = 50;
const MAX_MATCH_SCAN = 300; const MAX_MATCH_SCAN = 300;
const MIN_HIGHLIGHT_GAMES = 5; const MIN_HIGHLIGHT_GAMES = 5;
const MATCH_DETAIL_RESPONSE_CACHE_VERSION = 2; const MATCH_DETAIL_RESPONSE_CACHE_VERSION = 3;
interface CommunityStatsContext { interface CommunityStatsContext {
community: CommunityDocument; community: CommunityDocument;
@@ -248,6 +248,7 @@ export class CommunityStatsService {
participants: team.participants.map((record) => ({ participants: team.participants.map((record) => ({
userId: record.userId, userId: record.userId,
summonerName: record.summonerName, summonerName: record.summonerName,
tagLine: record.tagLine,
teamIndex: record.teamIndex, teamIndex: record.teamIndex,
side: record.side, side: record.side,
teamPosition: record.teamPosition, teamPosition: record.teamPosition,
@@ -1027,6 +1028,7 @@ function isCompleteMatchDetailResponse(
Array.isArray(team.bans) && Array.isArray(team.bans) &&
team.participants.every( team.participants.every(
(participant) => (participant) =>
typeof participant.tagLine === 'string' &&
Array.isArray(participant.itemBuild) && Array.isArray(participant.itemBuild) &&
Array.isArray(participant.skillBuild), Array.isArray(participant.skillBuild),
), ),
@@ -145,6 +145,7 @@ export interface InternalMatchDetailResponse {
participants: Array<{ participants: Array<{
userId: string | null; userId: string | null;
summonerName: string; summonerName: string;
tagLine: string;
teamIndex: number; teamIndex: number;
side: TeamSide; side: TeamSide;
teamPosition: string; teamPosition: string;
@@ -325,6 +325,7 @@ export class MatchStatsFragmentBuilder {
rawParticipant?.riotIdGameName ?? rawParticipant?.riotIdGameName ??
rawParticipant?.summonerName ?? rawParticipant?.summonerName ??
'Unknown', 'Unknown',
tagLine: snapshot?.tagLine ?? rawParticipant?.riotIdTagLine ?? '',
profileIconId: snapshot?.profileIconId ?? 0, profileIconId: snapshot?.profileIconId ?? 0,
teamIndex: participant.teamIndex, teamIndex: participant.teamIndex,
side: participant.side, side: participant.side,
@@ -114,7 +114,7 @@ describe('MatchStatsService', () => {
scheduledAt, scheduledAt,
gameCreationMin: 1_000, gameCreationMin: 1_000,
gameCreationMax: 2_000, gameCreationMax: 2_000,
builderVersion: 8, builderVersion: 9,
}), }),
); );
}); });
@@ -4,7 +4,7 @@ import type {
} from '../global/database/schema'; } from '../global/database/schema';
import type { InternalMatchCardView } from './community-stats.types'; import type { InternalMatchCardView } from './community-stats.types';
export const MATCH_STATS_BUILDER_VERSION = 8; export const MATCH_STATS_BUILDER_VERSION = 9;
export type InternalRecord = MatchStatsRecord; export type InternalRecord = MatchStatsRecord;
export type InternalGameDetail = MatchStatsGameDetail; export type InternalGameDetail = MatchStatsGameDetail;
@@ -711,6 +711,7 @@ export interface MatchStatsRecord {
gameDuration: number; gameDuration: number;
userId: string; userId: string;
summonerName: string; summonerName: string;
tagLine: string;
profileIconId: number; profileIconId: number;
teamIndex: number; teamIndex: number;
side: TeamSide; side: TeamSide;
+1
View File
@@ -796,6 +796,7 @@ export interface ApiInternalMatchDetailResponse {
participants: Array<{ participants: Array<{
userId: string | null; userId: string | null;
summonerName: string; summonerName: string;
tagLine: string;
teamIndex: number; teamIndex: number;
side: TeamSide; side: TeamSide;
teamPosition: string; teamPosition: string;
+145 -202
View File
@@ -35,20 +35,13 @@ type MatchGameTeam = MatchGameDetail["teams"][number];
type MatchGameParticipant = MatchGameTeam["participants"][number]; type MatchGameParticipant = MatchGameTeam["participants"][number];
type DdragonManifestData = ReturnType<typeof useDdragonManifest>["data"]; type DdragonManifestData = ReturnType<typeof useDdragonManifest>["data"];
type RuneStyleEntry = NonNullable<DdragonManifestData>["runesReforged"][number]; type RuneStyleEntry = NonNullable<DdragonManifestData>["runesReforged"][number];
type DetailTab = type DetailTab = "scoreboard" | "matchup" | "build";
| "scoreboard"
| "matchup"
| "build"
| "damageDealt"
| "damageTaken";
type TimelineMetric = "gold" | "xp"; type TimelineMetric = "gold" | "xp";
const DETAIL_TABS: Array<{ id: DetailTab; label: string }> = [ const DETAIL_TABS: Array<{ id: DetailTab; label: string }> = [
{ id: "scoreboard", label: "스코어보드" }, { id: "scoreboard", label: "스코어보드" },
{ id: "matchup", label: "라인전" }, { id: "matchup", label: "라인전" },
{ id: "build", label: "룬 / 빌드" }, { id: "build", label: "룬 / 빌드" },
{ id: "damageDealt", label: "가한 데미지" },
{ id: "damageTaken", label: "받은 데미지" },
]; ];
const TIMELINE_METRICS: Array<{ id: TimelineMetric; label: string }> = [ const TIMELINE_METRICS: Array<{ id: TimelineMetric; label: string }> = [
@@ -154,9 +147,18 @@ function teamTotals(team: MatchGameTeam) {
assists: totals.assists + participant.assists, assists: totals.assists + participant.assists,
gold: totals.gold + participant.gold, gold: totals.gold + participant.gold,
damage: totals.damage + participant.damageDealtToChampions, damage: totals.damage + participant.damageDealtToChampions,
damageTaken: totals.damageTaken + (participant.damageTaken ?? 0),
vision: totals.vision + participant.visionScore, vision: totals.vision + participant.visionScore,
}), }),
{ kills: 0, deaths: 0, assists: 0, gold: 0, damage: 0, vision: 0 }, {
kills: 0,
deaths: 0,
assists: 0,
gold: 0,
damage: 0,
damageTaken: 0,
vision: 0,
},
); );
} }
@@ -211,25 +213,6 @@ function runeStyleSelection(
return participant.perks.styles?.find((style) => style.styleId === styleId); return participant.perks.styles?.find((style) => style.styleId === styleId);
} }
function StatBlock({
label,
value,
}: {
label: string;
value: string | number;
}) {
return (
<div className="border border-base-content/8 bg-base-100 px-3 py-2">
<div className="text-xs font-black uppercase tracking-wider text-base-content/35">
{label}
</div>
<div className="mt-1 text-sm font-black tabular-nums text-base-content">
{value}
</div>
</div>
);
}
function WinBadge({ win }: { win: boolean }) { function WinBadge({ win }: { win: boolean }) {
return win ? ( return win ? (
<span className="inline-flex items-center border border-accent/60 bg-accent px-2 py-0.5 text-xs font-black text-accent-content"> <span className="inline-flex items-center border border-accent/60 bg-accent px-2 py-0.5 text-xs font-black text-accent-content">
@@ -301,7 +284,7 @@ function SpellRuneStrip({
{[0, 1].map((index) => ( {[0, 1].map((index) => (
<span <span
key={`spell-${index}`} key={`spell-${index}`}
className="h-4 w-4 overflow-hidden bg-base-content/10" className="h-5 w-5 overflow-hidden bg-base-content/10"
> >
{spellIcons[index] ? ( {spellIcons[index] ? (
<img <img
@@ -317,7 +300,7 @@ function SpellRuneStrip({
{[0, 1].map((index) => ( {[0, 1].map((index) => (
<span <span
key={`rune-${index}`} key={`rune-${index}`}
className="h-4 w-4 overflow-hidden bg-base-content/10" className="h-5 w-5 overflow-hidden bg-base-content/10"
> >
{runeIcons[index] ? ( {runeIcons[index] ? (
<img <img
@@ -373,43 +356,88 @@ function PercentBar({ value, side }: { value: number; side: TeamSide }) {
); );
} }
function PlayerRow({ function PlayerIdentityCell({
participant, participant,
manifest, manifest,
avatarSize = "h-12 w-12",
nameMaxWidth = "max-w-[150px]",
}: { }: {
participant: MatchGameParticipant; participant: MatchGameParticipant;
manifest: ReturnType<typeof useDdragonManifest>["data"]; manifest: ReturnType<typeof useDdragonManifest>["data"];
avatarSize?: string;
nameMaxWidth?: string;
}) { }) {
const location = useLocation(); const location = useLocation();
const historyBackTo = `${location.pathname}${location.search}${location.hash}`; const historyBackTo = `${location.pathname}${location.search}${location.hash}`;
const lane =
LANE_LABELS[participant.teamPosition] ?? participant.teamPosition ?? "-";
const nameNode = (
<>
{participant.summonerName}
{participant.tagLine ? (
<span className="font-normal text-base-content/30">
{" "}
#{participant.tagLine}
</span>
) : null}
</>
);
return ( return (
<tr className="border-t border-base-content/5 hover:bg-base-content/[0.02]"> <div className="flex min-w-0 items-center gap-2">
<td className="px-3 py-2.5"> <ChampionAvatar
<ChampionCell participant={participant} manifest={manifest} /> participant={participant}
</td> manifest={manifest}
<td className="px-3 py-2.5"> size={avatarSize}
<SpellRuneStrip participant={participant} manifest={manifest} /> />
</td> <SpellRuneStrip participant={participant} manifest={manifest} />
<td className="px-3 py-2.5"> <div className="min-w-0">
{participant.userId ? ( {participant.userId ? (
<Link <Link
to={`/users/${participant.userId}/history?queueGroup=internal`} to={`/users/${participant.userId}/history?queueGroup=internal`}
state={{ backTo: historyBackTo }} state={{ backTo: historyBackTo }}
className="block max-w-[170px] truncate text-sm font-bold text-base-content hover:text-primary" className={`block ${nameMaxWidth} truncate text-sm font-bold text-base-content hover:text-primary`}
> >
{participant.summonerName} {nameNode}
</Link> </Link>
) : ( ) : (
<span className="block max-w-[170px] truncate text-sm font-bold text-base-content"> <span
{participant.summonerName} className={`block ${nameMaxWidth} truncate text-sm font-bold text-base-content`}
</span> >
)} {nameNode}
{(participant.firstBloodKill || participant.firstBloodAssist) && (
<span className="mt-1 inline-flex border border-amber-400/30 bg-amber-400/10 px-1.5 py-0.5 text-[10px] font-black text-amber-400">
{participant.firstBloodKill ? "FB" : "FBA"}
</span> </span>
)} )}
<div className="mt-0.5 flex items-center gap-1.5">
<span className="text-xs text-base-content/35">{lane}</span>
{(participant.firstBloodKill || participant.firstBloodAssist) && (
<span className="inline-flex border border-amber-400/30 bg-amber-400/10 px-1 text-[10px] font-black text-amber-400">
{participant.firstBloodKill ? "FB" : "FBA"}
</span>
)}
</div>
</div>
</div>
);
}
function PlayerRow({
participant,
manifest,
teamDamageTaken,
}: {
participant: MatchGameParticipant;
manifest: ReturnType<typeof useDdragonManifest>["data"];
teamDamageTaken: number;
}) {
const takenShare =
teamDamageTaken > 0
? ((participant.damageTaken ?? 0) / teamDamageTaken) * 100
: 0;
return (
<tr className="border-t border-base-content/5 hover:bg-base-content/[0.02]">
<td className="px-3 py-2.5">
<PlayerIdentityCell participant={participant} manifest={manifest} />
</td> </td>
<td className="px-3 py-2.5 text-center"> <td className="px-3 py-2.5 text-center">
<div className="text-sm font-black tabular-nums text-base-content"> <div className="text-sm font-black tabular-nums text-base-content">
@@ -425,11 +453,13 @@ function PlayerRow({
participant.deaths, participant.deaths,
participant.assists, participant.assists,
)} )}
{participant.deaths === 0 ? "" : " KDA"} <span className="ml-1 text-base-content/35">
({participant.killParticipation}%)
</span>
</div> </div>
</td> </td>
<td className="px-3 py-2.5 text-center text-xs tabular-nums text-base-content/60"> <td className="px-3 py-2.5 text-center text-xs tabular-nums text-base-content/60">
{formatCompactNumber(participant.damageDealtToChampions)} {formatNumber(participant.damageDealtToChampions)}
<div className="mx-auto w-16"> <div className="mx-auto w-16">
<PercentBar value={participant.damageShare} side={participant.side} /> <PercentBar value={participant.damageShare} side={participant.side} />
</div> </div>
@@ -437,6 +467,13 @@ function PlayerRow({
{formatPercent(participant.damageShare)} {formatPercent(participant.damageShare)}
</span> </span>
</td> </td>
<td className="px-3 py-2.5 text-center text-xs tabular-nums text-base-content/60">
{formatNumber(participant.damageTaken ?? 0)}
<div className="mx-auto w-16">
<PercentBar value={takenShare} side={participant.side} />
</div>
<span className="text-base-content/35">{Math.round(takenShare)}%</span>
</td>
<td className="px-3 py-2.5 text-center text-xs tabular-nums text-base-content/60"> <td className="px-3 py-2.5 text-center text-xs tabular-nums text-base-content/60">
{participant.visionScore} {participant.visionScore}
<span className="block text-base-content/35"> <span className="block text-base-content/35">
@@ -462,18 +499,22 @@ function PlayerRow({
function PlayerCard({ function PlayerCard({
participant, participant,
manifest, manifest,
teamDamageTaken,
}: { }: {
participant: MatchGameParticipant; participant: MatchGameParticipant;
manifest: ReturnType<typeof useDdragonManifest>["data"]; manifest: ReturnType<typeof useDdragonManifest>["data"];
teamDamageTaken: number;
}) { }) {
const location = useLocation(); const takenShare =
const historyBackTo = `${location.pathname}${location.search}${location.hash}`; teamDamageTaken > 0
? ((participant.damageTaken ?? 0) / teamDamageTaken) * 100
: 0;
return ( return (
<div className="p-3"> <div className="p-3">
<div className="flex items-start gap-2"> <div className="flex items-start justify-between gap-2">
<ChampionCell participant={participant} manifest={manifest} /> <PlayerIdentityCell participant={participant} manifest={manifest} />
<div className="ml-auto shrink-0 text-right"> <div className="shrink-0 text-right">
<div className="text-sm font-black tabular-nums text-base-content"> <div className="text-sm font-black tabular-nums text-base-content">
{participant.kills} {participant.kills}
<span className="text-base-content/25"> / </span> <span className="text-base-content/25"> / </span>
@@ -487,49 +528,40 @@ function PlayerCard({
participant.deaths, participant.deaths,
participant.assists, participant.assists,
)} )}
{participant.deaths === 0 ? "" : " KDA"} <span className="ml-1 text-base-content/35">
({participant.killParticipation}%)
</span>
</div> </div>
</div> </div>
</div> </div>
<div className="mt-2 flex items-center justify-between gap-2">
<div className="flex min-w-0 items-center gap-2">
{participant.userId ? (
<Link
to={`/users/${participant.userId}/history?queueGroup=internal`}
state={{ backTo: historyBackTo }}
className="block max-w-[160px] truncate text-sm font-bold text-base-content hover:text-primary"
>
{participant.summonerName}
</Link>
) : (
<span className="block max-w-[160px] truncate text-sm font-bold text-base-content">
{participant.summonerName}
</span>
)}
{(participant.firstBloodKill || participant.firstBloodAssist) && (
<span className="inline-flex border border-amber-400/30 bg-amber-400/10 px-1.5 py-0.5 text-[10px] font-black text-amber-400">
{participant.firstBloodKill ? "FB" : "FBA"}
</span>
)}
</div>
<SpellRuneStrip participant={participant} manifest={manifest} />
</div>
<div className="mt-2"> <div className="mt-2">
<ItemStrip participant={participant} manifest={manifest} /> <ItemStrip participant={participant} manifest={manifest} />
</div> </div>
<div className="mt-2 grid grid-cols-3 gap-2 text-[11px] tabular-nums"> <div className="mt-2 grid grid-cols-2 gap-2 text-[11px] tabular-nums sm:grid-cols-4">
<div className="border border-base-content/8 px-2 py-1.5"> <div className="border border-base-content/8 px-2 py-1.5">
<div className="text-[10px] font-bold uppercase tracking-wider text-base-content/30"> <div className="text-[10px] font-bold uppercase tracking-wider text-base-content/30">
피해량 가한 피해량
</div> </div>
<div className="mt-0.5 font-black text-base-content/70"> <div className="mt-0.5 font-black text-base-content/70">
{formatCompactNumber(participant.damageDealtToChampions)} {formatNumber(participant.damageDealtToChampions)}
<span className="ml-1 font-bold text-base-content/35"> <span className="ml-1 font-bold text-base-content/35">
{formatPercent(participant.damageShare)} {formatPercent(participant.damageShare)}
</span> </span>
</div> </div>
<PercentBar value={participant.damageShare} side={participant.side} /> <PercentBar value={participant.damageShare} side={participant.side} />
</div> </div>
<div className="border border-base-content/8 px-2 py-1.5">
<div className="text-[10px] font-bold uppercase tracking-wider text-base-content/30">
받은 피해량
</div>
<div className="mt-0.5 font-black text-base-content/70">
{formatNumber(participant.damageTaken ?? 0)}
<span className="ml-1 font-bold text-base-content/35">
{Math.round(takenShare)}%
</span>
</div>
<PercentBar value={takenShare} side={participant.side} />
</div>
<div className="border border-base-content/8 px-2 py-1.5"> <div className="border border-base-content/8 px-2 py-1.5">
<div className="text-[10px] font-bold uppercase tracking-wider text-base-content/30"> <div className="text-[10px] font-bold uppercase tracking-wider text-base-content/30">
CS CS
@@ -596,16 +628,23 @@ function TeamScoreHeader({
</div> </div>
</div> </div>
</div> </div>
<div className="grid grid-cols-3 gap-2 sm:grid-cols-6 lg:min-w-[520px]"> <div className="flex shrink-0 items-center gap-4 text-sm font-black tabular-nums">
<StatBlock label="K" value={totals.kills} /> <div className="flex items-baseline gap-1.5">
<StatBlock label="D" value={totals.deaths} /> <span className="text-[10px] font-bold uppercase tracking-wider text-base-content/35">
<StatBlock label="A" value={totals.assists} /> KDA
<StatBlock label="Gold" value={formatCompactNumber(totals.gold)} /> </span>
<StatBlock <span className="text-base-content">
label="Damage" {totals.kills} / {totals.deaths} / {totals.assists}
value={formatCompactNumber(totals.damage)} </span>
/> </div>
<StatBlock label="Vision" value={totals.vision} /> <div className="flex items-baseline gap-1.5">
<span className="text-[10px] font-bold uppercase tracking-wider text-base-content/35">
Gold
</span>
<span className="text-base-content">
{formatCompactNumber(totals.gold)}
</span>
</div>
</div> </div>
</div> </div>
</div> </div>
@@ -1019,6 +1058,8 @@ function TeamTable({
detail: ApiInternalMatchDetailResponse; detail: ApiInternalMatchDetailResponse;
manifest: ReturnType<typeof useDdragonManifest>["data"]; manifest: ReturnType<typeof useDdragonManifest>["data"];
}) { }) {
const teamDamageTaken = teamTotals(team).damageTaken;
return ( return (
<section className="overflow-hidden border border-base-content/10 bg-base-100"> <section className="overflow-hidden border border-base-content/10 bg-base-100">
<TeamScoreHeader team={team} detail={detail} /> <TeamScoreHeader team={team} detail={detail} />
@@ -1028,19 +1069,19 @@ function TeamTable({
key={`card-${participant.side}-${participant.userId ?? participant.summonerName}-${participant.championId}`} key={`card-${participant.side}-${participant.userId ?? participant.summonerName}-${participant.championId}`}
participant={participant} participant={participant}
manifest={manifest} manifest={manifest}
teamDamageTaken={teamDamageTaken}
/> />
))} ))}
</div> </div>
<div className="hidden overflow-x-auto lg:block"> <div className="hidden overflow-x-auto lg:block">
<table className="w-full min-w-[1080px] table-fixed text-left"> <table className="w-full min-w-[1040px] table-fixed text-left">
<thead> <thead>
<tr className="bg-base-content/[0.02] text-xs uppercase tracking-wider text-base-content/35"> <tr className="bg-base-content/[0.02] text-xs uppercase tracking-wider text-base-content/35">
<th className="w-[196px] px-3 py-2.5">챔피언</th> <th className="w-[276px] px-3 py-2.5">선수</th>
<th className="w-[60px] px-3 py-2.5">스펠/룬</th> <th className="w-[108px] px-3 py-2.5 text-center">KDA</th>
<th className="w-[160px] px-3 py-2.5">선수</th> <th className="w-[120px] px-3 py-2.5 text-center">가한 피해량</th>
<th className="w-[112px] px-3 py-2.5 text-center">KDA</th> <th className="w-[120px] px-3 py-2.5 text-center">받은 피해량</th>
<th className="w-[124px] px-3 py-2.5 text-center">피해량</th> <th className="w-[80px] px-3 py-2.5 text-center">시야</th>
<th className="w-[92px] px-3 py-2.5 text-center">시야</th>
<th className="w-[76px] px-3 py-2.5 text-center">CS</th> <th className="w-[76px] px-3 py-2.5 text-center">CS</th>
<th className="w-[260px] px-3 py-2.5">아이템</th> <th className="w-[260px] px-3 py-2.5">아이템</th>
</tr> </tr>
@@ -1051,6 +1092,7 @@ function TeamTable({
key={`${participant.side}-${participant.userId ?? participant.summonerName}-${participant.championId}`} key={`${participant.side}-${participant.userId ?? participant.summonerName}-${participant.championId}`}
participant={participant} participant={participant}
manifest={manifest} manifest={manifest}
teamDamageTaken={teamDamageTaken}
/> />
))} ))}
</tbody> </tbody>
@@ -1550,83 +1592,6 @@ function SkillBuildPanel({
); );
} }
function DamagePanel({
selectedGame,
detail,
manifest,
metric,
}: {
selectedGame: MatchGameDetail;
detail: ApiInternalMatchDetailResponse;
manifest: ReturnType<typeof useDdragonManifest>["data"];
metric: "dealt" | "taken";
}) {
const participants = selectedGame.teams.flatMap((team) => team.participants);
const maxValue = Math.max(
1,
...participants.map((participant) =>
metric === "dealt"
? participant.damageDealtToChampions
: (participant.damageTaken ?? 0),
),
);
const orderedTeams = [...selectedGame.teams].sort((left, right) =>
left.side === right.side ? 0 : left.side === "blue" ? -1 : 1,
);
return (
<section className="grid gap-4 lg:grid-cols-2">
{orderedTeams.map((team) => {
const tone = sideTone(team.side);
return (
<div
key={`${team.side}-${metric}`}
className="overflow-hidden border border-base-content/10 bg-base-100"
>
<div
className={`border-b border-base-content/8 px-4 py-3 ${tone.bg}`}
>
<div className={`text-sm font-black ${tone.text}`}>
{getTeamName(detail, team.teamIndex)} · {sideLabel(team.side)}
</div>
</div>
<div className="overflow-x-auto">
<div className="min-w-[520px] divide-y divide-base-content/5">
{team.participants.map((participant) => {
const value =
metric === "dealt"
? participant.damageDealtToChampions
: (participant.damageTaken ?? 0);
return (
<div
key={`${metric}-${participant.userId ?? participant.summonerName}-${participant.championId}`}
className="grid grid-cols-[220px_1fr_72px] items-center gap-3 px-4 py-3 text-xs"
>
<ChampionCell
participant={participant}
manifest={manifest}
/>
<div className="h-2 bg-base-content/8">
<div
className={`h-full ${tone.bar}`}
style={{ width: barWidth(value, maxValue) }}
/>
</div>
<div className="text-right font-black tabular-nums text-base-content/70">
{formatNumber(value)}
</div>
</div>
);
})}
</div>
</div>
</div>
);
})}
</section>
);
}
const LANE_SORT_ORDER = ["TOP", "JUNGLE", "MIDDLE", "BOTTOM", "UTILITY"]; const LANE_SORT_ORDER = ["TOP", "JUNGLE", "MIDDLE", "BOTTOM", "UTILITY"];
function laneSortValue(position: string) { function laneSortValue(position: string) {
@@ -1755,16 +1720,16 @@ function LaneMatchupCard({
label: "골드", label: "골드",
blueValue: blue.gold, blueValue: blue.gold,
redValue: red.gold, redValue: red.gold,
blueText: formatCompactNumber(blue.gold), blueText: formatNumber(blue.gold),
redText: formatCompactNumber(red.gold), redText: formatNumber(red.gold),
}, },
{ {
key: "damage", key: "damage",
label: "딜량", label: "딜량",
blueValue: blue.damageDealtToChampions, blueValue: blue.damageDealtToChampions,
redValue: red.damageDealtToChampions, redValue: red.damageDealtToChampions,
blueText: formatCompactNumber(blue.damageDealtToChampions), blueText: formatNumber(blue.damageDealtToChampions),
redText: formatCompactNumber(red.damageDealtToChampions), redText: formatNumber(red.damageDealtToChampions),
}, },
{ {
key: "cs", key: "cs",
@@ -1947,28 +1912,6 @@ function GameAnalysisPanel({
); );
} }
if (activeTab === "damageDealt") {
return (
<DamagePanel
selectedGame={selectedGame}
detail={detail}
manifest={manifest}
metric="dealt"
/>
);
}
if (activeTab === "damageTaken") {
return (
<DamagePanel
selectedGame={selectedGame}
detail={detail}
manifest={manifest}
metric="taken"
/>
);
}
return ( return (
<LaneMatchupPanel <LaneMatchupPanel
selectedGame={selectedGame} selectedGame={selectedGame}