Add the Sokko TCG collectible card mini-game
Add the server-backed card game: Discord login, recharging pack openings, album, trades, gifts, stardust shop, campaign codes and its administration, stored in SQLite and disabled in production until configured. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
243465720f
commit
5ce35cd7ba
193 changed files with 12159 additions and 28 deletions
19
website/src/features/cards/useCardsConfig.js
Normal file
19
website/src/features/cards/useCardsConfig.js
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
// Rôle : détecte la disponibilité de Sokko TCG et partage son catalogue public.
|
||||
import { useCallback, useEffect, useState } from "react";
|
||||
import { loadCardsConfig } from "./cardsApi.js";
|
||||
|
||||
export function useCardsConfig() {
|
||||
const [config, setConfig] = useState({ loading: true, enabled: false, devAuth: false, catalog: null, error: "" });
|
||||
useEffect(() => {
|
||||
let active = true;
|
||||
loadCardsConfig()
|
||||
.then((value) => { if (active) setConfig({ loading: false, error: "", ...value }); })
|
||||
.catch((error) => { if (active) setConfig({ loading: false, enabled: false, devAuth: false, catalog: null, error: error.message }); });
|
||||
return () => { active = false; };
|
||||
}, []);
|
||||
// Remplace le catalogue publié après une modification admin, sans recharger la configuration.
|
||||
const replaceCatalog = useCallback((catalog) => {
|
||||
if (catalog) setConfig((current) => ({ ...current, catalog }));
|
||||
}, []);
|
||||
return { ...config, replaceCatalog };
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue