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

31 lines
845 B
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>
<template>
<section>
<h2>{{ $t('village.resources.title') }}</h2>
<table>
<thead>
<tr>
<th v-for="r in list" :key="r">{{ $t(`resources.${r}`) }}</th>
<th>{{ $t('village.resources.cap') }}</th>
</tr>
</thead>
<tbody>
<tr>
<td v-for="r in list" :key="r">
{{ formatAmount(resources[r]) }}
<small>({{ $t('village.resources.per_hour', { rate: formatRate(village.rates[r]) }) }})</small>
</td>
<td>{{ village.storage_cap }}</td>
</tr>
</tbody>
</table>
</section>
</template>