feat: flat village header strip above the land and a solid details card

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Fabian @ Blax Software 2026-10-28 20:33:14 +01:00
parent f5b7c41f99
commit 435aaff19b
2 changed files with 53 additions and 48 deletions

View File

@ -17,11 +17,11 @@ const emit = defineEmits<{
<!-- Details of the building selected in the diorama, with its actions. --> <!-- Details of the building selected in the diorama, with its actions. -->
<template> <template>
<section class="panel bg-white/95 shadow-lg backdrop-blur" :aria-label="$t(`buildings.${building.type}`)"> <section class="panel" :aria-label="$t(`buildings.${building.type}`)">
<div class="flex items-center gap-3 border-b border-parchment-200 px-4 py-3"> <div class="flex items-center gap-3 border-b-2 border-wood-700 bg-parchment-200 px-4 py-3">
<IconBuildingTile :type="building.type" class="size-11" /> <IconBuildingTile :type="building.type" class="size-11" />
<div class="min-w-0 flex-1"> <div class="min-w-0 flex-1">
<h2 class="truncate font-display text-lg font-semibold">{{ $t(`buildings.${building.type}`) }}</h2> <h2 class="truncate font-display text-lg font-semibold text-wood-900" style="font-variant: small-caps">{{ $t(`buildings.${building.type}`) }}</h2>
<p class="text-xs text-ink-500"> <p class="text-xs text-ink-500">
{{ $t('village.buildings.level_n', { level: building.level }) }} {{ $t('village.buildings.level_n', { level: building.level }) }}
<template v-if="building.space"> · {{ $t('village.build.space', { space: building.space }) }}</template> <template v-if="building.space"> · {{ $t('village.build.space', { space: building.space }) }}</template>
@ -51,7 +51,7 @@ const emit = defineEmits<{
<div class="flex items-center justify-between gap-3 text-sm"> <div class="flex items-center justify-between gap-3 text-sm">
<span class="text-ink-500">{{ $t('village.buildings.priority') }}</span> <span class="text-ink-500">{{ $t('village.buildings.priority') }}</span>
<div class="inline-flex items-center rounded-lg ring-1 ring-parchment-300"> <div class="inline-flex items-center rounded-sm border border-wood-600 bg-parchment-50">
<button <button
type="button" type="button"
class="btn btn-ghost rounded-r-none p-1" class="btn btn-ghost rounded-r-none p-1"
@ -74,7 +74,7 @@ const emit = defineEmits<{
</div> </div>
</div> </div>
<div v-if="building.upgrade" class="space-y-1.5 rounded-lg bg-parchment-50 p-3 ring-1 ring-parchment-200"> <div v-if="building.upgrade" class="space-y-1.5 rounded-sm border border-wood-600/50 bg-parchment-100 p-3">
<div class="flex items-center justify-between gap-2 text-xs text-ink-500"> <div class="flex items-center justify-between gap-2 text-xs text-ink-500">
<UiCost :cost="building.upgrade.cost" :have="resources" /> <UiCost :cost="building.upgrade.cost" :have="resources" />
<span class="flex items-center gap-1 tabular-nums"> <span class="flex items-center gap-1 tabular-nums">

View File

@ -29,54 +29,59 @@ function showInVillage(id: number) {
<div v-if="village && resources"> <div v-if="village && resources">
<VillageResourceBar class="sticky top-0 z-30" :village="village" :resources="resources" /> <VillageResourceBar class="sticky top-0 z-30" :village="village" :resources="resources" />
<section class="relative border-b border-parchment-300/70"> <section class="border-b-2 border-wood-700">
<div class="px-4 pt-4 sm:pointer-events-none sm:absolute sm:top-5 sm:left-6 sm:z-10 sm:p-0"> <!-- Village header: a flat parchment strip above the land, so nothing covers the view. -->
<div class="rounded-xl bg-white/85 px-4 py-3 shadow-sm ring-1 ring-parchment-300/70 backdrop-blur sm:pointer-events-auto"> <div class="flex flex-wrap items-center gap-x-6 gap-y-2 border-b-2 border-wood-700 bg-parchment-200 px-4 py-2.5 sm:px-6">
<p class="text-xs font-medium tracking-wide text-ink-500 uppercase">{{ $t('village.title') }}</p> <div class="min-w-0">
<h1 class="font-display text-xl font-semibold sm:text-2xl">{{ village.name }}</h1> <p class="text-xs font-semibold tracking-wide text-ink-500 uppercase">{{ $t('village.title') }}</p>
<NuxtLink <h1 class="truncate font-display text-xl font-semibold text-wood-900 sm:text-2xl" style="font-variant: small-caps">
:to="{ path: `/map/${village.world_id}`, query: { x: village.x, y: village.y } }" {{ village.name }}
class="mt-0.5 inline-flex items-center gap-1 text-xs text-ink-500 hover:text-amber-800 hover:underline" </h1>
:title="$t('village.on_map')" </div>
> <NuxtLink
<IconUi name="pin" class="size-3.5" /> :to="{ path: `/map/${village.world_id}`, query: { x: village.x, y: village.y } }"
<span class="tabular-nums">{{ village.x }}|{{ village.y }} · {{ village.continent }}</span> class="inline-flex items-center gap-1 rounded-sm border border-wood-600/50 bg-parchment-50 px-2 py-1 text-sm text-ink-700 hover:border-blood-700 hover:text-blood-700"
<span>· {{ $t('village.points', { points: village.points }) }}</span> :title="$t('village.on_map')"
</NuxtLink> >
<div class="mt-2.5 sm:w-52"> <IconUi name="pin" class="size-3.5" />
<div class="mb-1 flex justify-between gap-3 text-xs"> <span class="font-semibold tabular-nums">{{ village.x }}|{{ village.y }}</span>
<span class="text-ink-500">{{ $t('village.diorama.space') }}</span> <span class="text-ink-500">· {{ village.continent }} · {{ $t('village.points', { points: village.points }) }}</span>
<span class="font-semibold tabular-nums"> </NuxtLink>
{{ $t('village.diorama.space_value', { used: village.space.used, max: village.space.max }) }} <div class="w-full sm:ml-auto sm:w-64">
</span> <div class="mb-1 flex justify-between gap-3 text-xs">
</div> <span class="font-semibold text-ink-700">{{ $t('village.diorama.space') }}</span>
<UiBar :value="spaceShare" :tone="spaceShare >= 1 ? 'rose' : 'emerald'" /> <span class="font-semibold tabular-nums">
{{ $t('village.diorama.space_value', { used: village.space.used, max: village.space.max }) }}
</span>
</div> </div>
<UiBar :value="spaceShare" :tone="spaceShare >= 1 ? 'rose' : 'emerald'" />
</div> </div>
</div> </div>
<div class="h-[clamp(240px,74vw,440px)] sm:h-[clamp(320px,64vh,780px)]"> <div class="relative">
<VillageDiorama v-model:selected="selected" :village="village" /> <div class="h-[clamp(260px,82vw,460px)] sm:h-[clamp(340px,62vh,760px)]">
<VillageDiorama v-model:selected="selected" :village="village" />
</div>
<p
class="pointer-events-none absolute bottom-3 left-1/2 hidden -translate-x-1/2 rounded-sm border border-wood-700 bg-parchment-50 px-3 py-1 text-xs text-ink-700 sm:block"
>
{{ $t('village.diorama.hint') }}
</p>
<VillageBuildingCard
v-if="selectedBuilding"
class="mx-4 my-4 lg:absolute lg:top-4 lg:right-6 lg:z-10 lg:m-0 lg:w-80"
:building="selectedBuilding"
:resources="resources"
:can-afford="v.canAfford"
:busy="busy"
@upgrade="v.upgrade"
@demolish="v.demolish"
@priority="v.setPriority"
@close="selected = null"
/>
</div> </div>
<p
class="pointer-events-none absolute bottom-3 left-1/2 hidden -translate-x-1/2 rounded-full bg-white/75 px-3 py-1 text-xs text-ink-500 shadow-sm sm:block"
>
{{ $t('village.diorama.hint') }}
</p>
<VillageBuildingCard
v-if="selectedBuilding"
class="mx-4 mb-4 lg:absolute lg:top-5 lg:right-6 lg:z-10 lg:m-0 lg:w-80"
:building="selectedBuilding"
:resources="resources"
:can-afford="v.canAfford"
:busy="busy"
@upgrade="v.upgrade"
@demolish="v.demolish"
@priority="v.setPriority"
@close="selected = null"
/>
</section> </section>
<div class="space-y-6 px-4 py-6 sm:px-6"> <div class="space-y-6 px-4 py-6 sm:px-6">