feat: add item tooltips to match history

This commit is contained in:
dahyeon committed 2026-06-26 23:07:06 -07:00
1 parent 38c2d1f1b4
commit 68afaf0cb8
8 files changed
+477 -49

No files matched your search

+11 -14
View File
@@ -5,7 +5,6 @@ import { DEFAULT_COMMUNITY_ID } from "../config";
import {
championDisplayName,
championIconUrl,
itemIconUrl,
} from "../lib/ddragon";
import {
sideShortLabel,
@@ -14,6 +13,7 @@ import {
} from "../lib/league";
import { internalMatchGamePath } from "../lib/internal-match-routes";
import { LANE_LABELS } from "../lib/riot-history";
import { ItemIcon } from "../components/ItemTooltip";
function formatDateTime(value: string | number) {
return new Intl.DateTimeFormat("ko-KR", {
@@ -72,19 +72,16 @@ function ItemStrip({
}) {
return (
<div className="flex flex-wrap gap-1">
{[...items, trinket].map((itemId, index) => {
const icon = itemIconUrl(manifest, itemId);
return (
<span
key={`${itemId}-${index}`}
className="w-5 h-5 bg-base-content/10 border border-base-content/5 overflow-hidden"
>
{icon ? (
<img src={icon} alt="" className="w-full h-full object-cover" />
) : null}
</span>
);
})}
{[...items, trinket].map((itemId, index) => (
<ItemIcon
key={`${itemId}-${index}`}
itemId={itemId}
manifest={manifest}
trinket={index === items.length}
className="h-5 w-5"
imageClassName=""
/>
))}
</div>
);
}
+11 -14
View File
@@ -17,7 +17,6 @@ import { DEFAULT_COMMUNITY_ID } from "../config";
import {
championDisplayName,
championIconUrl,
itemIconUrl,
runeIconUrl,
runeKeystoneIconUrl,
runeStyleIconUrl,
@@ -33,6 +32,7 @@ import {
internalMatchGamePath,
} from "../lib/internal-match-routes";
import { LANE_LABELS } from "../lib/riot-history";
import { ItemIcon } from "../components/ItemTooltip";
type MatchGameDetail = ApiInternalMatchDetailResponse["games"][number];
type MatchGameTeam = MatchGameDetail["teams"][number];
@@ -382,19 +382,16 @@ function ItemStrip({
return (
<div className="grid grid-cols-7 gap-0.5">
{itemIds.map((itemId, index) => {
const icon = itemIconUrl(manifest, itemId);
return (
<span
key={`${itemId}-${index}`}
className="h-8 w-8 overflow-hidden border border-base-content/5 bg-base-content/10"
>
{icon ? (
<img src={icon} alt="" className="h-full w-full object-cover" />
) : null}
</span>
);
})}
{itemIds.map((itemId, index) => (
<ItemIcon
key={`${itemId}-${index}`}
itemId={itemId}
manifest={manifest}
trinket={index === 6}
className="h-8 w-8"
imageClassName=""
/>
))}
</div>
);
}
+11 -19
View File
@@ -29,7 +29,6 @@ import { ApiError } from "../lib/api";
import {
championDisplayName,
championIconUrl,
itemIconUrl,
profileIconUrl,
runeKeystoneIconUrl,
runeStyleIconUrl,
@@ -43,6 +42,7 @@ import {
RANK_FILTER_TABS,
} from "../lib/riot-history";
import { ResponsiveTierLabel } from "../components/RankBadge";
import { ItemIcon } from "../components/ItemTooltip";
// recharts가 무거워 메인 번들에서 분리한다 (전적 페이지에서만 로드).
const TierHistoryChart = lazy(() => import("../components/TierHistoryChart"));
@@ -344,24 +344,16 @@ function ItemGrid({
return (
<div className={`grid gap-1 ${layoutClass}`}>
{slots.map((itemId, index) => {
const url = itemIconUrl(manifest, itemId);
return (
<div
key={`${itemKey}-item-${index}`}
className="w-5 h-5 bg-base-content/8 overflow-hidden border border-base-content/5"
>
{url ? (
<img
src={url}
alt=""
className="w-full h-full object-cover"
loading="lazy"
/>
) : null}
</div>
);
})}
{slots.map((itemId, index) => (
<ItemIcon
key={`${itemKey}-item-${index}`}
itemId={itemId}
manifest={manifest}
trinket={index === 6}
className="h-5 w-5"
imageClassName=""
/>
))}
</div>
);
}