diff --git a/CLAUDE.md b/CLAUDE.md index a9a8cda..f2686eb 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -10,7 +10,7 @@ This is the Nuxt client for a browser strategy game in the style of Tribal Wars. - **Light Tailwind UI** (Tailwind 4, theme and component classes like `.panel`, `.btn` in `app/assets/css/main.css`) with simple hand-written inline SVG graphics (`app/components/icon/`, colours in `app/utils/palette.ts`). No paid, hosted or licensed assets: no icon packs, web fonts or images from outside the repo. - **The village is a ground-level land view** (`app/components/village/Diorama.vue`, geometry in `app/diorama/`): isometric low-poly, drawn as inline SVG, no WebGL. The land fills the frame edge to edge (no island, no sky), cut to the container's shape; narrow screens scroll sideways. There are no tiles or positions: the server only sends each building's `space` and the village's `space.used/max`, and the client lays everything out deterministically in id order. The village core sits in the middle (headquarters on the plaza, storage, hiding places and rally point around it, inside the wall ring when there is one, a dirt edge without). Resource sites stand outside in their zones: iron mines at the rocky hill (upper left), clay pits on clay ground (lower left), timber camps at the forest edge (lower right), farms with fields (right); dirt roads lead from the gates to each zone and forest fills the rest. Levels start at 1. Each type has a model per level tier (1–4, 5–14, 15+); the wall goes stakes → timber → stone with towers. Buildings are focusable buttons that open their details card; a type that doesn't stand yet keeps an invisible empty plot that opens its build card. Buildings never move or light up on hover: only a click outlines the ground under them. Ambient life is welcome and stays out of the way: flat ground shadows, smoke from chimneys, forges and kilns, villagers walking the roads to the zones they work in; all motion stops under `prefers-reduced-motion`. The same models draw the building portraits on screen headers, the HQ list and the building cards (`VillageBuildingPortrait`). The world map groups forests, lakes and rocky hills by smooth noise of the coordinates, and village markers grow in five sizes with points. - **Flat medieval colours only**, in the diorama and everywhere else: no gradients (CSS or SVG), no blur or backdrop-blur, no SVG filters or glows, no translucent overlays. Depth comes from the three flat shades per face in `app/diorama/iso.ts`, solid borders and hard shadows. Keep components small and typed, with state in composables (`useVillage`, `useWorld`). -- **One game shell, like Die Stämme.** Pages inside a world (village screens, map, reports) use `layouts/game.vue`: the dark menu bar (`GameMenuBar`: village, map, reports with the unread count, server clock, account menu), then the sticky village bar (`GameVillageBar`: which village, stock with storage meters, incoming troops, and the village's screens as tabs: Overview, Headquarters, Recruit, Rally point, Workforce). On phones the screens move to a bottom tab bar (`GameTabBar`). The bar's village is the URL's on village screens and the last opened one elsewhere; `GameVillageFrame` holds its one `useVillage()` and shares it through `useVillageContext()`, so the map and reports keep the village on top. Pages outside a world use `layouts/default.vue` (menu bar only). The overview stays clean: the village and a narrow column of boxes (incoming attacks, production, units, population, construction); tables live on the building screens. +- **One game shell, like Die Stämme.** Pages inside a world (village screens, map, reports) use `layouts/game.vue`: the dark menu bar (`GameMenuBar`: village, map, reports with the unread count, server clock, account menu), then the sticky village bar (`GameVillageBar`: which village, stock with storage meters, incoming troops, and the village's screens as tabs: Overview, Headquarters, Recruit, Rally point, Workforce). On phones the screens move to a bottom tab bar (`GameTabBar`). The bar's village is the URL's on village screens and the last opened one elsewhere; `GameVillageFrame` holds its one `useVillage()` and shares it through `useVillageContext()`, so the map and reports keep the village on top. One key per screen (`useShortcuts`): V overview, H headquarters, T recruit, P rally point, W workforce, M map, R reports. A building screen splits its parts into `UiSubTabs` (the rally point: commands, troops, simulator); the map shows a popup over a hovered village and actions under a clicked one. Pages outside a world use `layouts/default.vue` (menu bar only). The overview stays clean: the village and a narrow column of boxes (incoming attacks, production, units, population, construction); tables live on the building screens. - All user-facing text goes through i18n keys, with `en` as the first locale. Sources are `i18n/locales/` and `i18n/pages/` (`@blax-software/i18n` layout); register a new page file in `i18n/messageloader.ts`. ## Mock server diff --git a/app/components/game/MenuBar.vue b/app/components/game/MenuBar.vue index 4c8bb84..13fbad4 100644 --- a/app/components/game/MenuBar.vue +++ b/app/components/game/MenuBar.vue @@ -25,6 +25,9 @@ const links = computed(() => { ] }) +/** The key that opens a menu entry (the village link opens its overview). */ +const shortcutOf = (key: string) => SHORTCUTS[(key === 'village' ? 'overview' : key) as keyof typeof SHORTCUTS].toUpperCase() + const connection = computed(() => isMockServer ? { text: t('app.mock'), tone: 'bg-gold-400' } @@ -58,6 +61,7 @@ watch(() => route.fullPath, () => menu.value?.removeAttribute('open')) class="menu-link" :class="{ 'menu-link-active': l.active }" :aria-current="l.active ? 'page' : undefined" + :title="t('app.shortcut', { key: shortcutOf(l.key) })" > diff --git a/app/components/game/ProtectionBar.vue b/app/components/game/ProtectionBar.vue new file mode 100644 index 0000000..9fa54b4 --- /dev/null +++ b/app/components/game/ProtectionBar.vue @@ -0,0 +1,44 @@ + + + + diff --git a/app/components/game/VillageBar.vue b/app/components/game/VillageBar.vue index 1dd95db..2fc0bd5 100644 --- a/app/components/game/VillageBar.vue +++ b/app/components/game/VillageBar.vue @@ -75,14 +75,10 @@ async function rename() {
- + + + + @@ -104,6 +100,7 @@ async function rename() { class="tab" :class="{ 'tab-active': isActive(s.path) }" :aria-current="isActive(s.path) ? 'page' : undefined" + :title="$t('app.shortcut', { key: SHORTCUTS[s.name].toUpperCase() })" > {{ $t(`village.screens.${s.name}`) }} diff --git a/app/components/game/VillageFrame.vue b/app/components/game/VillageFrame.vue index ee59b46..946f55d 100644 --- a/app/components/game/VillageFrame.vue +++ b/app/components/game/VillageFrame.vue @@ -11,11 +11,27 @@ const { enter } = useCurrentWorld() watch(v.village, (state) => { if (state) enter(state.world_id, state.id) }) + +// One key per screen of the world, as the tab titles show. +useShortcuts(() => { + const base = `/village/${props.villageId}` + const worldId = v.village.value?.world_id + return { + ...Object.fromEntries(VILLAGE_SCREENS.map((s) => [s.name, `${base}${s.path}`])), + ...(worldId ? { map: `/map/${worldId}`, reports: `/reports/${worldId}` } : {}), + } +})