mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-30 04:03:48 +02:00
refactor store
This commit is contained in:
@@ -463,6 +463,15 @@
|
||||
import { useFavoritesGroupPanel } from './composables/useFavoritesGroupPanel.js';
|
||||
import { useFavoritesLocalGroups } from './composables/useFavoritesLocalGroups.js';
|
||||
import { useFavoritesSplitter } from './composables/useFavoritesSplitter.js';
|
||||
import {
|
||||
deleteLocalAvatarFavoriteGroup,
|
||||
renameLocalAvatarFavoriteGroup,
|
||||
newLocalAvatarFavoriteGroup,
|
||||
refreshFavorites,
|
||||
getLocalAvatarFavorites,
|
||||
checkInvalidLocalAvatars,
|
||||
removeInvalidLocalAvatars
|
||||
} from '../../coordinators/favoriteCoordinator';
|
||||
|
||||
import AvatarExportDialog from './dialogs/AvatarExportDialog.vue';
|
||||
import FavoritesAvatarItem from './components/FavoritesAvatarItem.vue';
|
||||
@@ -506,15 +515,8 @@
|
||||
const {
|
||||
showAvatarImportDialog,
|
||||
localAvatarFavGroupLength,
|
||||
deleteLocalAvatarFavoriteGroup,
|
||||
renameLocalAvatarFavoriteGroup,
|
||||
newLocalAvatarFavoriteGroup,
|
||||
localAvatarFavoritesList,
|
||||
refreshFavorites,
|
||||
getLocalAvatarFavorites,
|
||||
handleFavoriteGroup,
|
||||
checkInvalidLocalAvatars,
|
||||
removeInvalidLocalAvatars
|
||||
handleFavoriteGroup
|
||||
} = favoriteStore;
|
||||
const { avatarHistory } = storeToRefs(useAvatarStore());
|
||||
const { promptClearAvatarHistory, showAvatarDialog, applyAvatar } = useAvatarStore();
|
||||
|
||||
@@ -356,6 +356,14 @@
|
||||
import { useFavoritesGroupPanel } from './composables/useFavoritesGroupPanel.js';
|
||||
import { useFavoritesLocalGroups } from './composables/useFavoritesLocalGroups.js';
|
||||
import { useFavoritesSplitter } from './composables/useFavoritesSplitter.js';
|
||||
import {
|
||||
refreshFavorites,
|
||||
getLocalWorldFavorites,
|
||||
getLocalFriendFavorites,
|
||||
deleteLocalFriendFavoriteGroup,
|
||||
renameLocalFriendFavoriteGroup,
|
||||
removeLocalFriendFavorite
|
||||
} from '../../coordinators/favoriteCoordinator';
|
||||
|
||||
import FavoritesContentHeader from './components/FavoritesContentHeader.vue';
|
||||
import FavoritesFriendItem from './components/FavoritesFriendItem.vue';
|
||||
@@ -390,15 +398,9 @@
|
||||
} = storeToRefs(favoriteStore);
|
||||
const {
|
||||
showFriendImportDialog,
|
||||
refreshFavorites,
|
||||
getLocalWorldFavorites,
|
||||
getLocalFriendFavorites,
|
||||
handleFavoriteGroup,
|
||||
localFriendFavGroupLength,
|
||||
deleteLocalFriendFavoriteGroup,
|
||||
renameLocalFriendFavoriteGroup,
|
||||
newLocalFriendFavoriteGroup,
|
||||
removeLocalFriendFavorite
|
||||
newLocalFriendFavoriteGroup
|
||||
} = favoriteStore;
|
||||
const userStore = useUserStore();
|
||||
const { showUserDialog } = userStore;
|
||||
|
||||
@@ -395,6 +395,13 @@
|
||||
import { useFavoritesGroupPanel } from './composables/useFavoritesGroupPanel.js';
|
||||
import { useFavoritesLocalGroups } from './composables/useFavoritesLocalGroups.js';
|
||||
import { useFavoritesSplitter } from './composables/useFavoritesSplitter.js';
|
||||
import {
|
||||
renameLocalWorldFavoriteGroup,
|
||||
removeLocalWorldFavorite,
|
||||
newLocalWorldFavoriteGroup,
|
||||
refreshFavorites,
|
||||
getLocalWorldFavorites
|
||||
} from '../../coordinators/favoriteCoordinator';
|
||||
|
||||
import FavoritesContentHeader from './components/FavoritesContentHeader.vue';
|
||||
import FavoritesToolbar from './components/FavoritesToolbar.vue';
|
||||
@@ -426,13 +433,8 @@
|
||||
showWorldImportDialog,
|
||||
localWorldFavGroupLength,
|
||||
deleteLocalWorldFavoriteGroup,
|
||||
renameLocalWorldFavoriteGroup,
|
||||
removeLocalWorldFavorite,
|
||||
newLocalWorldFavoriteGroup,
|
||||
handleFavoriteGroup,
|
||||
localWorldFavoritesList,
|
||||
refreshFavorites,
|
||||
getLocalWorldFavorites
|
||||
localWorldFavoritesList
|
||||
} = favoriteStore;
|
||||
const { showWorldDialog } = useWorldStore();
|
||||
|
||||
|
||||
@@ -152,6 +152,7 @@
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import { useAvatarStore, useFavoriteStore, useUiStore, useUserStore } from '../../../stores';
|
||||
import { removeLocalAvatarFavorite } from '../../../coordinators/favoriteCoordinator';
|
||||
import { favoriteRequest } from '../../../api';
|
||||
|
||||
import FavoritesMoveDropdown from './FavoritesMoveDropdown.vue';
|
||||
@@ -168,7 +169,7 @@
|
||||
const { t } = useI18n();
|
||||
|
||||
const { favoriteAvatarGroups } = storeToRefs(useFavoriteStore());
|
||||
const { removeLocalAvatarFavorite, showFavoriteDialog } = useFavoriteStore();
|
||||
const { showFavoriteDialog } = useFavoriteStore();
|
||||
const { selectAvatarWithConfirmation } = useAvatarStore();
|
||||
const { shiftHeld } = storeToRefs(useUiStore());
|
||||
const { currentUser } = storeToRefs(useUserStore());
|
||||
|
||||
@@ -91,6 +91,7 @@
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import { favoriteRequest } from '../../../api';
|
||||
import { removeLocalFriendFavorite } from '../../../coordinators/favoriteCoordinator';
|
||||
import { useFavoriteStore } from '../../../stores';
|
||||
import { userImage } from '../../../shared/utils';
|
||||
|
||||
@@ -106,7 +107,7 @@
|
||||
const emit = defineEmits(['click', 'toggle-select']);
|
||||
|
||||
const { favoriteFriendGroups } = storeToRefs(useFavoriteStore());
|
||||
const { showFavoriteDialog, removeLocalFriendFavorite } = useFavoriteStore();
|
||||
const { showFavoriteDialog } = useFavoriteStore();
|
||||
const { t } = useI18n();
|
||||
|
||||
const isSelected = computed({
|
||||
|
||||
@@ -166,6 +166,7 @@
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import { useFavoriteStore, useInstanceStore, useInviteStore, useUiStore } from '../../../stores';
|
||||
import { runNewInstanceSelfInviteFlow as newInstanceSelfInvite } from '../../../coordinators/inviteCoordinator';
|
||||
import { favoriteRequest } from '../../../api';
|
||||
|
||||
import FavoritesMoveDropdown from './FavoritesMoveDropdown.vue';
|
||||
@@ -181,7 +182,7 @@
|
||||
const emit = defineEmits(['toggle-select', 'remove-local-world-favorite', 'click']);
|
||||
const { favoriteWorldGroups } = storeToRefs(useFavoriteStore());
|
||||
const { showFavoriteDialog } = useFavoriteStore();
|
||||
const { newInstanceSelfInvite } = useInviteStore();
|
||||
|
||||
const { t } = useI18n();
|
||||
const { canOpenInstanceInGame } = useInviteStore();
|
||||
const { shiftHeld } = storeToRefs(useUiStore());
|
||||
|
||||
@@ -130,6 +130,7 @@
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import { useFavoriteStore, useInstanceStore, useInviteStore, useUiStore } from '../../../stores';
|
||||
import { runNewInstanceSelfInviteFlow as newInstanceSelfInvite } from '../../../coordinators/inviteCoordinator';
|
||||
|
||||
import FavoritesMoveDropdown from './FavoritesMoveDropdown.vue';
|
||||
|
||||
@@ -142,7 +143,7 @@
|
||||
const emit = defineEmits(['remove-local-world-favorite', 'click']);
|
||||
const { favoriteWorldGroups } = storeToRefs(useFavoriteStore());
|
||||
const { showFavoriteDialog } = useFavoriteStore();
|
||||
const { newInstanceSelfInvite } = useInviteStore();
|
||||
|
||||
const { shiftHeld } = storeToRefs(useUiStore());
|
||||
const { t } = useI18n();
|
||||
const { canOpenInstanceInGame } = useInviteStore();
|
||||
|
||||
@@ -11,9 +11,13 @@ const mocks = vi.hoisted(() => ({
|
||||
createNewInstance: vi.fn()
|
||||
}));
|
||||
|
||||
vi.mock('pinia', () => ({
|
||||
storeToRefs: (store) => store
|
||||
}));
|
||||
vi.mock('pinia', async (importOriginal) => {
|
||||
const actual = await importOriginal();
|
||||
return {
|
||||
...actual,
|
||||
storeToRefs: (store) => store
|
||||
};
|
||||
});
|
||||
|
||||
vi.mock('vue-i18n', () => ({
|
||||
useI18n: () => ({
|
||||
|
||||
@@ -123,6 +123,7 @@
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import { useAvatarStore, useFavoriteStore, useGalleryStore, useUserStore } from '../../../stores';
|
||||
import { addLocalAvatarFavorite } from '../../../coordinators/favoriteCoordinator';
|
||||
import { avatarRequest, favoriteRequest } from '../../../api';
|
||||
import { createColumns } from './avatarImportColumns.jsx';
|
||||
import { removeFromArray } from '../../../shared/utils';
|
||||
@@ -133,7 +134,7 @@
|
||||
const { showUserDialog } = useUserStore();
|
||||
const { favoriteAvatarGroups, avatarImportDialogInput, avatarImportDialogVisible, localAvatarFavoriteGroups } =
|
||||
storeToRefs(useFavoriteStore());
|
||||
const { addLocalAvatarFavorite, localAvatarFavGroupLength, getCachedFavoritesByObjectId } = useFavoriteStore();
|
||||
const { localAvatarFavGroupLength, getCachedFavoritesByObjectId } = useFavoriteStore();
|
||||
const { showAvatarDialog, applyAvatar } = useAvatarStore();
|
||||
const { showFullscreenImageDialog } = useGalleryStore();
|
||||
|
||||
|
||||
@@ -127,6 +127,7 @@
|
||||
|
||||
import { removeFromArray, userImage, userImageFull } from '../../../shared/utils';
|
||||
import { useFavoriteStore, useGalleryStore, useUserStore } from '../../../stores';
|
||||
import { addLocalFriendFavorite } from '../../../coordinators/favoriteCoordinator';
|
||||
import { favoriteRequest, userRequest } from '../../../api';
|
||||
import { createColumns } from './friendImportColumns.jsx';
|
||||
import { useVrcxVueTable } from '../../../lib/table/useVrcxVueTable';
|
||||
@@ -139,7 +140,7 @@
|
||||
const { favoriteFriendGroups, friendImportDialogInput, friendImportDialogVisible, localFriendFavoriteGroups } =
|
||||
storeToRefs(useFavoriteStore());
|
||||
const { showFullscreenImageDialog } = useGalleryStore();
|
||||
const { getCachedFavoritesByObjectId, localFriendFavGroupLength, addLocalFriendFavorite } = useFavoriteStore();
|
||||
const { getCachedFavoritesByObjectId, localFriendFavGroupLength } = useFavoriteStore();
|
||||
|
||||
const friendImportDialog = ref({
|
||||
loading: false,
|
||||
|
||||
@@ -127,6 +127,7 @@
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import { useFavoriteStore, useGalleryStore, useUserStore, useWorldStore } from '../../../stores';
|
||||
import { addLocalWorldFavorite } from '../../../coordinators/favoriteCoordinator';
|
||||
import { favoriteRequest, worldRequest } from '../../../api';
|
||||
import { createColumns } from './worldImportColumns.jsx';
|
||||
import { removeFromArray } from '../../../shared/utils';
|
||||
@@ -135,7 +136,7 @@
|
||||
const { showUserDialog } = useUserStore();
|
||||
const { favoriteWorldGroups, worldImportDialogInput, worldImportDialogVisible, localWorldFavoriteGroups } =
|
||||
storeToRefs(useFavoriteStore());
|
||||
const { localWorldFavGroupLength, addLocalWorldFavorite, getCachedFavoritesByObjectId } = useFavoriteStore();
|
||||
const { localWorldFavGroupLength, getCachedFavoritesByObjectId } = useFavoriteStore();
|
||||
const { showWorldDialog } = useWorldStore();
|
||||
const { showFullscreenImageDialog } = useGalleryStore();
|
||||
|
||||
|
||||
@@ -58,6 +58,7 @@
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import { useAppearanceSettingsStore, useModalStore, useModerationStore, useVrcxStore } from '../../stores';
|
||||
import { runRefreshPlayerModerationsFlow as refreshPlayerModerations } from '../../coordinators/moderationCoordinator';
|
||||
import { DataTableLayout } from '../../components/ui/data-table';
|
||||
import { createColumns } from './columns.jsx';
|
||||
import { moderationTypes } from '../../shared/constants';
|
||||
@@ -69,7 +70,7 @@
|
||||
|
||||
const { t } = useI18n();
|
||||
const { playerModerationTable } = storeToRefs(useModerationStore());
|
||||
const { refreshPlayerModerations, handlePlayerModerationDelete } = useModerationStore();
|
||||
const { handlePlayerModerationDelete } = useModerationStore();
|
||||
const appearanceSettingsStore = useAppearanceSettingsStore();
|
||||
const vrcxStore = useVrcxStore();
|
||||
const modalStore = useModalStore();
|
||||
|
||||
@@ -25,9 +25,13 @@ mocks.pagination = mocks.makeRef({
|
||||
pageSize: 10
|
||||
});
|
||||
|
||||
vi.mock('pinia', () => ({
|
||||
storeToRefs: (store) => store
|
||||
}));
|
||||
vi.mock('pinia', async (importOriginal) => {
|
||||
const actual = await importOriginal();
|
||||
return {
|
||||
...actual,
|
||||
storeToRefs: (store) => store
|
||||
};
|
||||
});
|
||||
|
||||
vi.mock('vue-i18n', () => ({
|
||||
useI18n: () => ({
|
||||
@@ -68,10 +72,18 @@ vi.mock('../../../api', () => ({
|
||||
}
|
||||
}));
|
||||
|
||||
vi.mock('../../../shared/constants', () => ({
|
||||
moderationTypes: ['block', 'mute', 'unmute']
|
||||
vi.mock('../../../coordinators/moderationCoordinator', () => ({
|
||||
runRefreshPlayerModerationsFlow: (...args) => mocks.refreshPlayerModerations(...args)
|
||||
}));
|
||||
|
||||
vi.mock('../../../shared/constants', async (importOriginal) => {
|
||||
const actual = await importOriginal();
|
||||
return {
|
||||
...actual,
|
||||
moderationTypes: ['block', 'mute', 'unmute']
|
||||
};
|
||||
});
|
||||
|
||||
vi.mock('../columns.jsx', () => ({
|
||||
createColumns: (handlers) => {
|
||||
mocks.columnHandlers = handlers;
|
||||
|
||||
@@ -365,6 +365,7 @@
|
||||
|
||||
import PresetColorPicker from '@/components/PresetColorPicker.vue';
|
||||
import TableLimitsDialog from '@/components/dialogs/TableLimitsDialog.vue';
|
||||
import { saveSortFavoritesOption } from '@/coordinators/favoriteCoordinator';
|
||||
|
||||
import SimpleSwitch from '../SimpleSwitch.vue';
|
||||
|
||||
@@ -398,7 +399,6 @@
|
||||
|
||||
const appLanguageDisplayName = computed(() => getLanguageName(String(appLanguage.value)));
|
||||
|
||||
const { saveSortFavoritesOption } = useFavoriteStore();
|
||||
|
||||
const {
|
||||
setDisplayVRCPlusIconsAsAvatar,
|
||||
|
||||
@@ -184,11 +184,12 @@
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import { useAdvancedSettingsStore, useGameStore, useModalStore } from '../../../stores';
|
||||
import { runSweepVRChatCacheFlow as sweepVRChatCache } from '../../../coordinators/gameCoordinator';
|
||||
import { VRChatCameraResolutions, VRChatScreenshotResolutions } from '../../../shared/constants';
|
||||
import { getVRChatResolution, openExternalLink } from '../../../shared/utils';
|
||||
|
||||
const { VRChatUsedCacheSize, VRChatTotalCacheSize, VRChatCacheSizeLoading } = storeToRefs(useGameStore());
|
||||
const { sweepVRChatCache, getVRChatCacheSize } = useGameStore();
|
||||
const { getVRChatCacheSize } = useGameStore();
|
||||
const { folderSelectorDialog } = useAdvancedSettingsStore();
|
||||
const { isVRChatConfigDialogVisible } = storeToRefs(useAdvancedSettingsStore());
|
||||
const modalStore = useModalStore();
|
||||
|
||||
@@ -59,7 +59,6 @@ vi.mock('../../../../stores', () => ({
|
||||
VRChatUsedCacheSize,
|
||||
VRChatTotalCacheSize,
|
||||
VRChatCacheSizeLoading,
|
||||
sweepVRChatCache: mocks.sweepVRChatCache,
|
||||
getVRChatCacheSize: mocks.getVRChatCacheSize
|
||||
}),
|
||||
useAdvancedSettingsStore: () => ({
|
||||
@@ -97,6 +96,10 @@ vi.mock('vue-sonner', () => ({
|
||||
toast: mocks.toast
|
||||
}));
|
||||
|
||||
vi.mock('../../../../coordinators/gameCoordinator', () => ({
|
||||
runSweepVRChatCacheFlow: (...args) => mocks.sweepVRChatCache(...args)
|
||||
}));
|
||||
|
||||
// Set global mocks for CefSharp-injected APIs
|
||||
globalThis.AppApi = mocks.appApi;
|
||||
globalThis.AssetBundleManager = mocks.assetBundleManager;
|
||||
|
||||
Reference in New Issue
Block a user