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

28 lines
885 B
Vue
Raw Normal View History

<script setup lang="ts">
const route = useRoute()
const { current } = useCurrentWorld()
/**
* The village whose bar 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 menu bar, then the village bar and its screens, like Die Stämme. -->
<template>
<div class="min-h-dvh pb-16 md:pb-0">
<GameMenuBar in-world />
<GameVillageFrame v-if="villageId" :key="villageId" :village-id="villageId">
<slot />
</GameVillageFrame>
<main v-else>
<slot />
</main>
</div>
</template>