feat: add spell and rune tooltips
This commit is contained in:
1 parent
4906f665fd
commit
292e37aaac
8 files changed
+404
-161
No files matched your search
@@ -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>
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user