|
| 1 | +// @ts-check |
| 2 | + |
| 3 | +/** |
| 4 | + * Resolve showcase event icon metadata for marker and popup rendering. |
| 5 | + * @param {{ |
| 6 | + * display_type: number | string, |
| 7 | + * showcase_pokemon_id?: number | null, |
| 8 | + * showcase_pokemon_form_id?: number | null, |
| 9 | + * showcase_pokemon_type_id?: number | null, |
| 10 | + * }} event |
| 11 | + * @param {any} Icons |
| 12 | + * @returns {{ |
| 13 | + * url: string, |
| 14 | + * decoration: boolean, |
| 15 | + * tooltipKey: string | null, |
| 16 | + * sizeFilterKey: string, |
| 17 | + * }} |
| 18 | + */ |
| 19 | +export function resolveShowcaseEventIcon(event, Icons) { |
| 20 | + if (event.showcase_pokemon_id) { |
| 21 | + const formId = event.showcase_pokemon_form_id ?? 0 |
| 22 | + return { |
| 23 | + url: Icons.getPokemon(event.showcase_pokemon_id, formId), |
| 24 | + decoration: true, |
| 25 | + tooltipKey: `poke_${event.showcase_pokemon_id}`, |
| 26 | + sizeFilterKey: `f${event.showcase_pokemon_id}-${formId}`, |
| 27 | + } |
| 28 | + } |
| 29 | + if (event.showcase_pokemon_type_id) { |
| 30 | + return { |
| 31 | + url: Icons.getTypes(event.showcase_pokemon_type_id), |
| 32 | + decoration: true, |
| 33 | + tooltipKey: `poke_type_${event.showcase_pokemon_type_id}`, |
| 34 | + sizeFilterKey: `h${event.showcase_pokemon_type_id}`, |
| 35 | + } |
| 36 | + } |
| 37 | + return { |
| 38 | + url: Icons.getEventStops(event.display_type), |
| 39 | + decoration: false, |
| 40 | + tooltipKey: null, |
| 41 | + sizeFilterKey: `b${event.display_type}`, |
| 42 | + } |
| 43 | +} |
0 commit comments