Refactor App.vue
This commit is contained in:
parent
27e857b9a6
commit
13be1a38fa
23
src/App.vue
23
src/App.vue
@ -1,32 +1,29 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="overflow-hidden">
|
<div class="overflow-hidden">
|
||||||
<Notifications />
|
<Notifications />
|
||||||
<Login v-if="screen === 'login'" />
|
<component :is="currentScreen" />
|
||||||
<Characters v-if="screen === 'characters'" />
|
|
||||||
<Game v-if="screen === 'game'" />
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useGameStore } from '@/stores/gameStore'
|
import { useGameStore } from '@/stores/gameStore'
|
||||||
|
import { useZoneEditorStore } from '@/stores/zoneEditorStore'
|
||||||
import Notifications from '@/components/utilities/Notifications.vue'
|
import Notifications from '@/components/utilities/Notifications.vue'
|
||||||
import Login from '@/screens/Login.vue'
|
import Login from '@/screens/Login.vue'
|
||||||
import Characters from '@/screens/Characters.vue'
|
import Characters from '@/screens/Characters.vue'
|
||||||
import Game from '@/screens/Game.vue'
|
import Game from '@/screens/Game.vue'
|
||||||
|
import ZoneEditor from '@/screens/ZoneEditor.vue'
|
||||||
import { computed } from 'vue'
|
import { computed } from 'vue'
|
||||||
|
|
||||||
const gameStore = useGameStore()
|
const gameStore = useGameStore()
|
||||||
|
const zoneEditorStore = useZoneEditorStore()
|
||||||
|
|
||||||
const screen = computed(() => {
|
const currentScreen = computed(() => {
|
||||||
if (!gameStore.connection) {
|
if (!gameStore.connection) return Login
|
||||||
return 'login'
|
if (!gameStore.token) return Login
|
||||||
} else if (gameStore.token && gameStore.connection) {
|
if (!gameStore.character) return Characters
|
||||||
if (gameStore.character) {
|
if (zoneEditorStore.active) return ZoneEditor
|
||||||
return 'game'
|
return Game
|
||||||
}
|
|
||||||
return 'characters'
|
|
||||||
}
|
|
||||||
return 'login' // default fallback
|
|
||||||
})
|
})
|
||||||
|
|
||||||
// Disable right click
|
// Disable right click
|
||||||
|
Loading…
x
Reference in New Issue
Block a user