<!-- app/layouts/dashboard.vue -->
<template>
  <div class="flex bg-light-primary dark:bg-dark-primary">
    <Sidebar :sidebar-items="defaultSidebar" />
    <div class="flex-1 flex flex-col">
      <main
        class="flex-1 bg-light-primary dark:bg-dark-primary"
      >
        <slot />
      </main>
    </div>
  </div>
</template>

<script setup>
import { watch } from "vue";
import { useRoute } from "#imports";

// JSON فایل‌ها
import defaultSidebar from "@/json/sidebar/dashboard.json";

// import tabBarData from "@/json/tab-bar/dashboard/dashboard.json"

const route = useRoute();
const onUserMenu = (action) => {
  switch (action.key) {
    case 'profile':
      navigateTo('/profile')
      break
    case 'settings':
      navigateTo('/settings')
      break
    case 'developer':
      navigateTo('/developer')
      break
    case 'admin':
      navigateTo('/admin')
      break
      break

    case 'logout':
      console.log('logout from parent')
      break
  }
}
// داده‌های سایدبار
const sidebarData = route.meta.sidebarItems || defaultSidebar;
const headerSchema = ref({});
headerSchema.value = {
  breadcrumb: false,
  logo: true,
};
// اضافه کردن Route Meta برای سایدبار
watch(
  () => route,
  (newRoute) => {
    sidebarData.value = newRoute.meta.sidebarItems || defaultSidebar;
  },
  { immediate: true }
);



</script>
