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
@@ -5,7 +5,7 @@ const DDRAGON_BASE = 'https://ddragon.leagueoflegends.com';
|
||||
const DDRAGON_CDN = `${DDRAGON_BASE}/cdn`;
|
||||
const DEFAULT_LOCALE = 'ko_KR';
|
||||
const CACHE_TTL_SECONDS = 24 * 60 * 60;
|
||||
const CACHE_VERSION = 'v4';
|
||||
const CACHE_VERSION = 'v5';
|
||||
const FETCH_TIMEOUT_MS = 10_000;
|
||||
|
||||
export interface DdragonChampionEntry {
|
||||
@@ -16,6 +16,8 @@ export interface DdragonChampionEntry {
|
||||
export interface DdragonSummonerSpellEntry {
|
||||
key: string;
|
||||
name: string;
|
||||
description: string;
|
||||
tooltip: string;
|
||||
}
|
||||
|
||||
export interface DdragonRuneEntry {
|
||||
@@ -23,6 +25,8 @@ export interface DdragonRuneEntry {
|
||||
key: string;
|
||||
icon: string;
|
||||
name: string;
|
||||
shortDesc: string;
|
||||
longDesc: string;
|
||||
}
|
||||
|
||||
export interface DdragonRuneStyleEntry extends DdragonRuneEntry {
|
||||
@@ -66,6 +70,8 @@ interface SummonerSpellDataEntry {
|
||||
key: string;
|
||||
id: string;
|
||||
name: string;
|
||||
description?: string;
|
||||
tooltip?: string;
|
||||
}
|
||||
|
||||
interface SummonerSpellDataResponse {
|
||||
@@ -77,6 +83,8 @@ interface RuneDataEntry {
|
||||
key: string;
|
||||
icon: string;
|
||||
name: string;
|
||||
shortDesc?: string;
|
||||
longDesc?: string;
|
||||
}
|
||||
|
||||
interface RuneStyleDataEntry extends RuneDataEntry {
|
||||
@@ -195,6 +203,9 @@ export class RiotDdragonService {
|
||||
map[entry.key] = {
|
||||
key: entry.id,
|
||||
name: typeof entry.name === 'string' ? entry.name : entry.id,
|
||||
description:
|
||||
typeof entry.description === 'string' ? entry.description : '',
|
||||
tooltip: typeof entry.tooltip === 'string' ? entry.tooltip : '',
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -218,6 +229,9 @@ export class RiotDdragonService {
|
||||
key: style.key,
|
||||
icon: style.icon,
|
||||
name: style.name,
|
||||
shortDesc:
|
||||
typeof style.shortDesc === 'string' ? style.shortDesc : '',
|
||||
longDesc: typeof style.longDesc === 'string' ? style.longDesc : '',
|
||||
slots: (style.slots ?? []).map((slot) => ({
|
||||
runes: (slot.runes ?? [])
|
||||
.filter((rune): rune is RuneDataEntry => isRuneEntry(rune))
|
||||
@@ -226,6 +240,9 @@ export class RiotDdragonService {
|
||||
key: rune.key,
|
||||
icon: rune.icon,
|
||||
name: rune.name,
|
||||
shortDesc:
|
||||
typeof rune.shortDesc === 'string' ? rune.shortDesc : '',
|
||||
longDesc: typeof rune.longDesc === 'string' ? rune.longDesc : '',
|
||||
})),
|
||||
})),
|
||||
}));
|
||||
|
||||
Reference in new issue
Block a user