41 lines
1.5 KiB
Vue
41 lines
1.5 KiB
Vue
<script setup lang="ts">
|
|
const route = useRoute()
|
|
const v = useVillageContext()
|
|
const village = computed(() => v.village.value!)
|
|
const resources = computed(() => v.resources.value!)
|
|
|
|
/** Show a building in the village overview, with its card open. */
|
|
const hq = computed(() => village.value.buildings.find((b) => b.type === 'headquarters') ?? null)
|
|
|
|
const showInVillage = (id: number) => navigateTo({ path: `/village/${route.params.id}`, query: { b: id } })
|
|
</script>
|
|
|
|
<!-- The headquarters screen: every building to construct, upgrade or tear down, and the queue. -->
|
|
<template>
|
|
<div class="space-y-3 p-2.5">
|
|
<VillageScreenHeader type="headquarters" :level="hq?.level ?? null" :title="$t('buildings.headquarters')" :description="$t('village.about.build')" />
|
|
<div class="grid gap-3 @4xl:grid-cols-[minmax(0,1fr)_18rem]">
|
|
<VillageBuildForm
|
|
:options="village.buildable"
|
|
:buildings="village.buildings"
|
|
:space="village.space"
|
|
:resources="resources"
|
|
:can-afford="v.canAfford"
|
|
:busy="v.busy.value"
|
|
:hint="typeof route.query.hint === 'string' ? route.query.hint : null"
|
|
@build="v.build"
|
|
@upgrade="v.upgrade"
|
|
@demolish="v.demolish"
|
|
@select="showInVillage"
|
|
/>
|
|
<VillageBuildQueue
|
|
:queue="village.queue"
|
|
:builders="village.builders"
|
|
:seconds-until="v.secondsUntil"
|
|
:busy="v.busy.value"
|
|
@cancel="v.cancel"
|
|
/>
|
|
</div>
|
|
</div>
|
|
</template>
|