game-village-politics-frontend/app/components/village/ResourceBar.vue

32 lines
1.3 KiB
Vue
Raw Normal View History

<script setup lang="ts">
import type { Resource, Resources, VillageState } from '~/types/game'
defineProps<{ village: VillageState; resources: Resources }>()
const list: Resource[] = ['wood', 'clay', 'iron', 'food']
</script>
<!-- Stock in storage, one line like the Die Stämme header; rates live in the overview's production box. -->
<template>
<div class="flex flex-wrap items-center gap-x-4 gap-y-1 text-sm tabular-nums">
<span
v-for="r in list"
:key="r"
class="inline-flex items-center gap-1.5 font-semibold"
:class="resources[r] >= village.storage_cap ? 'text-blood-700' : 'text-ink-900'"
:title="`${$t(`resources.${r}`)}: ${$t('village.resources.per_hour', { rate: formatRate(village.rates[r]) })}`"
>
<IconResource :resource="r" class="size-5" />
{{ formatAmount(resources[r]) }}
</span>
<span class="inline-flex items-center gap-1.5 text-ink-700" :title="$t('village.resources.cap')">
<IconBuilding type="storage" class="size-4" />
{{ village.storage_cap }}
</span>
<span class="inline-flex items-center gap-1.5 text-ink-700" :title="$t('village.population.villagers')">
<IconUi name="users" class="size-4" />
{{ village.population.villagers }}
</span>
</div>
</template>