2026-10-28 16:57:44 +00:00
|
|
|
<script setup lang="ts">
|
|
|
|
|
const route = useRoute()
|
2026-10-28 21:14:56 +00:00
|
|
|
const id = Number(route.params.id)
|
|
|
|
|
const v = useVillage(id)
|
|
|
|
|
const { village, resources, error } = v
|
|
|
|
|
provideVillage(v)
|
2026-10-28 16:57:44 +00:00
|
|
|
|
2026-10-28 20:05:34 +00:00
|
|
|
const { enter } = useCurrentWorld()
|
2026-10-28 21:14:56 +00:00
|
|
|
watch(village, (state) => {
|
|
|
|
|
if (state) enter(state.world_id, state.id)
|
2026-10-28 18:58:42 +00:00
|
|
|
})
|
|
|
|
|
|
2026-10-28 16:57:44 +00:00
|
|
|
v.refresh()
|
|
|
|
|
|
2026-10-28 21:14:56 +00:00
|
|
|
// The screens of a village, like the building links along the top in Die Stämme.
|
|
|
|
|
const screens = [
|
|
|
|
|
{ name: 'overview', path: '', icon: 'headquarters' },
|
|
|
|
|
{ name: 'build', path: '/build', icon: 'storage' },
|
|
|
|
|
{ name: 'recruit', path: '/recruit', icon: 'barracks' },
|
|
|
|
|
{ name: 'workforce', path: '/workforce', icon: 'farm' },
|
|
|
|
|
] as const
|
2026-10-28 16:57:44 +00:00
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
2026-10-28 18:04:21 +00:00
|
|
|
<div v-if="village && resources">
|
2026-10-28 21:14:56 +00:00
|
|
|
<header class="sticky top-0 z-30 border-b-2 border-wood-700 bg-parchment-200">
|
|
|
|
|
<div class="flex flex-wrap items-center gap-x-5 gap-y-2 px-4 py-2 sm:px-6">
|
|
|
|
|
<div class="flex min-w-0 items-baseline gap-2">
|
|
|
|
|
<h1 class="truncate font-display text-lg font-semibold text-wood-900" style="font-variant: small-caps">{{ village.name }}</h1>
|
|
|
|
|
<NuxtLink
|
|
|
|
|
:to="{ path: `/map/${village.world_id}`, query: { x: village.x, y: village.y } }"
|
|
|
|
|
class="text-sm whitespace-nowrap text-ink-700 tabular-nums hover:text-blood-700 hover:underline"
|
|
|
|
|
:title="$t('village.on_map')"
|
|
|
|
|
>
|
|
|
|
|
({{ village.x }}|{{ village.y }}) {{ village.continent }}
|
|
|
|
|
</NuxtLink>
|
|
|
|
|
<span class="hidden text-xs whitespace-nowrap text-ink-500 sm:inline">{{ $t('village.points', { points: village.points }) }}</span>
|
2026-10-28 18:04:21 +00:00
|
|
|
</div>
|
2026-10-28 21:14:56 +00:00
|
|
|
<nav class="flex items-center gap-0.5" :aria-label="$t('village.screens.label')">
|
|
|
|
|
<NuxtLink
|
|
|
|
|
v-for="s in screens"
|
|
|
|
|
:key="s.name"
|
|
|
|
|
:to="`/village/${id}${s.path}`"
|
|
|
|
|
class="screen-link"
|
|
|
|
|
:class="{ 'screen-link-active': route.path === `/village/${id}${s.path}` }"
|
|
|
|
|
>
|
|
|
|
|
<IconBuilding :type="s.icon" class="size-4" />
|
|
|
|
|
<span :class="s.name === 'overview' ? 'hidden sm:inline' : ''">{{ $t(`village.screens.${s.name}`) }}</span>
|
|
|
|
|
</NuxtLink>
|
|
|
|
|
</nav>
|
|
|
|
|
<VillageResourceBar class="lg:ml-auto" :village="village" :resources="resources" />
|
2026-10-28 18:54:29 +00:00
|
|
|
</div>
|
2026-10-28 21:05:45 +00:00
|
|
|
<VillageFoodWarning :starvation="village.starvation" :levy="village.levy" :seconds-until="v.secondsUntil" />
|
2026-10-28 21:14:56 +00:00
|
|
|
</header>
|
2026-10-28 21:05:45 +00:00
|
|
|
|
2026-10-28 21:14:56 +00:00
|
|
|
<p v-if="error" class="alert mx-4 mt-3 sm:mx-6" role="alert">{{ error }}</p>
|
|
|
|
|
<NuxtPage />
|
2026-10-28 18:04:21 +00:00
|
|
|
</div>
|
2026-10-28 18:54:29 +00:00
|
|
|
<div v-else class="px-4 py-16 text-center">
|
2026-10-28 18:04:21 +00:00
|
|
|
<p v-if="error" class="alert inline-block" role="alert">{{ error }}</p>
|
|
|
|
|
<p v-else class="text-sm text-ink-500">{{ $t('common.loading') }}</p>
|
|
|
|
|
</div>
|
2026-10-28 16:57:44 +00:00
|
|
|
</template>
|
2026-10-28 21:14:56 +00:00
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
@reference "~/assets/css/main.css";
|
|
|
|
|
|
|
|
|
|
.screen-link {
|
|
|
|
|
@apply inline-flex items-center gap-1.5 rounded-sm border border-transparent px-2 py-1 text-sm font-semibold text-wood-900 hover:border-wood-600;
|
|
|
|
|
}
|
|
|
|
|
.screen-link-active {
|
|
|
|
|
@apply border-wood-700 bg-parchment-50 text-blood-700;
|
|
|
|
|
}
|
|
|
|
|
</style>
|