2026-10-28 16:57:44 +00:00
|
|
|
<script setup lang="ts">
|
|
|
|
|
import type { Population } from '~/types/game'
|
|
|
|
|
|
2026-10-28 20:58:09 +00:00
|
|
|
const props = defineProps<{
|
|
|
|
|
population: Population
|
|
|
|
|
/** Villagers drafted by a levy: neither working nor idle. */
|
|
|
|
|
militia: number
|
|
|
|
|
}>()
|
2026-10-28 18:04:21 +00:00
|
|
|
|
|
|
|
|
const stats = computed(() => [
|
|
|
|
|
{ key: 'villagers', value: props.population.villagers },
|
|
|
|
|
{ key: 'workers', value: props.population.workers },
|
2026-11-03 08:56:37 +00:00
|
|
|
{ key: 'idle', value: props.population.idle },
|
2026-10-28 18:04:21 +00:00
|
|
|
{ key: 'soldiers', value: props.population.soldiers },
|
|
|
|
|
])
|
2026-10-28 16:57:44 +00:00
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
2026-10-28 18:04:21 +00:00
|
|
|
<section class="panel">
|
|
|
|
|
<div class="panel-head">
|
|
|
|
|
<h2 class="panel-title">{{ $t('village.population.title') }}</h2>
|
|
|
|
|
<IconUi name="users" class="size-5 text-ink-400" />
|
|
|
|
|
</div>
|
|
|
|
|
<div class="panel-body space-y-4">
|
2026-11-03 08:56:37 +00:00
|
|
|
<!-- Heads, the same on every world speed: the food per hour is in the resource bar. -->
|
|
|
|
|
<div class="grid grid-cols-2 gap-3" :title="$t('village.population.heads_hint')">
|
2026-10-28 19:22:53 +00:00
|
|
|
<div class="rounded-sm border-2 border-parchment-300 bg-parchment-100 p-3">
|
2026-10-28 18:04:21 +00:00
|
|
|
<p class="text-xs text-ink-500">{{ $t('village.population.food_budget') }}</p>
|
|
|
|
|
<p class="mt-0.5 flex items-center gap-1 font-semibold tabular-nums">
|
2026-11-03 08:56:37 +00:00
|
|
|
<IconUi name="users" class="size-4 text-wood-800" />
|
|
|
|
|
{{ $t('village.population.heads', { value: population.food_budget }) }}
|
2026-10-28 18:04:21 +00:00
|
|
|
</p>
|
|
|
|
|
</div>
|
2026-10-28 19:22:53 +00:00
|
|
|
<div class="rounded-sm border-2 border-parchment-300 bg-parchment-100 p-3">
|
2026-10-28 18:04:21 +00:00
|
|
|
<p class="text-xs text-ink-500">{{ $t('village.population.upkeep') }}</p>
|
|
|
|
|
<p class="mt-0.5 flex items-center gap-1 font-semibold tabular-nums">
|
2026-11-03 08:56:37 +00:00
|
|
|
<IconUi name="users" class="size-4 text-wood-800" />
|
|
|
|
|
{{ $t('village.population.heads', { value: population.upkeep }) }}
|
2026-10-28 18:04:21 +00:00
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<dl class="grid grid-cols-4 gap-2 text-center">
|
|
|
|
|
<div v-for="s in stats" :key="s.key">
|
|
|
|
|
<dd class="text-lg font-semibold tabular-nums">{{ s.value }}</dd>
|
|
|
|
|
<dt class="text-xs text-ink-500">{{ $t(`village.population.${s.key}`) }}</dt>
|
|
|
|
|
</div>
|
|
|
|
|
</dl>
|
2026-11-03 08:56:37 +00:00
|
|
|
<p v-if="population.reserved" class="text-xs text-ink-500">
|
|
|
|
|
{{ $t('village.population.reserved') }}: <span class="font-semibold tabular-nums">{{ population.reserved }}</span>
|
|
|
|
|
</p>
|
2026-10-28 18:04:21 +00:00
|
|
|
|
|
|
|
|
<div>
|
|
|
|
|
<div class="mb-1 flex justify-between text-xs text-ink-500">
|
|
|
|
|
<span>{{ $t('village.population.workforce') }}</span>
|
|
|
|
|
<span class="tabular-nums">{{ population.workers }}/{{ population.villagers }}</span>
|
|
|
|
|
</div>
|
|
|
|
|
<UiBar :value="population.villagers ? population.workers / population.villagers : 0" tone="sky" />
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2026-10-28 16:57:44 +00:00
|
|
|
</section>
|
|
|
|
|
</template>
|