game-village-politics-frontend/app/layouts/game.vue

30 lines
989 B
Vue

<script setup lang="ts">
const route = useRoute()
const { current } = useCurrentWorld()
/**
* The village whose header stays on top of every screen in the world: the one in the
* URL on village screens, else the one last opened in this world (map, reports).
*/
const villageId = computed(() => {
if (route.path.startsWith('/village/')) return Number(route.params.id)
const worldId = Number(route.params.worldId)
return current.value && current.value.worldId === worldId ? current.value.villageId : null
})
</script>
<!-- Inside a world: the main menu, then the village header and its screens, like Die Stämme. -->
<template>
<div class="min-h-dvh pb-14 md:pb-0">
<GameMenuBar in-world />
<GameVillageFrame v-if="villageId" :key="villageId" :village-id="villageId">
<slot />
</GameVillageFrame>
<main v-else class="mx-auto max-w-[1100px] px-1 pt-1.5 pb-4 sm:px-2">
<div class="frame">
<slot />
</div>
</main>
</div>
</template>