fix: building pages: the building's work on the left, its close-up and stats on the right; no village column on pages

A building without its own screen lists every instance of its type with upgrades and Build another.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Fabian @ Blax Software 2026-10-30 12:11:15 +01:00
parent 4134a44652
commit 13f98cf8ae
8 changed files with 109 additions and 86 deletions

File diff suppressed because one or more lines are too long

View File

@ -153,43 +153,24 @@ useShortcuts(() => {
<!-- <!--
Every page of the world across the full width, under the menu and the village bar: on Every page of the world across the full width, under the menu and the village bar: on
the overview the village fills the screen with its boxes docked on the right, the map the overview the village fills the screen with its boxes docked on the right, the map
fills it itself, and every other screen is a page with the village in a right column. fills it itself, and every other screen is a page (building pages: their work on the
left, the building itself on the right).
--> -->
<template> <template>
<div> <div>
<!-- <!-- A screen of its own, across the full width under the menu and the village bar. -->
A screen of its own, across the full width: the screen in the left column, the
village in the right one (wide screens), with the open building outlined there.
-->
<div v-if="page" class="min-h-dvh pb-14 md:pb-0"> <div v-if="page" class="min-h-dvh pb-14 md:pb-0">
<GameMenuBar in-world /> <GameMenuBar in-world />
<div class="space-y-1 px-1 pt-1 sm:px-2"> <div class="space-y-1 px-1 pt-1 sm:px-2">
<GameVillageBar v-if="v.village.value && v.resources.value" :village="v.village.value" :resources="v.resources.value" /> <GameVillageBar v-if="v.village.value && v.resources.value" :village="v.village.value" :resources="v.resources.value" />
<GameVillageNotices :village-id="villageId" /> <GameVillageNotices :village-id="villageId" />
</div> </div>
<div class="flex items-start gap-2 px-1 pt-1.5 pb-4 sm:px-2"> <main class="px-1 pt-1.5 pb-4 sm:px-2">
<main class="min-w-0 flex-1">
<div class="frame @container"> <div class="frame @container">
<div v-if="pageTitle" class="panel-head"><h1 class="panel-title">{{ pageTitle }}</h1></div> <div v-if="pageTitle" class="panel-head"><h1 class="panel-title">{{ pageTitle }}</h1></div>
<slot /> <slot />
</div> </div>
</main> </main>
<aside
v-if="v.village.value"
class="float sticky top-2 hidden h-[calc(100dvh-1rem)] w-[38%] max-w-176 min-w-96 shrink-0 overflow-hidden border border-wood-900 lg:block"
:aria-label="$t('village.diorama.title')"
>
<VillageDiorama
:selected="selected"
fill
:village="v.village.value"
:resources="v.resources.value"
:seconds-until="v.secondsUntil"
@update:selected="(id) => id !== null && (selected = id)"
@update:plot="(type) => (plot = type)"
/>
</aside>
</div>
</div> </div>
<template v-else> <template v-else>

View File

@ -0,0 +1,15 @@
<!--
A building's page: what the building is for on the left (the construction list,
recruiting, commands), the building itself on the right (its close-up and stats),
staying in view while the left side scrolls. Narrow screens stack the building first.
-->
<template>
<div class="grid items-start gap-3 p-2.5 @5xl:grid-cols-[minmax(0,1fr)_minmax(22rem,30rem)]">
<div class="@container order-2 min-w-0 space-y-3 @5xl:order-1">
<slot />
</div>
<aside class="@container order-1 min-w-0 space-y-3 @5xl:sticky @5xl:top-2 @5xl:order-2">
<slot name="side" />
</aside>
</div>
</template>

View File

@ -17,7 +17,8 @@ function showBuilding(id: number) {
<!-- The headquarters screen: every building to construct, upgrade or tear down, and the queue. --> <!-- The headquarters screen: every building to construct, upgrade or tear down, and the queue. -->
<template> <template>
<div class="space-y-3 p-2.5"> <VillageScreenLayout>
<template #side>
<VillageBuildingHeader <VillageBuildingHeader
v-if="hq" v-if="hq"
:building="hq" :building="hq"
@ -30,6 +31,8 @@ function showBuilding(id: number) {
@priority="v.setPriority" @priority="v.setPriority"
/> />
<VillageScreenHeader v-else type="headquarters" :level="null" :title="$t('buildings.headquarters')" :description="$t('village.about.build')" /> <VillageScreenHeader v-else type="headquarters" :level="null" :title="$t('buildings.headquarters')" :description="$t('village.about.build')" />
</template>
<div class="grid gap-3 @4xl:grid-cols-[minmax(0,1fr)_18rem]"> <div class="grid gap-3 @4xl:grid-cols-[minmax(0,1fr)_18rem]">
<VillageBuildForm <VillageBuildForm
:options="village.buildable" :options="village.buildable"
@ -52,5 +55,5 @@ function showBuilding(id: number) {
@cancel="v.cancel" @cancel="v.cancel"
/> />
</div> </div>
</div> </VillageScreenLayout>
</template> </template>

View File

@ -14,7 +14,8 @@ watch(building, (b) => {
<!-- Inside one building: the close-up, what it does and what can be done with it. --> <!-- Inside one building: the close-up, what it does and what can be done with it. -->
<template> <template>
<div v-if="building" class="p-2.5"> <VillageScreenLayout v-if="building">
<template #side>
<VillageBuildingHeader <VillageBuildingHeader
:building="building" :building="building"
:title="buildingName(village, building, t)" :title="buildingName(village, building, t)"
@ -25,5 +26,19 @@ watch(building, (b) => {
@demolish="v.demolish" @demolish="v.demolish"
@priority="v.setPriority" @priority="v.setPriority"
/> />
</div> </template>
<!-- Every building of this type, and one more: the headquarters list for just this type. -->
<VillageBuildForm
:options="village.buildable.filter((o) => o.type === building!.type)"
:buildings="village.buildings.filter((b) => b.type === building!.type)"
:space="village.space"
:resources="resources"
:can-afford="v.canAfford"
:busy="v.busy.value"
@build="v.build"
@upgrade="v.upgrade"
@demolish="v.demolish"
@select="(id: number) => navigateTo(`/village/${route.params.id}/building/${id}`)"
/>
</VillageScreenLayout>
</template> </template>

View File

@ -28,7 +28,8 @@ const home = computed(() => unitRows(village.value.troops))
<!-- The rally point: send troops and follow them, see where the troops are, and simulate battles. --> <!-- The rally point: send troops and follow them, see where the troops are, and simulate battles. -->
<template> <template>
<div class="space-y-3 p-2.5"> <VillageScreenLayout>
<template #side>
<VillageBuildingHeader <VillageBuildingHeader
v-if="rallyPoint" v-if="rallyPoint"
:building="rallyPoint" :building="rallyPoint"
@ -41,6 +42,8 @@ const home = computed(() => unitRows(village.value.troops))
@priority="v.setPriority" @priority="v.setPriority"
/> />
<VillageScreenHeader v-else type="rally_point" :level="null" :title="$t('buildings.rally_point')" :description="$t('village.about.rally')" /> <VillageScreenHeader v-else type="rally_point" :level="null" :title="$t('buildings.rally_point')" :description="$t('village.about.rally')" />
</template>
<UiSubTabs v-model="tab" :tabs="tabs" /> <UiSubTabs v-model="tab" :tabs="tabs" />
<div v-if="tab === 'commands'" class="grid gap-3 @4xl:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]"> <div v-if="tab === 'commands'" class="grid gap-3 @4xl:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]">
@ -93,5 +96,5 @@ const home = computed(() => unitRows(village.value.troops))
</div> </div>
<VillageSimulator v-else :world-id="village.world_id" :troops="village.troops" open /> <VillageSimulator v-else :world-id="village.world_id" :troops="village.troops" open />
</div> </VillageScreenLayout>
</template> </template>

View File

@ -17,7 +17,8 @@ const { t } = useI18n()
<!-- Recruiting at every military building, the troops at home and the levy. --> <!-- Recruiting at every military building, the troops at home and the levy. -->
<template> <template>
<div class="space-y-3 p-2.5"> <VillageScreenLayout>
<template #side>
<VillageBuildingHeader <VillageBuildingHeader
v-if="shownBuilding" v-if="shownBuilding"
:building="shownBuilding" :building="shownBuilding"
@ -36,6 +37,8 @@ const { t } = useI18n()
:title="shown ? $t(`buildings.${shown.type}`) : $t('village.screens.recruit')" :title="shown ? $t(`buildings.${shown.type}`) : $t('village.screens.recruit')"
:description="$t('village.about.recruit')" :description="$t('village.about.recruit')"
/> />
</template>
<div class="grid gap-3 @4xl:grid-cols-[minmax(0,1fr)_18rem]"> <div class="grid gap-3 @4xl:grid-cols-[minmax(0,1fr)_18rem]">
<VillageRecruit <VillageRecruit
v-if="village.military.length" v-if="village.military.length"
@ -66,5 +69,5 @@ const { t } = useI18n()
/> />
</div> </div>
</div> </div>
</div> </VillageScreenLayout>
</template> </template>

View File

@ -14,11 +14,14 @@ function showBuilding(id: number) {
<!-- Who works where: staffing and priorities per building, and the population behind it. --> <!-- Who works where: staffing and priorities per building, and the population behind it. -->
<template> <template>
<div class="space-y-3 p-2.5"> <VillageScreenLayout>
<template #side>
<VillageScreenHeader type="farm" :level="farm?.level ?? null" :title="$t('village.screens.workforce')" :description="$t('village.about.workforce')" /> <VillageScreenHeader type="farm" :level="farm?.level ?? null" :title="$t('village.screens.workforce')" :description="$t('village.about.workforce')" />
</template>
<div class="grid gap-3 @4xl:grid-cols-[minmax(0,1fr)_18rem]"> <div class="grid gap-3 @4xl:grid-cols-[minmax(0,1fr)_18rem]">
<VillageBuildingTable :buildings="village.buildings" :busy="v.busy.value" @select="showBuilding" @priority="v.setPriority" /> <VillageBuildingTable :buildings="village.buildings" :busy="v.busy.value" @select="showBuilding" @priority="v.setPriority" />
<VillagePopulationPanel :population="village.population" :militia="village.levy.militia" /> <VillagePopulationPanel :population="village.population" :militia="village.levy.militia" />
</div> </div>
</div> </VillageScreenLayout>
</template> </template>