From 085ba502da8961f8da6413a7649d1069b8776c0c Mon Sep 17 00:00:00 2001 From: "Fabian @ Blax Software" Date: Thu, 29 Oct 2026 01:26:08 +0100 Subject: [PATCH] feat: dense, plain UI like the old browser strategy games One centred column with a dark main menu whose entries open dropdowns of their sub-pages, a quick bar of village screens, one village row with the stock in thin cells, thin notices and framed content. A 14 px base, square frames, tan header bands, tight tables, small squared buttons; box tabs on building screens and a left sub-menu on list pages (reports by kind, linked from the menu dropdown). Co-Authored-By: Claude Opus 5.5 --- CLAUDE.md | 4 +- app/assets/css/main.css | 58 ++++++-- app/components/game/MenuBar.vue | 159 ++++++++++++--------- app/components/game/ProtectionBar.vue | 6 +- app/components/game/Resource.vue | 10 +- app/components/game/TabBar.vue | 4 +- app/components/game/VillageBar.vue | 142 +++++++++--------- app/components/game/VillageFrame.vue | 43 +++--- app/components/map/FieldPopup.vue | 2 +- app/components/ui/SideMenu.vue | 22 +++ app/components/ui/SubTabs.vue | 12 +- app/components/village/BuildForm.vue | 9 +- app/components/village/BuildingCard.vue | 2 +- app/components/village/FoodWarning.vue | 6 +- app/components/village/OverviewSidebar.vue | 11 +- app/components/village/PlotCard.vue | 2 +- app/components/village/Recruit.vue | 7 +- app/components/village/ScreenHeader.vue | 14 +- app/components/village/SendTroops.vue | 2 +- app/layouts/game.vue | 12 +- app/pages/map/[worldId].vue | 14 +- app/pages/reports/[worldId]/[id].vue | 2 +- app/pages/reports/[worldId]/index.vue | 110 +++++++------- app/pages/village/[id]/build.vue | 4 +- app/pages/village/[id]/index.vue | 8 +- app/pages/village/[id]/rally.vue | 6 +- app/pages/village/[id]/recruit.vue | 4 +- app/pages/village/[id]/workforce.vue | 4 +- 28 files changed, 376 insertions(+), 303 deletions(-) create mode 100644 app/components/ui/SideMenu.vue diff --git a/CLAUDE.md b/CLAUDE.md index f2686eb..f5eec09 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -7,10 +7,10 @@ This is the Nuxt client for a browser strategy game in the style of Tribal Wars. - **The client is a view.** It sends intents over WS and renders what the server returns. It never computes costs, durations, combat, or loot. The only computation it does is projecting resources (`stored + rate × elapsed`) and countdowns from server timestamps. It refetches when a countdown reaches zero or a `village:updated` push arrives. - **`ssr: false` for every target**, so one static build serves both the web and Steam. Code must not rely on Nuxt server routes or SSR-only APIs. - **Transport** is WS-first through the `ws` singleton from `@blax-software/networking`, the same as learn-atc. HTTP is only for login and register, which return the bearer token. Load the `blax-websockets` skill before you write `ws.send` or `ws.listen` code. -- **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. +- **Dense and plain, like the old browser strategy games** (the reference is Die Stämme; notes and screenshots in `../research/die-staemme/`, not in git). A 14 px base, square frames with thin lines, tan header bands, tight table rows (`.grid-table`), small squared buttons (`.btn-primary` dark wood, `.btn-attack` red for attacks only), thin notice bars. No rounded cards, pills, big padding or decorative icons: an icon only where it carries meaning. Theme and component classes live in `app/assets/css/main.css`; hand-written inline SVG graphics in `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, and nothing copied from Die Stämme. - **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. 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. +- **One game shell, like Die Stämme.** Everything sits in one centred column (1100 px). Pages inside a world (village screens, map, reports) use `layouts/game.vue`: the dark main menu (`GameMenuBar`: village, map, reports with its count inline, each with a hover dropdown of its sub-pages; server clock; account dropdown), then the village header (`GameVillageBar`: a quick bar with the village's screens, and one row with the village, its stock in thin cells and incoming troops), thin notices, and the content in a `.frame`. On phones the screens move to a bottom tab bar (`GameTabBar`). The header'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()`. Pages outside a world use `layouts/default.vue` (menu only). A page has one of two shapes: a title with box tabs (`UiSubTabs`: buildings like the rally point) or a title with a sub-menu on the left (`UiSideMenu`: lists like reports). One key per screen (`useShortcuts`): V overview, H headquarters, T recruit, P rally point, W workforce, M map, R reports. The overview stays clean: the village and a narrow column of boxes (incoming attacks, production, units, population, construction); tables live on the building screens. The map shows a popup over a hovered village and actions under a clicked one. - 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/assets/css/main.css b/app/assets/css/main.css index 89b1fb8..e30a18c 100644 --- a/app/assets/css/main.css +++ b/app/assets/css/main.css @@ -45,41 +45,59 @@ --shadow-hard: 3px 3px 0 0 rgb(47 32 19 / 0.35); } +/* + * Dense on purpose, like the old browser strategy games: a 14 px base (every rem + * shrinks with it), square frames, thin lines, tan header bands, tight table rows. + * No rounded cards, no pills, no big padding; icons only where they carry meaning. + */ @layer base { + html { + font-size: 14px; + } body { - @apply bg-parchment-100 font-sans text-ink-900 antialiased; + @apply bg-[#cdb488] font-sans text-ink-900 antialiased; } button:not(:disabled), [role="button"]:not(:disabled) { cursor: pointer; } + + /* Tables in frames: a header band, tight rows, thin lines between them. */ + .panel table th { + @apply font-semibold; + } } @layer components { .panel { - @apply rounded-md border-2 border-wood-700 bg-parchment-50 shadow-hard; + @apply border border-wood-700 bg-parchment-50; } .panel-head { - @apply flex flex-wrap items-center justify-between gap-2 border-b-2 border-wood-700 bg-parchment-200 px-4 py-2.5; + @apply flex flex-wrap items-center justify-between gap-2 border-b border-wood-700 bg-parchment-300 px-2 py-1; } .panel-title { - @apply font-display text-lg font-semibold text-wood-900; + @apply font-display text-[15px] leading-snug font-semibold text-wood-950; font-variant: small-caps; letter-spacing: 0.02em; } .panel-body { - @apply p-4; + @apply p-2.5; } .btn { - @apply inline-flex items-center justify-center gap-1.5 rounded-sm border px-3 py-1.5 text-sm font-semibold transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-gold-500 disabled:cursor-not-allowed disabled:opacity-45; + @apply inline-flex items-center justify-center gap-1 rounded-[2px] border px-2.5 py-1 text-[13px] leading-tight font-semibold focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-gold-500 disabled:cursor-not-allowed disabled:opacity-45; } + /* The everyday button: dark wood with light text. */ .btn-primary { + @apply border-wood-950 bg-wood-800 text-parchment-50 hover:bg-wood-700 disabled:hover:bg-wood-800; + } + /* Attacks only. */ + .btn-attack { @apply border-blood-800 bg-blood-700 text-parchment-50 hover:bg-blood-600 disabled:hover:bg-blood-700; } .btn-outline { - @apply border-wood-600 bg-parchment-50 text-wood-800 hover:bg-parchment-200; + @apply border-wood-600 bg-parchment-100 text-wood-900 hover:bg-parchment-200; } .btn-ghost { @apply border-transparent text-wood-800 hover:bg-parchment-200; @@ -89,17 +107,17 @@ } .input { - @apply w-full rounded-sm border border-wood-600 bg-parchment-50 px-3 py-2 text-ink-900 outline-none placeholder:text-ink-400 focus:border-gold-600 focus:ring-2 focus:ring-gold-500/40; + @apply w-full rounded-none border border-wood-600 bg-[#fbf3df] px-1.5 py-1 text-[13px] text-ink-900 outline-none placeholder:text-ink-400 focus:border-wood-900; } .label { - @apply mb-1 block text-sm font-semibold text-ink-700; + @apply mb-0.5 block text-[13px] font-semibold text-ink-700; } .badge { - @apply inline-flex items-center gap-1 rounded-sm border px-2 py-0.5 text-xs font-semibold whitespace-nowrap; + @apply inline-flex items-center gap-1 border px-1 text-[11px] leading-4 font-semibold whitespace-nowrap; } .badge-plain { - @apply border-wood-600/40 bg-parchment-200 text-ink-700; + @apply border-wood-600/50 bg-parchment-200 text-ink-700; } .badge-gold { @apply border-gold-600 bg-gold-400 text-wood-950; @@ -111,7 +129,23 @@ @apply border-blood-800 bg-blood-700 text-parchment-50; } + /* A thin full-width notice with an (i) and a close cross. */ .alert { - @apply rounded-sm border-2 border-blood-700 bg-[#f0d6c8] px-3 py-2 text-sm text-blood-800; + @apply border border-blood-700 bg-[#f0d6c8] px-2 py-1 text-[13px] text-blood-800; + } + + /* The framed content column on the backdrop. */ + .frame { + @apply border border-wood-900 bg-parchment-100; + } + /* A data table: tan header band, tight rows, thin lines. */ + .grid-table { + @apply w-full border-collapse text-[13px]; + } + .grid-table th { + @apply border-b border-wood-700 bg-parchment-200 px-1.5 py-0.5 text-left text-xs font-semibold text-ink-700; + } + .grid-table td { + @apply border-b border-parchment-300 px-1.5 py-0.5; } } diff --git a/app/components/game/MenuBar.vue b/app/components/game/MenuBar.vue index 13fbad4..c3e57df 100644 --- a/app/components/game/MenuBar.vue +++ b/app/components/game/MenuBar.vue @@ -1,6 +1,8 @@ - +