Show a full reserve count on the Sokko TCG menu icon and remaining openings while opening a pack
A gold count now sits on the Sokko TCG menu icon while the opening reserve is full, so players notice it from any page. A light reserve route keeps it up to date outside the game, and the game page updates it with every state it gets. The opening stage also lists the remaining openings, apart for the automatic recharge and for openings bought one at a time, since the sidebar reserve is hidden there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
2231bf05e1
commit
498e171bc3
14 changed files with 186 additions and 4 deletions
|
|
@ -88,6 +88,7 @@ export function validateSiteContent(site) {
|
|||
"navigation.toolboxes",
|
||||
"navigation.games",
|
||||
"navigation.cards",
|
||||
"navigation.cardsReserveFull",
|
||||
"navigation.library",
|
||||
"navigation.about",
|
||||
"sidebar.badge",
|
||||
|
|
@ -218,6 +219,9 @@ export function validateSiteContent(site) {
|
|||
"cards.packs.probabilities",
|
||||
"cards.packs.back",
|
||||
"cards.packs.openAnother",
|
||||
"cards.packs.remainingLabel",
|
||||
"cards.packs.remainingReserve",
|
||||
"cards.packs.remainingPurchased",
|
||||
"cards.packs.newBadge",
|
||||
"cards.packs.shopShare",
|
||||
"cards.shop.packDescription",
|
||||
|
|
|
|||
|
|
@ -359,3 +359,20 @@ test("cookies carry the __Host- prefix over HTTPS and only the prefixed session
|
|||
assert.equal((await call(handler, { path: "/api/cards/session", headers: { cookie: `sokkog_cards_session=${token}` } })).json.authenticated, false);
|
||||
assert.equal((await call(handler, { path: "/api/cards/session", headers: { cookie: `__Host-sokkog_cards_session=${token}` } })).json.authenticated, true);
|
||||
});
|
||||
|
||||
test("the reserve route answers visitors without an account and returns the player's recharge", async (t) => {
|
||||
const handler = createCardsApiHandler({ projectRoot: resolve("."), enabled: true, devAuth: true, databasePath: ":memory:", env: { NODE_ENV: "test" }, random: () => 0 });
|
||||
t.after(() => handler.close());
|
||||
|
||||
const anonymous = await call(handler, { path: "/api/cards/reserve" });
|
||||
assert.equal(anonymous.status, 200);
|
||||
assert.deepEqual(anonymous.json, { recharge: null });
|
||||
|
||||
const login = await call(handler, { method: "POST", path: "/api/cards/auth/dev", body: {} });
|
||||
const cookie = login.headers["set-cookie"].split(";")[0];
|
||||
const reserve = await call(handler, { path: "/api/cards/reserve", headers: { cookie } });
|
||||
const state = await call(handler, { path: "/api/cards/state", headers: { cookie } });
|
||||
assert.equal(reserve.status, 200);
|
||||
assert.equal(reserve.json.recharge.openingsBalance, state.json.recharge.openingsBalance);
|
||||
assert.equal(reserve.json.recharge.nextOpeningAt, state.json.recharge.nextOpeningAt);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue