Add ARCHITECTURE.md (layers, flows, folder map, glossary), CONTRIBUTING.md (setup and step-by-step recipes) and a README in each main folder, with an index of docs/. Convert the 511 JavaScript headers from "// Rôle :" lines to JSDoc @file blocks, define a three-level header template in website/AGENTS.md and check the header in tests/file-headers.test.mjs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
19 lines
911 B
JavaScript
19 lines
911 B
JavaScript
/**
|
|
* @file Bornes des réglages de l'administration (Boutique, Guilde) et enregistrement du réglage qu'ils
|
|
* partagent.
|
|
*/
|
|
|
|
import { updateShopSetting } from "../cardsApi.js";
|
|
|
|
export const MAX_VALUE = 100_000;
|
|
export const parse = (value) => (/^\d+$/.test(value) ? Number(value) : NaN);
|
|
export const inRange = (value, min, max) => Number.isInteger(value) && value >= min && value <= max;
|
|
|
|
// Les réglages de la Boutique et de la Guilde forment un seul enregistrement côté serveur : chaque panneau n'envoie que sa
|
|
// partie, le reste vient de l'état enregistré.
|
|
export function shopSettingSaver(setting, runMutation, refreshDashboard) {
|
|
return async (changes) => {
|
|
const next = { ...setting, ...changes };
|
|
if (await runMutation(() => updateShopSetting(next.stardustValues, next.openingPrice, next.shopPackPrice, next.shopPackShare, next.dailyReward))) await refreshDashboard();
|
|
};
|
|
}
|