11<template >
2- <div >
3- <nav
4- v-if =" loggedIn && routerIsReady && loginRedirectCheckIsReady"
5- class =" h-14 top-0 z-20 w-full border-b shadow-sm bg-lightNavbar shadow-headerShadow dark:bg-darkNavbar dark:border-darkSidebarDevider"
6- >
7- <div class =" af-header px-3 lg:px-5 lg:pl-3 flex items-center justify-end h-full w-full" >
8- <div class =" flex items-center" >
9- <component
10- v-if =" coreStore?.adminUser"
11- v-for =" c in coreStore?.config?.globalInjections?.header || []"
12- :is =" getCustomComponent(c)"
13- :meta =" c.meta"
14- :adminUser =" coreStore.adminUser"
15- />
16-
17- <div class =" flex items-center ms-3 " >
18- <span
19- v-if =" !coreStore.config?.singleTheme"
20- @click =" toggleTheme" class =" cursor-pointer flex items-center gap-1 block px-4 py-2 text-sm text-black dark:text-darkSidebarTextHover dark:hover:text-darkSidebarTextActive" role =" menuitem" >
21- <IconMoonSolid class =" w-5 h-5 text-blue-300" v-if =" coreStore.theme !== 'dark'" />
22- <IconSunSolid class =" w-5 h-5 text-yellow-300" v-else />
23- </span >
24- <div >
25- <button
26- ref =" dropdownUserButton"
27- type =" button" class =" flex text-sm bg- rounded-full focus:ring-4 focus:ring-lightSidebarDevider dark:focus:ring-darkSidebarDevider dark:bg-" aria-expanded =" false" data-dropdown-toggle =" dropdown-user" >
28- <span class =" sr-only" >{{ $t('Open user menu') }}</span >
29- <svg class =" w-8 h-8 text-lightNavbarIcons dark:text-darkNavbarIcons" aria-hidden =" true" xmlns =" http://www.w3.org/2000/svg" width =" 24" height =" 24" fill =" currentColor" viewBox =" 0 0 24 24" >
30- <path fill-rule =" evenodd" d =" M12 20a7.966 7.966 0 0 1-5.002-1.756l.002.001v-.683c0-1.794 1.492-3.25 3.333-3.25h3.334c1.84 0 3.333 1.456 3.333 3.25v.683A7.966 7.966 0 0 1 12 20ZM2 12C2 6.477 6.477 2 12 2s10 4.477 10 10c0 5.5-4.44 9.963-9.932 10h-.138C6.438 21.962 2 17.5 2 12Zm10-5c-1.84 0-3.333 1.455-3.333 3.25S10.159 13.5 12 13.5c1.84 0 3.333-1.455 3.333-3.25S13.841 7 12 7Z" clip-rule =" evenodd" />
31- </svg >
32- </button >
33- </div >
34-
35- <div class =" z-50 hidden my-4 text-base list-none bg-white divide-y divide-gray-100 rounded shadow dark:shadow-black dark:bg-darkSidebar dark:divide-darkSidebarDevider dark:shadow-black" id =" dropdown-user" >
36- <div class =" px-4 py-3" role =" none" >
37- <p class =" text-sm text-gray-900 dark:text-darkNavbarText" role =" none" v-if =" coreStore.userFullname" >
38- {{ coreStore.userFullname }}
39- </p >
40- <p class =" text-sm font-medium text-gray-900 truncate dark:text-darkSidebarText" role =" none" >
41- {{ coreStore.username }}
42- </p >
43- </div >
44-
45- <ul class =" py-1" role =" none" >
46- <li v-for =" c in coreStore?.config?.globalInjections?.userMenu || []" >
47- <component
48- :is =" getCustomComponent(c)"
49- :meta =" c.meta"
50- :adminUser =" coreStore.adminUser"
51- />
52- </li >
53- <li v-if =" coreStore?.config?.settingPages && coreStore.config.settingPages.length > 0" >
54- <UserMenuSettingsButton />
55- </li >
56- <li >
57- <button @click =" logout" class =" cursor-pointer flex items-center gap-1 block px-4 py-2 text-sm text-black hover:bg-html dark:text-darkSidebarTextHover dark:hover:bg-darkSidebarItemHover dark:hover:text-darkSidebarTextActive w-full" role =" menuitem" >{{ $t('Sign out') }}</button >
58- </li >
59- </ul >
60- </div >
61- </div >
62- </div >
63- </div >
64- </nav >
65- </div >
66- <div class =" m-4 h-full w-full" >
67-
2+ <div class =" m-4 mt-16 h-full w-full" >
683 <div v-if =" !coreStore?.config?.settingPages || coreStore?.config?.settingPages.length === 0" >
694 <p >No setting pages configured or still loading...</p >
705 </div >
8823</template >
8924
9025<script setup lang="ts">
91- import { computed , ref , onMounted , watch } from ' vue' ;
26+ import { ref , onMounted , watch } from ' vue' ;
9227import { useRouter } from ' vue-router' ;
9328import { useCoreStore } from ' @/stores/core' ;
94- import { useUserStore } from ' @/stores/user' ;
9529import { getCustomComponent , getIcon } from ' @/utils' ;
9630import { Dropdown } from ' flowbite' ;
97- import { IconMoonSolid , IconSunSolid } from ' @iconify-prerendered/vue-flowbite' ;
9831import adminforth from ' @/adminforth' ;
9932import { VerticalTabs } from ' @/afcl'
10033import { useRoute } from ' vue-router'
101- import UserMenuSettingsButton from ' ../components/UserMenuSettingsButton.vue' ;
10234
10335const route = useRoute ()
10436const coreStore = useCoreStore ();
105- const userStore = useUserStore ();
10637const router = useRouter ();
10738
108- const loggedIn = computed (() => { return !! coreStore ?.adminUser });
10939const routerIsReady = ref (false );
11040const loginRedirectCheckIsReady = ref (false );
111- const sideBarOpen = ref (false );
112- const theme = ref (' light' );
11341const dropdownUserButton = ref <HTMLElement | null >(null );
11442const VerticalTabsRef = ref ();
11543const activeTab = ref (' ' );
@@ -123,11 +51,6 @@ async function initRouter() {
12351 routerIsReady .value = true ;
12452}
12553
126- function toggleTheme() {
127- theme .value = theme .value === ' light' ? ' dark' : ' light' ;
128- coreStore .toggleTheme ();
129- }
130-
13154function settingPageSlotName(c : { slug? : string ; pageLabel? : string }, idx : number ) {
13255 const base = (c .slug && c .slug .trim ()) || (c .pageLabel && c .pageLabel .trim ()) || ` tab-${idx } ` ;
13356 return base
@@ -137,13 +60,6 @@ function settingPageSlotName(c: { slug?: string; pageLabel?: string }, idx: numb
13760 .replace (/ [^ a-z0-9 -_] / g , ' -' ) || ` tab-${idx } ` ;
13861}
13962
140-
141- async function logout() {
142- userStore .unauthorize ();
143- await userStore .logout ();
144- router .push ({ name: ' login' })
145- }
146-
14763watch (dropdownUserButton , (el ) => {
14864 if (el ) {
14965 const dd = new Dropdown (
0 commit comments