From 25d0c825617a96e87524551e6eca3448166f43dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20M=C3=A4ki?= Date: Mon, 19 Feb 2024 13:25:53 +0200 Subject: [PATCH] Move localModList from main Vuex store to ProfileModule "local" in the variable name refers to locally installed mods, i.e. the mods currently included in the profile. It therefore makes sense for the mod list to be part of the ProfileModule. --- .../importing/LocalFileImportModal.vue | 2 +- src/components/mixins/UtilityMixin.vue | 2 +- src/components/navigation/NavigationMenu.vue | 2 +- .../settings-components/SettingsView.vue | 4 +-- src/components/views/DownloadModModal.vue | 6 ++-- src/components/views/InstalledModView.vue | 4 +-- src/components/views/LocalModList.vue | 6 ++-- .../views/LocalModList/DisableModModal.vue | 2 +- .../views/LocalModList/LocalModCard.vue | 4 +-- src/components/views/OnlineModList.vue | 2 +- src/components/views/OnlineModView.vue | 2 +- src/pages/Manager.vue | 14 +++++----- src/pages/Profiles.vue | 2 +- src/store/index.ts | 19 +------------ src/store/modules/ProfileModule.ts | 28 +++++++++++++++++-- 15 files changed, 52 insertions(+), 47 deletions(-) diff --git a/src/components/importing/LocalFileImportModal.vue b/src/components/importing/LocalFileImportModal.vue index 2973d9ef9..1a032c131 100644 --- a/src/components/importing/LocalFileImportModal.vue +++ b/src/components/importing/LocalFileImportModal.vue @@ -297,7 +297,7 @@ export default class LocalFileImportModal extends Vue { this.showError(updatedModListResult); return; } - await this.$store.dispatch("updateModList", updatedModListResult); + await this.$store.dispatch("profile/updateModList", updatedModListResult); this.emitClose(); }); diff --git a/src/components/mixins/UtilityMixin.vue b/src/components/mixins/UtilityMixin.vue index f40317c14..5355b74f7 100644 --- a/src/components/mixins/UtilityMixin.vue +++ b/src/components/mixins/UtilityMixin.vue @@ -51,7 +51,7 @@ export default class UtilityMixin extends Vue { const modList = await ProfileModList.getModList(profile); if (!(modList instanceof R2Error)) { - this.$store.dispatch("updateModList", modList); + await this.$store.dispatch("profile/updateModList", modList); } } diff --git a/src/components/navigation/NavigationMenu.vue b/src/components/navigation/NavigationMenu.vue index db41a7cb7..82b4c2aec 100644 --- a/src/components/navigation/NavigationMenu.vue +++ b/src/components/navigation/NavigationMenu.vue @@ -91,7 +91,7 @@ export default class NavigationMenu extends Vue { } get localModCount(): number { - return (this.$store.state.localModList || []).length; + return this.$store.state.profile.modList.length; } getTagLinkClasses(routeNames: string[]) { diff --git a/src/components/settings-components/SettingsView.vue b/src/components/settings-components/SettingsView.vue index 1791010bd..62a0b1635 100644 --- a/src/components/settings-components/SettingsView.vue +++ b/src/components/settings-components/SettingsView.vue @@ -87,7 +87,7 @@ import UtilityMixin from '../mixins/UtilityMixin.vue'; private activeGame!: Game; get localModList(): ManifestV2[] { - return this.$store.state.localModList || []; + return this.$store.state.profile.modList; } get appName(): string { @@ -247,7 +247,7 @@ import UtilityMixin from '../mixins/UtilityMixin.vue'; 'Update all mods', 'Quickly update every installed mod to their latest versions.', async () => { - const outdatedMods = this.$store.getters.localModsWithUpdates; + const outdatedMods = this.$store.getters['profile/modsWithUpdates']; if (outdatedMods.length === 1) { return "1 mod has an update available"; } diff --git a/src/components/views/DownloadModModal.vue b/src/components/views/DownloadModModal.vue index 8f4047e20..0c4cfb682 100644 --- a/src/components/views/DownloadModModal.vue +++ b/src/components/views/DownloadModModal.vue @@ -81,7 +81,7 @@

The following mods will be downloaded and installed: