2026-10-28 18:04:20 +00:00
|
|
|
<script setup lang="ts">
|
|
|
|
|
import type { Cost, Resources } from '~/types/game'
|
|
|
|
|
|
|
|
|
|
defineProps<{
|
|
|
|
|
cost: Cost
|
|
|
|
|
/** Projected stock; amounts the village lacks show in red. */
|
|
|
|
|
have?: Resources | null
|
2026-10-28 20:18:57 +00:00
|
|
|
/** Keep the three amounts on one line, for table cells. */
|
|
|
|
|
nowrap?: boolean
|
2026-11-03 08:56:37 +00:00
|
|
|
/** Free villagers the level needs as workers (the server's `villagers`); hidden at 0. */
|
|
|
|
|
villagers?: number
|
|
|
|
|
/** The village's free villagers (`population.idle`): the villager count turns red above it. */
|
|
|
|
|
idle?: number
|
2026-10-28 18:04:20 +00:00
|
|
|
}>()
|
|
|
|
|
|
|
|
|
|
const list = ['wood', 'clay', 'iron'] as const
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
2026-10-28 20:18:57 +00:00
|
|
|
<span class="inline-flex items-center gap-x-2.5 gap-y-1 text-xs tabular-nums" :class="nowrap ? 'whitespace-nowrap' : 'flex-wrap'">
|
2026-10-28 18:04:20 +00:00
|
|
|
<span
|
|
|
|
|
v-for="r in list"
|
|
|
|
|
:key="r"
|
|
|
|
|
class="inline-flex items-center gap-1"
|
2026-10-28 19:22:53 +00:00
|
|
|
:class="have && have[r] < cost[r] ? 'font-semibold text-blood-700' : 'text-ink-700'"
|
2026-10-28 18:04:20 +00:00
|
|
|
:title="$t(`resources.${r}`)"
|
|
|
|
|
>
|
|
|
|
|
<IconResource :resource="r" class="size-4" />
|
|
|
|
|
{{ cost[r] }}
|
|
|
|
|
</span>
|
2026-11-03 08:56:37 +00:00
|
|
|
<UiVillagers :villagers="villagers" :idle="idle" />
|
2026-10-28 18:04:20 +00:00
|
|
|
</span>
|
|
|
|
|
</template>
|