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:
parent
4134a44652
commit
13f98cf8ae
|
|
@ -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>
|
||||||
|
|
|
||||||
|
|
@ -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>
|
||||||
|
|
@ -17,19 +17,22 @@ 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>
|
||||||
<VillageBuildingHeader
|
<template #side>
|
||||||
v-if="hq"
|
<VillageBuildingHeader
|
||||||
:building="hq"
|
v-if="hq"
|
||||||
:title="buildingName(village, hq, t)"
|
:building="hq"
|
||||||
:resources="v.resources.value!"
|
:title="buildingName(village, hq, t)"
|
||||||
:can-afford="v.canAfford"
|
:resources="v.resources.value!"
|
||||||
:busy="v.busy.value"
|
:can-afford="v.canAfford"
|
||||||
@upgrade="v.upgrade"
|
:busy="v.busy.value"
|
||||||
@demolish="v.demolish"
|
@upgrade="v.upgrade"
|
||||||
@priority="v.setPriority"
|
@demolish="v.demolish"
|
||||||
/>
|
@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>
|
||||||
|
|
|
||||||
|
|
@ -14,16 +14,31 @@ 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">
|
||||||
<VillageBuildingHeader
|
<template #side>
|
||||||
:building="building"
|
<VillageBuildingHeader
|
||||||
:title="buildingName(village, building, t)"
|
:building="building"
|
||||||
|
:title="buildingName(village, building, t)"
|
||||||
|
:resources="resources"
|
||||||
|
:can-afford="v.canAfford"
|
||||||
|
:busy="v.busy.value"
|
||||||
|
@upgrade="v.upgrade"
|
||||||
|
@demolish="v.demolish"
|
||||||
|
@priority="v.setPriority"
|
||||||
|
/>
|
||||||
|
</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"
|
:resources="resources"
|
||||||
:can-afford="v.canAfford"
|
:can-afford="v.canAfford"
|
||||||
:busy="v.busy.value"
|
:busy="v.busy.value"
|
||||||
|
@build="v.build"
|
||||||
@upgrade="v.upgrade"
|
@upgrade="v.upgrade"
|
||||||
@demolish="v.demolish"
|
@demolish="v.demolish"
|
||||||
@priority="v.setPriority"
|
@select="(id: number) => navigateTo(`/village/${route.params.id}/building/${id}`)"
|
||||||
/>
|
/>
|
||||||
</div>
|
</VillageScreenLayout>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
|
|
@ -28,19 +28,22 @@ 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>
|
||||||
<VillageBuildingHeader
|
<template #side>
|
||||||
v-if="rallyPoint"
|
<VillageBuildingHeader
|
||||||
:building="rallyPoint"
|
v-if="rallyPoint"
|
||||||
:title="buildingName(village, rallyPoint, t)"
|
:building="rallyPoint"
|
||||||
:resources="v.resources.value!"
|
:title="buildingName(village, rallyPoint, t)"
|
||||||
:can-afford="v.canAfford"
|
:resources="v.resources.value!"
|
||||||
:busy="v.busy.value"
|
:can-afford="v.canAfford"
|
||||||
@upgrade="v.upgrade"
|
:busy="v.busy.value"
|
||||||
@demolish="v.demolish"
|
@upgrade="v.upgrade"
|
||||||
@priority="v.setPriority"
|
@demolish="v.demolish"
|
||||||
/>
|
@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>
|
||||||
|
|
|
||||||
|
|
@ -17,25 +17,28 @@ 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>
|
||||||
<VillageBuildingHeader
|
<template #side>
|
||||||
v-if="shownBuilding"
|
<VillageBuildingHeader
|
||||||
:building="shownBuilding"
|
v-if="shownBuilding"
|
||||||
:title="buildingName(village, shownBuilding, t)"
|
:building="shownBuilding"
|
||||||
:resources="v.resources.value!"
|
:title="buildingName(village, shownBuilding, t)"
|
||||||
:can-afford="v.canAfford"
|
:resources="v.resources.value!"
|
||||||
:busy="v.busy.value"
|
:can-afford="v.canAfford"
|
||||||
@upgrade="v.upgrade"
|
:busy="v.busy.value"
|
||||||
@demolish="v.demolish"
|
@upgrade="v.upgrade"
|
||||||
@priority="v.setPriority"
|
@demolish="v.demolish"
|
||||||
/>
|
@priority="v.setPriority"
|
||||||
<VillageScreenHeader
|
/>
|
||||||
v-else
|
<VillageScreenHeader
|
||||||
:type="shown?.type ?? 'barracks'"
|
v-else
|
||||||
:level="shown?.level ?? null"
|
:type="shown?.type ?? 'barracks'"
|
||||||
:title="shown ? $t(`buildings.${shown.type}`) : $t('village.screens.recruit')"
|
:level="shown?.level ?? null"
|
||||||
:description="$t('village.about.recruit')"
|
:title="shown ? $t(`buildings.${shown.type}`) : $t('village.screens.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>
|
||||||
|
|
|
||||||
|
|
@ -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>
|
||||||
<VillageScreenHeader type="farm" :level="farm?.level ?? null" :title="$t('village.screens.workforce')" :description="$t('village.about.workforce')" />
|
<template #side>
|
||||||
|
<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>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue