feat: add spell and rune tooltips

This commit is contained in:
dahyeon committed 2026-06-26 23:29:47 -07:00
1 parent 4906f665fd
commit 292e37aaac
8 files changed
+404 -161

No files matched your search

+15 -37
View File
@@ -17,9 +17,6 @@ import { DEFAULT_COMMUNITY_ID } from "../config";
import {
championDisplayName,
championIconUrl,
runeKeystoneIconUrl,
runeStyleIconUrl,
summonerSpellIconUrl,
} from "../lib/ddragon";
import {
sideShortLabel,
@@ -36,7 +33,12 @@ import {
InternalGameDetailTabBar,
type InternalGameDetailTab,
} from "../components/InternalGameAnalysisTabs";
import { ItemIcon } from "../components/ItemTooltip";
import {
ItemIcon,
RuneIcon,
RuneStyleIcon,
SummonerSpellIcon,
} from "../components/ItemTooltip";
type MatchGameDetail = ApiInternalMatchDetailResponse["games"][number];
type MatchGameTeam = MatchGameDetail["teams"][number];
@@ -258,47 +260,23 @@ function SpellRuneStrip({
participant: MatchGameParticipant;
manifest: ReturnType<typeof useDdragonManifest>["data"];
}) {
const spellIcons = participant.summonerSpells
.map((spellId) => summonerSpellIconUrl(manifest, spellId))
.filter((icon): icon is string => Boolean(icon));
const runeIcons = [
runeKeystoneIconUrl(manifest, participant.perks.keystone),
runeStyleIconUrl(manifest, participant.perks.subStyle),
].filter((icon): icon is string => Boolean(icon));
return (
<div className="flex items-center gap-1.5">
<div className="grid grid-cols-1 gap-0.5">
{[0, 1].map((index) => (
<span
<SummonerSpellIcon
key={`spell-${index}`}
className="h-5 w-5 overflow-hidden bg-base-content/10"
>
{spellIcons[index] ? (
<img
src={spellIcons[index]}
alt=""
className="h-full w-full object-cover"
/>
) : null}
</span>
spellId={participant.summonerSpells[index] ?? 0}
manifest={manifest}
/>
))}
</div>
<div className="grid grid-cols-1 gap-0.5">
{[0, 1].map((index) => (
<span
key={`rune-${index}`}
className="h-5 w-5 overflow-hidden bg-base-content/10"
>
{runeIcons[index] ? (
<img
src={runeIcons[index]}
alt=""
className="h-full w-full object-cover"
/>
) : null}
</span>
))}
<RuneIcon runeId={participant.perks.keystone} manifest={manifest} />
<RuneStyleIcon
styleId={participant.perks.subStyle ?? participant.perks.primaryStyle}
manifest={manifest}
/>
</div>
</div>
);
+28 -65
View File
@@ -32,9 +32,6 @@ import {
championDisplayName,
championIconUrl,
profileIconUrl,
runeKeystoneIconUrl,
runeStyleIconUrl,
summonerSpellIconUrl,
} from "../lib/ddragon";
import {
isRiotQueueGroup,
@@ -49,7 +46,12 @@ import {
InternalGameDetailTabBar,
type InternalGameDetailTab,
} from "../components/InternalGameAnalysisTabs";
import { ItemIcon } from "../components/ItemTooltip";
import {
ItemIcon,
RuneIcon,
RuneStyleIcon,
SummonerSpellIcon,
} from "../components/ItemTooltip";
// recharts가 무거워 메인 번들에서 분리한다 (전적 페이지에서만 로드).
const TierHistoryChart = lazy(() => import("../components/TierHistoryChart"));
@@ -482,33 +484,6 @@ function barPercent(value: number, max: number) {
return Math.max(0, Math.min(100, Math.round((value / max) * 100)));
}
function AssetIcon({
url,
label,
className = "w-4 h-4",
}: {
url: string | null;
label: string;
className?: string;
}) {
return (
<div
className={`${className} bg-base-content/8 overflow-hidden border border-base-content/5`}
title={label}
aria-label={label}
>
{url ? (
<img
src={url}
alt=""
className="w-full h-full object-cover"
loading="lazy"
/>
) : null}
</div>
);
}
function LoadoutIcons({
summonerSpells,
perks,
@@ -520,25 +495,12 @@ function LoadoutIcons({
}) {
return (
<div className="grid grid-cols-2 gap-0.5 shrink-0">
<AssetIcon
url={summonerSpellIconUrl(manifest, summonerSpells[0])}
label="스펠 1"
className="w-5 h-5"
/>
<AssetIcon
url={runeKeystoneIconUrl(manifest, perks.keystone)}
label="핵심 룬"
className="w-5 h-5"
/>
<AssetIcon
url={summonerSpellIconUrl(manifest, summonerSpells[1])}
label="스펠 2"
className="w-5 h-5"
/>
<AssetIcon
url={runeStyleIconUrl(manifest, perks.subStyle ?? perks.primaryStyle)}
label="보조 룬"
className="w-5 h-5"
<SummonerSpellIcon spellId={summonerSpells[0]} manifest={manifest} />
<RuneIcon runeId={perks.keystone} manifest={manifest} />
<SummonerSpellIcon spellId={summonerSpells[1]} manifest={manifest} />
<RuneStyleIcon
styleId={perks.subStyle ?? perks.primaryStyle}
manifest={manifest}
/>
</div>
);
@@ -654,24 +616,25 @@ function ParticipantRow({
)}
</div>
<div className="grid grid-cols-2 gap-0.5 shrink-0">
<AssetIcon
url={summonerSpellIconUrl(manifest, participant.summonerSpells[0])}
label="스펠 1"
<SummonerSpellIcon
spellId={participant.summonerSpells[0]}
manifest={manifest}
className="h-4 w-4"
/>
<AssetIcon
url={runeKeystoneIconUrl(manifest, participant.perks.keystone)}
label="핵심 룬"
<RuneIcon
runeId={participant.perks.keystone}
manifest={manifest}
className="h-4 w-4"
/>
<AssetIcon
url={summonerSpellIconUrl(manifest, participant.summonerSpells[1])}
label="스펠 2"
<SummonerSpellIcon
spellId={participant.summonerSpells[1]}
manifest={manifest}
className="h-4 w-4"
/>
<AssetIcon
url={runeStyleIconUrl(
manifest,
participant.perks.subStyle ?? participant.perks.primaryStyle,
)}
label="보조 룬"
<RuneStyleIcon
styleId={participant.perks.subStyle ?? participant.perks.primaryStyle}
manifest={manifest}
className="h-4 w-4"
/>
</div>
<div className="min-w-0">