@@ -312,7 +312,7 @@ import { computed, ref, watch, nextTick, onMounted, onUnmounted, type Ref } from
312312import { useCoreStore } from ' @/stores/core' ;
313313import MenuLink from ' ./MenuLink.vue' ;
314314import { IconPanelLeftClose , IconPanelLeftOpen , IconChevronDown , IconX , IconCircleAlert } from ' @iconify-prerendered/vue-lucide' ;
315- import { getIcon , verySimpleHash , loadFile , getCustomComponent } from ' @/utils' ;
315+ import { getIcon , verySimpleHash , loadFile , getCustomComponent , lsKey } from ' @/utils' ;
316316import { Tooltip } from ' @/afcl' ;
317317import type { AnnouncementBadgeResponse , AdminForthConfigMenuItem } from ' @/types/Common' ;
318318import { useAdminforth } from ' @/adminforth' ;
@@ -338,7 +338,7 @@ const emit = defineEmits<{
338338
339339const coreStore = useCoreStore ();
340340
341- const OPENED_GROUPS_LS_KEY = ' afSidebarOpenedGroups ' ;
341+ const OPENED_GROUPS_LS_KEY = lsKey ( ' sidebarOpenedGroups ' ) ;
342342// expanded/collapsed state of groups toggled by user, by itemId, untouched groups fall back to item.open
343343const openedGroups = ref <Record <string , boolean >>(JSON .parse (localStorage .getItem (OPENED_GROUPS_LS_KEY ) || ' {}' ));
344344const sidebarAside = ref (null );
@@ -357,7 +357,7 @@ function handleBreakpointChange(e: MediaQueryListEvent) {
357357 } else {
358358 if (props .forceIconOnly === true ) {
359359 isSidebarIconOnly .value = true ;
360- } else if (iconOnlySidebarEnabled .value && localStorage .getItem (' afIconOnlySidebar ' ) === ' true' ) {
360+ } else if (iconOnlySidebarEnabled .value && localStorage .getItem (lsKey ( ' iconOnlySidebar ' ) ) === ' true' ) {
361361 isSidebarIconOnly .value = true ;
362362 } else {
363363 isSidebarIconOnly .value = false ;
@@ -404,7 +404,7 @@ function clickOnMenuItem(item: AdminForthConfigMenuItem) {
404404
405405watch (isSidebarIconOnly , (isIconOnly ) => {
406406 if (! isMobile .value && iconOnlySidebarEnabled .value && ! props .forceIconOnly ) {
407- localStorage .setItem (' afIconOnlySidebar ' , isIconOnly .toString ());
407+ localStorage .setItem (lsKey ( ' iconOnlySidebar ' ) , isIconOnly .toString ());
408408 }
409409 emit (' sidebarStateChange' , { isSidebarIconOnly: isIconOnly , isSidebarHovering: isSidebarHovering .value });
410410})
@@ -425,7 +425,7 @@ const ctaBadge: Ref<(AnnouncementBadgeResponse & { hash: string; }) | null> = co
425425 return null ;
426426 }
427427 const hash = badge .closable ? verySimpleHash (JSON .stringify (badge )) : ' ' ;
428- if (badge .closable && window .localStorage .getItem (` ctaBadge-${hash } ` )) {
428+ if (badge .closable && window .localStorage .getItem (lsKey ( ` ctaBadge-${hash } ` ) )) {
429429 return null ;
430430 }
431431 return {... badge , hash };
@@ -436,7 +436,7 @@ function closeCTA() {
436436 return ;
437437 }
438438 const hash = ctaBadge .value .hash ;
439- window .localStorage .setItem (` ctaBadge-${hash } ` , ' 1' );
439+ window .localStorage .setItem (lsKey ( ` ctaBadge-${hash } ` ) , ' 1' );
440440 nextTick ( async () => {
441441 emit (' loadMenu' );
442442 await coreStore .fetchMenuBadges ();
@@ -469,7 +469,7 @@ watch(() => props.forceIconOnly, (force) => {
469469 }
470470 if (props .forceIconOnly === true ) {
471471 isSidebarIconOnly .value = true ;
472- } else if (iconOnlySidebarEnabled .value && localStorage .getItem (' afIconOnlySidebar ' ) === ' true' ) {
472+ } else if (iconOnlySidebarEnabled .value && localStorage .getItem (lsKey ( ' iconOnlySidebar ' ) ) === ' true' ) {
473473 isSidebarIconOnly .value = true ;
474474 } else {
475475 isSidebarIconOnly .value = false ;
0 commit comments