<script setup lang="ts">
import { RouterView } from 'vue-router'
import { computed } from 'vue'
import { useRoute } from 'vue-router'

import AdminLayout from './layouts/AdminLayout.vue'
import AppLayout from './layouts/AppLayout.vue'

const route = useRoute()
const layout = computed(() => {
  if (route.path === '/m' || route.path.startsWith('/m/')) {
    return 'blank'
  }

  return route.meta.layout || 'app'
})
</script>

<template>
  <AdminLayout v-if="layout === 'admin'">
    <RouterView />
  </AdminLayout>
  <RouterView v-else-if="layout === 'blank'" />
  <AppLayout v-else>
    <RouterView />
  </AppLayout>
</template>
