Skip to content

Commit

Permalink
Move dismissedUpdateAll from main Vuex store to ProfileModule
Browse files Browse the repository at this point in the history
The banner for updating all mods with updates is shown on the view
listing the mods in currently selected profile, so the module which
handles the rest of the profile related data is a more suitabl
location.
  • Loading branch information
anttimaki committed Apr 3, 2024
1 parent dbca46f commit 0d229f3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/components/views/InstalledModView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
You have {{ numberOfModsWithUpdates }} available mod update{{ numberOfModsWithUpdates > 1 ? "s" : ""}}.
Would you like to <a @click="$store.commit('openUpdateAllModsModal')">update all</a>?
</span>
<a class="float-right cursor-pointer" @click="$store.dispatch('dismissUpdateAll')">
<a class="float-right cursor-pointer" @click="$store.commit('profile/dismissUpdateAll')">
<i class="fas fa-times" />
</a>
</div>
Expand All @@ -50,7 +50,7 @@ import LocalModListProvider from "../../providers/components/loaders/LocalModLis
export default class InstalledModView extends Vue {
get dismissedUpdateAll() {
return this.$store.state.dismissedUpdateAll;
return this.$store.state.profile.dismissedUpdateAll;
}
get localModList(): ManifestV2[] {
Expand Down
8 changes: 0 additions & 8 deletions src/store/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ Vue.use(Vuex);

export interface State {
activeGame: Game;
dismissedUpdateAll: boolean;
isMigrationChecked: boolean;
_settings: ManagerSettings | null;
}
Expand All @@ -31,16 +30,12 @@ type Context = ActionContext<State, State>;
export const store = {
state: {
activeGame: GameManager.defaultGame,
dismissedUpdateAll: false,
isMigrationChecked: false,

// Access through getters to ensure the settings are loaded.
_settings: null,
},
actions: {
dismissUpdateAll({commit}: Context) {
commit('dismissUpdateAll');
},
async checkMigrations({commit, state}: Context) {
if (state.isMigrationChecked) {
return;
Expand Down Expand Up @@ -73,9 +68,6 @@ export const store = {
setActiveGame(state: State, game: Game) {
state.activeGame = game;
},
dismissUpdateAll(state: State) {
state.dismissedUpdateAll = true;
},
setMigrationChecked(state: State) {
state.isMigrationChecked = true;
},
Expand Down
6 changes: 6 additions & 0 deletions src/store/modules/ProfileModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ interface State {
direction?: SortDirection;
disabledPosition?: SortLocalDisabledMods;
searchQuery: string;
dismissedUpdateAll: boolean;
}

/**
Expand All @@ -41,6 +42,7 @@ export default {
direction: undefined,
disabledPosition: undefined,
searchQuery: '',
dismissedUpdateAll: false,
}),

getters: <GetterTree<State, RootState>>{
Expand Down Expand Up @@ -112,6 +114,10 @@ export default {
},

mutations: {
dismissUpdateAll(state: State) {
state.dismissedUpdateAll = true;
},

// Use updateActiveProfile action to ensure the persistent
// settings are updated.
setActiveProfile(state: State, profileName: string) {
Expand Down

0 comments on commit 0d229f3

Please sign in to comment.