|
1 | 1 | <script setup lang="ts"> |
| 2 | +import { computed, defineAsyncComponent } from "vue"; |
2 | 3 | import { polyfillCountryFlagEmojis } from "country-flag-emoji-polyfill"; |
3 | | -import MatchmakingConfirm from "~/components/matchmaking/MatchmakingConfirm.vue"; |
4 | | -import PlayerNameRegistration from "~/components/PlayerNameRegistration.vue"; |
5 | | -import StreamGlobal from "~/components/StreamGlobal.vue"; |
6 | 4 | import { useBranding } from "~/composables/useBranding"; |
| 5 | +import { useApplicationSettingsStore } from "~/stores/ApplicationSettings"; |
| 6 | +import { useAuthStore } from "~/stores/AuthStore"; |
| 7 | +
|
| 8 | +const MatchmakingConfirm = defineAsyncComponent( |
| 9 | + () => import("~/components/matchmaking/MatchmakingConfirm.vue"), |
| 10 | +); |
| 11 | +const PlayerNameRegistration = defineAsyncComponent( |
| 12 | + () => import("~/components/PlayerNameRegistration.vue"), |
| 13 | +); |
| 14 | +const StreamGlobal = defineAsyncComponent( |
| 15 | + () => import("~/components/StreamGlobal.vue"), |
| 16 | +); |
| 17 | +
|
| 18 | +polyfillCountryFlagEmojis(); |
7 | 19 |
|
8 | 20 | useBranding(); |
| 21 | +
|
| 22 | +const authStore = useAuthStore(); |
| 23 | +const applicationSettingsStore = useApplicationSettingsStore(); |
| 24 | +
|
| 25 | +const me = computed(() => authStore.me); |
| 26 | +const hasGlobalStream = computed(() => !!applicationSettingsStore.globalStream); |
9 | 27 | </script> |
10 | 28 |
|
11 | 29 | <template> |
12 | 30 | <NuxtPwaManifest /> |
13 | 31 |
|
14 | | - <StreamGlobal /> |
| 32 | + <StreamGlobal v-if="hasGlobalStream" /> |
15 | 33 |
|
16 | 34 | <template v-if="me"> |
17 | 35 | <PlayerNameRegistration /> |
18 | 36 | <MatchmakingConfirm /> |
19 | 37 | </template> |
20 | 38 |
|
21 | 39 | <NuxtLayout> |
22 | | - <NuxtPage></NuxtPage> |
| 40 | + <NuxtPage :page-key="(route) => route.fullPath" /> |
23 | 41 | </NuxtLayout> |
24 | 42 | <Toaster /> |
25 | 43 | </template> |
26 | | - |
27 | | -<script lang="ts"> |
28 | | -export default { |
29 | | - beforeCreate() { |
30 | | - polyfillCountryFlagEmojis(); |
31 | | - }, |
32 | | - computed: { |
33 | | - me() { |
34 | | - return useAuthStore().me; |
35 | | - }, |
36 | | - }, |
37 | | -}; |
38 | | -</script> |
|
0 commit comments