<template>
  <TopNav v-if="!route.meta.hideNav" />
  <RouterView />
  <BottomNav v-if="!route.meta.hideNav" />
  <BaseToast />
</template>

<script setup lang="ts">
import { onMounted } from 'vue'
import { useRoute } from 'vue-router'
import TopNav from '@/components/TopNav.vue'
import BottomNav from '@/components/BottomNav.vue'
import BaseToast from '@/components/BaseToast.vue'
import { useAuthStore } from '@/stores/auth'
import { useTheme } from '@/composables/useTheme'

const route = useRoute()
const auth  = useAuthStore()
const { applyTheme } = useTheme()

onMounted(() => {
  const stamped = document.documentElement.dataset.theme
  const resolved = stamped || auth.user?.theme
  if (resolved) applyTheme(resolved)
})
</script>
