mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-04 22:06:06 +02:00
feat: add tool nav pinning and unpinning
This commit is contained in:
@@ -31,6 +31,7 @@ import { usePhotonStore } from './photon';
|
||||
import { useSearchStore } from './search';
|
||||
import { useSharedFeedStore } from './sharedFeed';
|
||||
import { useUiStore } from './ui';
|
||||
import { useToolsStore } from './tools';
|
||||
import { useUpdateLoopStore } from './updateLoop';
|
||||
import { useUserStore } from './user';
|
||||
import { useVRCXUpdaterStore } from './vrcxUpdater';
|
||||
@@ -154,6 +155,7 @@ export function createGlobalStores() {
|
||||
notification: useNotificationStore(),
|
||||
feed: useFeedStore(),
|
||||
ui: useUiStore(),
|
||||
tools: useToolsStore(),
|
||||
gameLog: useGameLogStore(),
|
||||
search: useSearchStore(),
|
||||
game: useGameStore(),
|
||||
@@ -198,6 +200,7 @@ export {
|
||||
useGeneralSettingsStore,
|
||||
useNotificationsSettingsStore,
|
||||
useWristOverlaySettingsStore,
|
||||
useToolsStore,
|
||||
useUiStore,
|
||||
useUserStore,
|
||||
useVrStore,
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
import { defineStore } from 'pinia';
|
||||
import { reactive, toRefs } from 'vue';
|
||||
|
||||
const initialDialogState = () => ({
|
||||
groupCalendar: false,
|
||||
noteExport: false,
|
||||
exportDiscordNames: false,
|
||||
exportFriendsList: false,
|
||||
exportAvatarsList: false,
|
||||
editInviteMessages: false,
|
||||
autoChangeStatus: false
|
||||
});
|
||||
|
||||
export const useToolsStore = defineStore('Tools', () => {
|
||||
const dialogs = reactive(initialDialogState());
|
||||
|
||||
function setDialogVisible(dialogKey, value) {
|
||||
if (!(dialogKey in dialogs)) {
|
||||
console.warn(
|
||||
`[toolsStore] Unknown dialog key "${dialogKey}" passed to setDialogVisible`
|
||||
);
|
||||
return;
|
||||
}
|
||||
dialogs[dialogKey] = value;
|
||||
}
|
||||
|
||||
function openDialog(dialogKey) {
|
||||
setDialogVisible(dialogKey, true);
|
||||
}
|
||||
|
||||
function closeDialog(dialogKey) {
|
||||
setDialogVisible(dialogKey, false);
|
||||
}
|
||||
|
||||
function closeAllDialogs() {
|
||||
Object.keys(dialogs).forEach((dialogKey) => {
|
||||
dialogs[dialogKey] = false;
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
...toRefs(dialogs),
|
||||
setDialogVisible,
|
||||
openDialog,
|
||||
closeDialog,
|
||||
closeAllDialogs
|
||||
};
|
||||
});
|
||||
Reference in New Issue
Block a user