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

43 lines
1.6 KiB
Vue
Raw Normal View History

<script setup lang="ts">
import type { Levy, Starvation } from '~/types/game'
defineProps<{
starvation: Starvation
levy: Levy
secondsUntil: (iso: string) => number
}>()
</script>
<!-- A thin notice under the village header while the food stock drains or is empty. -->
<template>
<div
v-if="starvation.since"
class="flex flex-wrap items-center gap-x-3 gap-y-0.5 border border-blood-800 bg-blood-700 px-2 py-0.5 text-sm text-parchment-50"
role="alert"
>
<IconResource resource="food" class="size-5" />
<span class="font-semibold">{{ $t('village.food.starving') }}</span>
<span v-if="starvation.desertion_at">
{{ $t('village.food.desertion_in') }}
<span class="font-semibold tabular-nums">{{ formatDuration(secondsUntil(starvation.desertion_at)) }}</span>
</span>
<span class="w-full text-xs text-parchment-200 sm:ml-auto sm:w-auto">
{{ levy.militia ? $t('village.food.fix_levy') : $t('village.food.fix') }}
</span>
</div>
<div
v-else-if="starvation.food_empty_at"
class="flex flex-wrap items-center gap-x-3 gap-y-0.5 border border-gold-600 bg-gold-400 px-2 py-0.5 text-sm text-ink-900"
role="status"
>
<IconResource resource="food" class="size-5" />
<span>
{{ $t('village.food.runs_out_in') }}
<span class="font-semibold tabular-nums">{{ formatDuration(secondsUntil(starvation.food_empty_at)) }}</span>
</span>
<span class="w-full text-xs text-ink-700 sm:ml-auto sm:w-auto">
{{ levy.militia ? $t('village.food.fix_levy') : $t('village.food.then') }}
</span>
</div>
</template>