// ── The module's own client paths, in one place ──────────────────────────── // // Every link a notification puts in front of a player is a path into this // module's SPA routes, and Phase 11b's live walk found that not one of them was // right: the declared examples all read `/shard/…` (module.json's `mounts`), the // bodies hard-coded a mixture of `/shard/…` and `/player/uo/…`, and the mapper // populated none of the URL variables at all — so every in-universe letter shipped // with an empty href and every template preview showed a dead one. // // **The prefix is the module ID, not the mount.** `registry.registerRoutes` // prefixes a module's client routes with `/` and nothing else // (`client/src/modules/registry.js`), which is why `module.json`'s `mounts` is not // the answer — that field says what the module CLAIMS, and the router says where // it landed. `client/src/entry.jsx`'s own `registerNav` is the check: the hrefs it // gives the sidebar are these, and if the two ever disagree the sidebar is right. // // Kept server-side and shared by BOTH the trigger declarations (their `example`s, // which the template editor previews and test-sends with) and the seeded bodies, // so a route that moves is one edit rather than thirty. const ID = 'uo' const PATHS = { shard: `/${ID}/shard`, champs: `/${ID}/champs`, guilds: `/${ID}/guilds`, governors: `/${ID}/governors`, houses: `/${ID}/houses`, atlas: `/${ID}/atlas`, leaderboards: `/${ID}/leaderboards`, market: `/${ID}/market`, // Self-service and staff areas sit under core's own wrappers, so they carry // core's prefix as well as the module's. characters: `/player/${ID}/characters`, ops: `/admin/${ID}/ops`, } /** One guild's roster, when the frame names a guild; the list otherwise. */ const guildPath = (guildId) => (guildId === undefined || guildId === null ? PATHS.guilds : `${PATHS.guilds}/${guildId}`) /** One vendor's page, when the frame names one; the market otherwise. */ const vendorPath = (serial) => (serial ? `${PATHS.market}/vendors/${serial}` : PATHS.market) module.exports = { PATHS, guildPath, vendorPath }