feat: spin the wheel, objednavani scrape menu, historie cen
CI / Generate TypeScript types (push) Successful in 11s
CI / Server unit tests (push) Successful in 25s
CI / Build server (push) Successful in 29s
CI / Build client (push) Successful in 39s
CI / Playwright E2E tests (push) Successful in 1m52s
CI / Build and push Docker image (push) Successful in 51s
CI / Notify (push) Successful in 2s

This commit is contained in:
batmanisko committed 2026-09-23 15:41:15 +02:00
1 parent 682deaf20b
commit e281615cc3
35 files changed
+3979 -15

No files matched your search

+23
View File
@@ -0,0 +1,23 @@
/** Postavy Umamusume (chibi obrázky / portréty + hláška) — server obrázky cachuje, viz server/src/confetti.ts. */
const UMA_CHARACTERS_URL = '/api/confetti/umamusume';
/** `round` = čtvercový portrét, zobrazí se jako kulatá samolepka (chibi obrázky jsou průhledné). */
export type UmaCharacter = { name: string, quote?: string, round?: boolean, images: string[], /** portrét pro malé odznaky */ icon?: string };
let umaCharactersPromise: Promise<UmaCharacter[]> | undefined;
/**
* Načte seznam postav (jednou za běh aplikace). Při chybě vrátí prázdný seznam
* a výsledek si nepamatuje — příště se zkusí znovu (např. po restartu serveru).
*/
export function loadUmaCharacters(): Promise<UmaCharacter[]> {
umaCharactersPromise ??= fetch(UMA_CHARACTERS_URL)
.then(r => r.ok ? r.json() : [])
.then(list => Array.isArray(list) ? list.filter((c: UmaCharacter) => Array.isArray(c?.images)) : [])
.catch(() => [])
.then((list: UmaCharacter[]) => {
if (list.length === 0) umaCharactersPromise = undefined;
return list;
});
return umaCharactersPromise;
}