feat: add hub URL options for chakra-tile linking

The webapp's chakra hub page (src/pages/Hub.vue) reads
VITE_HUB_<NAME>_URL at runtime to decide where each module tile
points. Without these env vars set, hubLink() returns null and
every chakra tile renders ghosted (non-link), which makes the hub
look broken on first visit.

Adds 7 new options on services.webapp:
  hubActivitiesUrl, hubCastleUrl, hubWalletUrl, hubChatUrl,
  hubForumUrl, hubMarketUrl, hubTasksUrl

Each maps 1:1 to VITE_HUB_<NAME>_URL during the buildNpmPackage
build phase. All default to "" which preserves the
ghosted-when-unset behaviour for hosts that don't deploy a given
module.

Per-host usage:

  services.webapp = {
    enable = true;
    hubMarketUrl     = "https://demo.${domain}/market/";
    hubChatUrl       = "https://demo.${domain}/chat/";
    hubWalletUrl     = "https://demo.${domain}/wallet/";
    hubForumUrl      = "https://demo.${domain}/forum/";
    hubTasksUrl      = "https://demo.${domain}/tasks/";
    hubActivitiesUrl = "https://demo.${domain}/sortir/";
    hubCastleUrl     = "https://demo.${domain}/castle/";
    ...
  };

Trailing-slash convention is recommended under path-mode deployment
to avoid an asset-resolution round-trip; see the webapp repo's
.env.example for the rationale.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Padreug 2026-05-02 16:23:21 +02:00
commit 8dff6af7ac

View file

@ -60,6 +60,22 @@ let
# Demo Mode # Demo Mode
VITE_DEMO_MODE = if cfg.demoMode then "true" else "false"; VITE_DEMO_MODE = if cfg.demoMode then "true" else "false";
# Hub → standalone navigation URLs.
# The chakra tiles in src/pages/Hub.vue build <a href> from these. With
# path-mode deployment, set these to canonical trailing-slash URLs:
# hubMarketUrl = "https://demo.example.com/market/";
# With subdomain deployment:
# hubMarketUrl = "https://market.example.com";
# When unset (empty string), the corresponding chakra renders ghosted
# (non-link) — useful for hosts that don't deploy a given module.
VITE_HUB_ACTIVITIES_URL = cfg.hubActivitiesUrl;
VITE_HUB_CASTLE_URL = cfg.hubCastleUrl;
VITE_HUB_WALLET_URL = cfg.hubWalletUrl;
VITE_HUB_CHAT_URL = cfg.hubChatUrl;
VITE_HUB_FORUM_URL = cfg.hubForumUrl;
VITE_HUB_MARKET_URL = cfg.hubMarketUrl;
VITE_HUB_TASKS_URL = cfg.hubTasksUrl;
# Additional env vars # Additional env vars
NODE_ENV = "production"; NODE_ENV = "production";
@ -217,6 +233,53 @@ in {
description = "Enable demo mode with auto-generated demo accounts on the login page"; description = "Enable demo mode with auto-generated demo accounts on the login page";
}; };
# Hub → standalone navigation URLs (one per chakra tile).
# Empty string = tile rendered ghosted (no link). Set per-host based on
# whether each standalone is deployed and on the deployment shape
# (path-mode → trailing slash recommended; subdomain-mode → no path).
hubActivitiesUrl = lib.mkOption {
type = lib.types.str;
default = "";
example = "https://demo.example.com/sortir/";
description = "URL the chakra hub's Activities tile links to";
};
hubCastleUrl = lib.mkOption {
type = lib.types.str;
default = "";
example = "https://demo.example.com/castle/";
description = "URL the chakra hub's Castle tile links to";
};
hubWalletUrl = lib.mkOption {
type = lib.types.str;
default = "";
example = "https://demo.example.com/wallet/";
description = "URL the chakra hub's Wallet tile links to";
};
hubChatUrl = lib.mkOption {
type = lib.types.str;
default = "";
example = "https://demo.example.com/chat/";
description = "URL the chakra hub's Chat tile links to";
};
hubForumUrl = lib.mkOption {
type = lib.types.str;
default = "";
example = "https://demo.example.com/forum/";
description = "URL the chakra hub's Forum tile links to";
};
hubMarketUrl = lib.mkOption {
type = lib.types.str;
default = "";
example = "https://demo.example.com/market/";
description = "URL the chakra hub's Market tile links to";
};
hubTasksUrl = lib.mkOption {
type = lib.types.str;
default = "";
example = "https://demo.example.com/tasks/";
description = "URL the chakra hub's Tasks tile links to";
};
enableSSL = lib.mkOption { enableSSL = lib.mkOption {
type = lib.types.bool; type = lib.types.bool;
default = true; default = true;