Expand website and game trackers
Some checks failed
Test and deploy staging / staging (push) Failing after 5m29s
Some checks failed
Test and deploy staging / staging (push) Failing after 5m29s
This commit is contained in:
15
src/lib/game-tracker/game-art.ts
Normal file
15
src/lib/game-tracker/game-art.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import releases from '../../../data/pokemon-releases.json';
|
||||
import { base } from '$app/paths';
|
||||
|
||||
const dates: Record<string, string> = releases.dates;
|
||||
export function pokemonRelease(slug: string | null) {
|
||||
return dates[slug ?? ''] ?? '';
|
||||
}
|
||||
export function chronologicalPokemon<T extends { slug: string | null; id: number }>(games: T[]) {
|
||||
return [...games].sort(
|
||||
(a, b) => pokemonRelease(a.slug).localeCompare(pokemonRelease(b.slug)) || a.id - b.id
|
||||
);
|
||||
}
|
||||
export function pokemonImage(number: number, kind: 'sprite' | 'shiny' | 'artwork' = 'sprite') {
|
||||
return `${base}/game-art/pokemon/${kind}/${number}.webp`;
|
||||
}
|
||||
Reference in New Issue
Block a user