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
|
||||
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>
|
||||
<div>
|
||||
<!--
|
||||
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.
|
||||
-->
|
||||
<!-- A screen of its own, across the full width under the menu and the village bar. -->
|
||||
<div v-if="page" class="min-h-dvh pb-14 md:pb-0">
|
||||
<GameMenuBar in-world />
|
||||
<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" />
|
||||
<GameVillageNotices :village-id="villageId" />
|
||||
</div>
|
||||
<div class="flex items-start gap-2 px-1 pt-1.5 pb-4 sm:px-2">
|
||||
<main class="min-w-0 flex-1">
|
||||
<div class="frame @container">
|
||||
<div v-if="pageTitle" class="panel-head"><h1 class="panel-title">{{ pageTitle }}</h1></div>
|
||||
<slot />
|
||||
</div>
|
||||
</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>
|
||||
<main class="px-1 pt-1.5 pb-4 sm:px-2">
|
||||
<div class="frame @container">
|
||||
<div v-if="pageTitle" class="panel-head"><h1 class="panel-title">{{ pageTitle }}</h1></div>
|
||||
<slot />
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
|
||||
<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. -->
|
||||
<template>
|
||||
<div class="space-y-3 p-2.5">
|
||||
<VillageBuildingHeader
|
||||
v-if="hq"
|
||||
:building="hq"
|
||||
:title="buildingName(village, hq, t)"
|
||||
:resources="v.resources.value!"
|
||||
:can-afford="v.canAfford"
|
||||
:busy="v.busy.value"
|
||||
@upgrade="v.upgrade"
|
||||
@demolish="v.demolish"
|
||||
@priority="v.setPriority"
|
||||
/>
|
||||
<VillageScreenHeader v-else type="headquarters" :level="null" :title="$t('buildings.headquarters')" :description="$t('village.about.build')" />
|
||||
<VillageScreenLayout>
|
||||
<template #side>
|
||||
<VillageBuildingHeader
|
||||
v-if="hq"
|
||||
:building="hq"
|
||||
:title="buildingName(village, hq, t)"
|
||||
:resources="v.resources.value!"
|
||||
:can-afford="v.canAfford"
|
||||
:busy="v.busy.value"
|
||||
@upgrade="v.upgrade"
|
||||
@demolish="v.demolish"
|
||||
@priority="v.setPriority"
|
||||
/>
|
||||
<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]">
|
||||
<VillageBuildForm
|
||||
:options="village.buildable"
|
||||
|
|
@ -52,5 +55,5 @@ function showBuilding(id: number) {
|
|||
@cancel="v.cancel"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</VillageScreenLayout>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -14,16 +14,31 @@ watch(building, (b) => {
|
|||
|
||||
<!-- Inside one building: the close-up, what it does and what can be done with it. -->
|
||||
<template>
|
||||
<div v-if="building" class="p-2.5">
|
||||
<VillageBuildingHeader
|
||||
:building="building"
|
||||
:title="buildingName(village, building, t)"
|
||||
<VillageScreenLayout v-if="building">
|
||||
<template #side>
|
||||
<VillageBuildingHeader
|
||||
: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"
|
||||
:can-afford="v.canAfford"
|
||||
:busy="v.busy.value"
|
||||
@build="v.build"
|
||||
@upgrade="v.upgrade"
|
||||
@demolish="v.demolish"
|
||||
@priority="v.setPriority"
|
||||
@select="(id: number) => navigateTo(`/village/${route.params.id}/building/${id}`)"
|
||||
/>
|
||||
</div>
|
||||
</VillageScreenLayout>
|
||||
</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. -->
|
||||
<template>
|
||||
<div class="space-y-3 p-2.5">
|
||||
<VillageBuildingHeader
|
||||
v-if="rallyPoint"
|
||||
:building="rallyPoint"
|
||||
:title="buildingName(village, rallyPoint, t)"
|
||||
:resources="v.resources.value!"
|
||||
:can-afford="v.canAfford"
|
||||
:busy="v.busy.value"
|
||||
@upgrade="v.upgrade"
|
||||
@demolish="v.demolish"
|
||||
@priority="v.setPriority"
|
||||
/>
|
||||
<VillageScreenHeader v-else type="rally_point" :level="null" :title="$t('buildings.rally_point')" :description="$t('village.about.rally')" />
|
||||
<VillageScreenLayout>
|
||||
<template #side>
|
||||
<VillageBuildingHeader
|
||||
v-if="rallyPoint"
|
||||
:building="rallyPoint"
|
||||
:title="buildingName(village, rallyPoint, t)"
|
||||
:resources="v.resources.value!"
|
||||
:can-afford="v.canAfford"
|
||||
:busy="v.busy.value"
|
||||
@upgrade="v.upgrade"
|
||||
@demolish="v.demolish"
|
||||
@priority="v.setPriority"
|
||||
/>
|
||||
<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" />
|
||||
|
||||
<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>
|
||||
|
||||
<VillageSimulator v-else :world-id="village.world_id" :troops="village.troops" open />
|
||||
</div>
|
||||
</VillageScreenLayout>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -17,25 +17,28 @@ const { t } = useI18n()
|
|||
|
||||
<!-- Recruiting at every military building, the troops at home and the levy. -->
|
||||
<template>
|
||||
<div class="space-y-3 p-2.5">
|
||||
<VillageBuildingHeader
|
||||
v-if="shownBuilding"
|
||||
:building="shownBuilding"
|
||||
:title="buildingName(village, shownBuilding, t)"
|
||||
:resources="v.resources.value!"
|
||||
:can-afford="v.canAfford"
|
||||
:busy="v.busy.value"
|
||||
@upgrade="v.upgrade"
|
||||
@demolish="v.demolish"
|
||||
@priority="v.setPriority"
|
||||
/>
|
||||
<VillageScreenHeader
|
||||
v-else
|
||||
:type="shown?.type ?? 'barracks'"
|
||||
:level="shown?.level ?? null"
|
||||
:title="shown ? $t(`buildings.${shown.type}`) : $t('village.screens.recruit')"
|
||||
:description="$t('village.about.recruit')"
|
||||
/>
|
||||
<VillageScreenLayout>
|
||||
<template #side>
|
||||
<VillageBuildingHeader
|
||||
v-if="shownBuilding"
|
||||
:building="shownBuilding"
|
||||
:title="buildingName(village, shownBuilding, t)"
|
||||
:resources="v.resources.value!"
|
||||
:can-afford="v.canAfford"
|
||||
:busy="v.busy.value"
|
||||
@upgrade="v.upgrade"
|
||||
@demolish="v.demolish"
|
||||
@priority="v.setPriority"
|
||||
/>
|
||||
<VillageScreenHeader
|
||||
v-else
|
||||
:type="shown?.type ?? 'barracks'"
|
||||
:level="shown?.level ?? null"
|
||||
: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]">
|
||||
<VillageRecruit
|
||||
v-if="village.military.length"
|
||||
|
|
@ -66,5 +69,5 @@ const { t } = useI18n()
|
|||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</VillageScreenLayout>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -14,11 +14,14 @@ function showBuilding(id: number) {
|
|||
|
||||
<!-- Who works where: staffing and priorities per building, and the population behind it. -->
|
||||
<template>
|
||||
<div class="space-y-3 p-2.5">
|
||||
<VillageScreenHeader type="farm" :level="farm?.level ?? null" :title="$t('village.screens.workforce')" :description="$t('village.about.workforce')" />
|
||||
<VillageScreenLayout>
|
||||
<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]">
|
||||
<VillageBuildingTable :buildings="village.buildings" :busy="v.busy.value" @select="showBuilding" @priority="v.setPriority" />
|
||||
<VillagePopulationPanel :population="village.population" :militia="village.levy.militia" />
|
||||
</div>
|
||||
</div>
|
||||
</VillageScreenLayout>
|
||||
</template>
|
||||
|
|
|
|||
Loading…
Reference in New Issue