refactor: favorites tab

This commit is contained in:
pa
2025-11-09 21:59:24 +09:00
committed by Natsumi
parent 9069d8cefe
commit bbd5fa2b21
17 changed files with 4987 additions and 1841 deletions

View File

@@ -24,6 +24,14 @@ export const useUiStore = defineStore('Ui', () => {
const notifiedMenus = ref([]);
const shiftHeld = ref(false);
const trayIconNotify = ref(false);
const socialRouteNames = ['friend-log', 'friend-list', 'moderation'];
const favoriteRouteNames = [
'favorite-friends',
'favorite-worlds',
'favorite-avatars'
];
const lastVisitedSocialRoute = ref(socialRouteNames[0]);
const lastVisitedFavoritesRoute = ref(favoriteRouteNames[0]);
watch(
() => watchState.isLoggedIn,
@@ -50,10 +58,16 @@ export const useUiStore = defineStore('Ui', () => {
() => router.currentRoute.value.name,
(routeName) => {
if (routeName) {
removeNotify(routeName);
if (routeName === 'notification') {
const name = String(routeName);
removeNotify(name);
if (name === 'notification') {
notificationStore.unseenNotifications = [];
}
if (socialRouteNames.includes(name)) {
lastVisitedSocialRoute.value = name;
} else if (favoriteRouteNames.includes(name)) {
lastVisitedFavoritesRoute.value = name;
}
}
}
);
@@ -82,6 +96,8 @@ export const useUiStore = defineStore('Ui', () => {
return {
notifiedMenus,
shiftHeld,
lastVisitedSocialRoute,
lastVisitedFavoritesRoute,
notifyMenu,
removeNotify