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 Mar 20, 2024
1 parent e7140b6 commit 2d3bfb6
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 All @@ -63,9 +58,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 @@ -22,6 +22,7 @@ interface State {
direction?: SortDirection;
disabledPosition?: SortLocalDisabledMods;
searchQuery: string;
dismissedUpdateAll: boolean;
}

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

getters: <GetterTree<State, RootState>>{
Expand Down Expand Up @@ -105,6 +107,10 @@ export default {
state.activeProfile = profile;
},

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

// Avoid calling this directly, prefer updateModList action to
// ensure TSMM specific code gets called.
setModList(state: State, list: ManifestV2[]) {
Expand Down

0 comments on commit 2d3bfb6

Please sign in to comment.