52 lines
2.2 KiB
Vue
52 lines
2.2 KiB
Vue
<script setup lang="ts">
|
|
import type { MapVillage } from '~/types/map'
|
|
|
|
defineProps<{
|
|
village: MapVillage | null
|
|
at: { x: number; y: number } | null
|
|
}>()
|
|
const emit = defineEmits<{ center: [at: { x: number; y: number }] }>()
|
|
const { current } = useCurrentWorld()
|
|
|
|
</script>
|
|
|
|
<template>
|
|
<section class="panel">
|
|
<div class="panel-head">
|
|
<h2 class="panel-title">{{ $t('map.info.title') }}</h2>
|
|
</div>
|
|
<div class="panel-body text-sm">
|
|
<template v-if="village">
|
|
<p class="font-display text-lg font-semibold">{{ village.name }}</p>
|
|
<dl class="mt-3 grid grid-cols-[auto_1fr] gap-x-4 gap-y-1.5">
|
|
<dt class="text-ink-500">{{ $t('map.info.coordinates') }}</dt>
|
|
<dd class="font-semibold tabular-nums">{{ village.x }}|{{ village.y }} <span class="text-ink-500">{{ village.continent }}</span></dd>
|
|
<dt class="text-ink-500">{{ $t('map.info.owner') }}</dt>
|
|
<dd>{{ village.player?.name ?? $t('map.barbarian') }}</dd>
|
|
<dt class="text-ink-500">{{ $t('map.info.points') }}</dt>
|
|
<dd class="tabular-nums">{{ village.points }}</dd>
|
|
</dl>
|
|
<div class="mt-4 flex flex-wrap gap-2">
|
|
<NuxtLink v-if="village.own" :to="`/village/${village.id}`" class="btn btn-primary">{{ $t('map.info.open') }}</NuxtLink>
|
|
<NuxtLink
|
|
v-if="current?.villageId && current.villageId !== village.id"
|
|
:to="{ path: `/village/${current.villageId}/rally`, query: { x: village.x, y: village.y } }"
|
|
class="btn btn-outline"
|
|
>
|
|
<IconUi name="attack" class="size-4" />
|
|
{{ $t('map.info.send') }}
|
|
</NuxtLink>
|
|
<button type="button" class="btn btn-outline" @click="emit('center', { x: village.x, y: village.y })">
|
|
{{ $t('map.info.center') }}
|
|
</button>
|
|
</div>
|
|
</template>
|
|
<template v-else-if="at">
|
|
<p class="text-ink-700">{{ $t('map.info.empty') }}</p>
|
|
<p class="mt-1 font-semibold tabular-nums">{{ at.x }}|{{ at.y }} <span class="text-ink-500">{{ continentOf(at.x, at.y) }}</span></p>
|
|
</template>
|
|
<p v-else class="text-ink-500">{{ $t('map.info.hint') }}</p>
|
|
</div>
|
|
</section>
|
|
</template>
|