feat: every screen but the village overview and the map is its own page: building screens, reports, ranking and tribe in the page column under the menu and village bar, no windows over the village
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
9255862e23
commit
0a0012e22b
|
|
@ -69,6 +69,13 @@ const screenTitle = computed(() => {
|
||||||
return s ? t(`village.screens.${s.name}`) : ''
|
return s ? t(`village.screens.${s.name}`) : ''
|
||||||
})
|
})
|
||||||
const picked = computed(() => !!plot.value)
|
const picked = computed(() => !!plot.value)
|
||||||
|
/**
|
||||||
|
* Every screen but the overview and the map is a page of its own: the building screens,
|
||||||
|
* the reports, the ranking, the tribe. The village shows only on its overview.
|
||||||
|
*/
|
||||||
|
const page = computed(() => !overview.value && !onMap.value)
|
||||||
|
/** The world's pages carry their title in a band; building screens have their own header. */
|
||||||
|
const pageTitle = computed(() => (route.path.startsWith(`${base.value}/`) ? '' : screenTitle.value))
|
||||||
|
|
||||||
// A village of ours was taken ("geadelt"): say so, and leave its screens for another
|
// A village of ours was taken ("geadelt"): say so, and leave its screens for another
|
||||||
// village, or for the worlds page where a fresh start waits.
|
// village, or for the worlds page where a fresh start waits.
|
||||||
|
|
@ -87,7 +94,6 @@ function onEscape(e: KeyboardEvent) {
|
||||||
const el = e.target as HTMLElement | null
|
const el = e.target as HTMLElement | null
|
||||||
if (el && ['INPUT', 'TEXTAREA', 'SELECT'].includes(el.tagName)) return
|
if (el && ['INPUT', 'TEXTAREA', 'SELECT'].includes(el.tagName)) return
|
||||||
if (picked.value) clear()
|
if (picked.value) clear()
|
||||||
else if (!overview.value && !onMap.value) navigateTo(base.value)
|
|
||||||
}
|
}
|
||||||
onMounted(() => window.addEventListener('keydown', onEscape))
|
onMounted(() => window.addEventListener('keydown', onEscape))
|
||||||
onBeforeUnmount(() => window.removeEventListener('keydown', onEscape))
|
onBeforeUnmount(() => window.removeEventListener('keydown', onEscape))
|
||||||
|
|
@ -151,6 +157,22 @@ useShortcuts(() => {
|
||||||
-->
|
-->
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
|
<!-- A screen of its own, in the page column under the menu and the village bar. -->
|
||||||
|
<div v-if="page" class="min-h-dvh pb-14 md:pb-0">
|
||||||
|
<GameMenuBar in-world />
|
||||||
|
<div class="mx-auto max-w-[1100px] space-y-1 px-1 pt-1 sm:px-2">
|
||||||
|
<GameVillageBar v-if="v.village.value && v.resources.value" :village="v.village.value" :resources="v.resources.value" />
|
||||||
|
<GameVillageNotices :village-id="villageId" />
|
||||||
|
</div>
|
||||||
|
<main class="mx-auto max-w-[1100px] px-1 pt-1.5 pb-4 sm:px-2">
|
||||||
|
<div class="frame @container">
|
||||||
|
<div v-if="pageTitle" class="panel-head"><h1 class="panel-title">{{ pageTitle }}</h1></div>
|
||||||
|
<slot />
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<template v-else>
|
||||||
<div v-if="!onMap" class="fixed inset-0 z-0">
|
<div v-if="!onMap" class="fixed inset-0 z-0">
|
||||||
<VillageDiorama
|
<VillageDiorama
|
||||||
v-if="v.village.value"
|
v-if="v.village.value"
|
||||||
|
|
@ -160,7 +182,7 @@ useShortcuts(() => {
|
||||||
:inset="inset"
|
:inset="inset"
|
||||||
:village="v.village.value"
|
:village="v.village.value"
|
||||||
:resources="v.resources.value"
|
:resources="v.resources.value"
|
||||||
:dismiss="!overview || picked"
|
:dismiss="picked"
|
||||||
:seconds-until="v.secondsUntil"
|
:seconds-until="v.secondsUntil"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -172,34 +194,17 @@ useShortcuts(() => {
|
||||||
<div ref="menuBar"><GameMenuBar class="pointer-events-auto" in-world wide /></div>
|
<div ref="menuBar"><GameMenuBar class="pointer-events-auto" in-world wide /></div>
|
||||||
<div class="space-y-1 px-1 pt-1 sm:px-2">
|
<div class="space-y-1 px-1 pt-1 sm:px-2">
|
||||||
<GameVillageBar v-if="v.village.value && v.resources.value" :village="v.village.value" :resources="v.resources.value" />
|
<GameVillageBar v-if="v.village.value && v.resources.value" :village="v.village.value" :resources="v.resources.value" />
|
||||||
<GameProtectionBar
|
<div class="pointer-events-auto space-y-1 empty:hidden">
|
||||||
v-if="v.village.value?.rally.protected_until"
|
<GameVillageNotices :village-id="villageId" />
|
||||||
class="pointer-events-auto"
|
|
||||||
:until="v.village.value.rally.protected_until"
|
|
||||||
:village-id="villageId"
|
|
||||||
:seconds-until="v.secondsUntil"
|
|
||||||
/>
|
|
||||||
<div v-if="v.village.value" class="pointer-events-auto space-y-1 empty:hidden">
|
|
||||||
<p v-if="v.village.value.season.winner" class="border border-gold-600 bg-parchment-100 px-2 py-0.5 text-sm text-wood-900">
|
|
||||||
{{ $t('village.world_ended', { player: v.village.value.season.winner.name }) }}
|
|
||||||
<NuxtLink to="/worlds" class="ml-2 font-semibold text-blood-700 underline">{{ $t('village.season.next') }}</NuxtLink>
|
|
||||||
</p>
|
|
||||||
<VillageFoodWarning :starvation="v.village.value.starvation" :levy="v.village.value.levy" :seconds-until="v.secondsUntil" />
|
|
||||||
</div>
|
</div>
|
||||||
<p v-if="v.error.value" class="alert pointer-events-auto" role="alert">{{ v.error.value }}</p>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex min-h-0 flex-1 items-start gap-2 p-1 pb-14 sm:p-2 md:pb-2">
|
<div class="flex min-h-0 flex-1 items-start gap-2 p-1 pb-14 sm:p-2 md:pb-2">
|
||||||
<!-- Left: the open screen in a window, or on the overview the card of what is picked. -->
|
<!-- Left, on the overview: the build card of an empty plot picked in the village. -->
|
||||||
<template v-if="!onMap">
|
<div v-if="!onMap" v-show="picked" class="scroll-y float pointer-events-auto max-h-full w-full border border-wood-900 bg-parchment-200 p-1.5 sm:w-80">
|
||||||
<div v-if="overview" v-show="picked" class="scroll-y float pointer-events-auto max-h-full w-full border border-wood-900 bg-parchment-200 p-1.5 sm:w-80">
|
|
||||||
<slot />
|
<slot />
|
||||||
</div>
|
</div>
|
||||||
<UiWindow v-else class="w-full max-w-[66rem]" :title="screenTitle" :close-to="base">
|
|
||||||
<slot />
|
|
||||||
</UiWindow>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<!-- Right: the village's boxes, or on the map its own panels. -->
|
<!-- Right: the village's boxes, or on the map its own panels. -->
|
||||||
<!-- On the map it is there from the start: the map's panels teleport into it. -->
|
<!-- On the map it is there from the start: the map's panels teleport into it. -->
|
||||||
|
|
@ -214,6 +219,7 @@ useShortcuts(() => {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</template>
|
||||||
<GameTabBar :village-id="villageId" />
|
<GameTabBar :village-id="villageId" />
|
||||||
<QuestBook v-if="v.village.value" />
|
<QuestBook v-if="v.village.value" />
|
||||||
<GameChat v-if="v.village.value" :world-id="v.village.value.world_id" :tribe="!!v.village.value.tribe.tribe" />
|
<GameChat v-if="v.village.value" :world-id="v.village.value.world_id" :tribe="!!v.village.value.tribe.tribe" />
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
const props = defineProps<{ villageId: number }>()
|
||||||
|
const v = useVillageContext()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<!-- Under the village bar: beginner protection, a world that ended, hunger, and errors. -->
|
||||||
|
<template>
|
||||||
|
<GameProtectionBar
|
||||||
|
v-if="v.village.value?.rally.protected_until"
|
||||||
|
:until="v.village.value.rally.protected_until"
|
||||||
|
:village-id="props.villageId"
|
||||||
|
:seconds-until="v.secondsUntil"
|
||||||
|
/>
|
||||||
|
<div v-if="v.village.value" class="space-y-1 empty:hidden">
|
||||||
|
<p v-if="v.village.value.season.winner" class="border border-gold-600 bg-parchment-100 px-2 py-0.5 text-sm text-wood-900">
|
||||||
|
{{ $t('village.world_ended', { player: v.village.value.season.winner.name }) }}
|
||||||
|
<NuxtLink to="/worlds" class="ml-2 font-semibold text-blood-700 underline">{{ $t('village.season.next') }}</NuxtLink>
|
||||||
|
</p>
|
||||||
|
<VillageFoodWarning :starvation="v.village.value.starvation" :levy="v.village.value.levy" :seconds-until="v.secondsUntil" />
|
||||||
|
</div>
|
||||||
|
<p v-if="v.error.value" class="alert" role="alert">{{ v.error.value }}</p>
|
||||||
|
</template>
|
||||||
Loading…
Reference in New Issue