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()
|
|
|
|
|
|
feat: rally point, troop movements, support, reports, scouts, battle simulator and village rename
Send attacks and support from the rally point with a live travel-time preview, see own
commands and spotted incoming attacks with countdowns and call-back, send support home
or withdraw it, read battle and support reports with an unread badge, run the battle
simulator, rename villages, and send troops straight from the map. The watchtower gets
a diorama model; the mock server answers every new intent.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 23:16:06 +00:00
|
|
|
/** The new name while the village is being renamed. */
|
|
|
|
|
const renaming = ref<string | null>(null)
|
|
|
|
|
async function rename() {
|
|
|
|
|
if (renaming.value !== null && (await v.rename(renaming.value))) renaming.value = null
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const incomingAttacks = computed(() => village.value?.movements.filter((m) => m.direction === 'in' && m.type === 'attack') ?? [])
|
|
|
|
|
|
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' },
|
feat: rally point, troop movements, support, reports, scouts, battle simulator and village rename
Send attacks and support from the rally point with a live travel-time preview, see own
commands and spotted incoming attacks with countdowns and call-back, send support home
or withdraw it, read battle and support reports with an unread badge, run the battle
simulator, rename villages, and send troops straight from the map. The watchtower gets
a diorama model; the mock server answers every new intent.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 23:16:06 +00:00
|
|
|
{ name: 'rally', path: '/rally', icon: 'rally_point' },
|
2026-10-28 21:14:56 +00:00
|
|
|
{ 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">
|
feat: rally point, troop movements, support, reports, scouts, battle simulator and village rename
Send attacks and support from the rally point with a live travel-time preview, see own
commands and spotted incoming attacks with countdowns and call-back, send support home
or withdraw it, read battle and support reports with an unread badge, run the battle
simulator, rename villages, and send troops straight from the map. The watchtower gets
a diorama model; the mock server answers every new intent.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 23:16:06 +00:00
|
|
|
<form v-if="renaming !== null" class="flex items-center gap-1.5" @submit.prevent="rename">
|
|
|
|
|
<input
|
|
|
|
|
v-model="renaming"
|
|
|
|
|
type="text"
|
|
|
|
|
maxlength="32"
|
|
|
|
|
class="input w-44 px-2 py-0.5"
|
|
|
|
|
:aria-label="$t('village.rename')"
|
|
|
|
|
@keydown.esc="renaming = null"
|
|
|
|
|
/>
|
|
|
|
|
<button type="submit" class="btn btn-primary px-2 py-0.5" :disabled="v.busy.value || !renaming.trim()">{{ $t('village.rename_save') }}</button>
|
|
|
|
|
<button type="button" class="btn btn-ghost px-2 py-0.5" @click="renaming = null">{{ $t('village.rename_cancel') }}</button>
|
|
|
|
|
</form>
|
|
|
|
|
<template v-else>
|
|
|
|
|
<h1 class="truncate font-display text-lg font-semibold text-wood-900" style="font-variant: small-caps">{{ village.name }}</h1>
|
|
|
|
|
<button type="button" class="self-center text-ink-500 hover:text-blood-700" :title="$t('village.rename')" @click="renaming = village.name">
|
|
|
|
|
<IconUi name="edit" class="size-3.5" />
|
|
|
|
|
<span class="sr-only">{{ $t('village.rename') }}</span>
|
|
|
|
|
</button>
|
|
|
|
|
</template>
|
2026-10-28 21:14:56 +00:00
|
|
|
<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>
|
feat: rally point, troop movements, support, reports, scouts, battle simulator and village rename
Send attacks and support from the rally point with a live travel-time preview, see own
commands and spotted incoming attacks with countdowns and call-back, send support home
or withdraw it, read battle and support reports with an unread badge, run the battle
simulator, rename villages, and send troops straight from the map. The watchtower gets
a diorama model; the mock server answers every new intent.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 23:16:06 +00:00
|
|
|
<NuxtLink
|
|
|
|
|
v-if="incomingAttacks.length"
|
|
|
|
|
:to="`/village/${id}/rally`"
|
|
|
|
|
class="badge badge-blood"
|
|
|
|
|
:title="$t('village.incoming', { count: incomingAttacks.length })"
|
|
|
|
|
>
|
|
|
|
|
<IconUi name="attack" class="size-3.5" />
|
|
|
|
|
{{ incomingAttacks.length }}
|
|
|
|
|
</NuxtLink>
|
2026-10-28 21:14:56 +00:00
|
|
|
<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>
|