game-village-politics-frontend/app/pages/village/[id]/workforce.vue

25 lines
1.1 KiB
Vue
Raw Normal View History

<script setup lang="ts">
const route = useRoute()
const v = useVillageContext()
const village = computed(() => v.village.value!)
const farm = computed(() => [...village.value.buildings].filter((b) => b.type === 'farm').sort((a, b) => b.level - a.level)[0] ?? null)
/** A building's name opens its own screen. */
function showBuilding(id: number) {
const b = village.value.buildings.find((x) => x.id === id)
if (b) navigateTo(buildingRoute(village.value, b))
}
</script>
<!-- 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')" />
<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>
</template>