diff options
author | GeckoEidechse <gecko.eidechse+git@pm.me> | 2024-08-02 02:43:39 +0200 |
---|---|---|
committer | GeckoEidechse <gecko.eidechse+git@pm.me> | 2024-08-02 02:43:39 +0200 |
commit | 3362cd9b55021c1325fc573a90ee0be22497bdeb (patch) | |
tree | 0aa139cd452fcb8d9f6bc9c6baac21e852b09f52 /src-vue/src/views/mods | |
parent | e5a74818e79e78d0e065d9375f38fd17a3a591a9 (diff) | |
parent | edbce33c4a8f142967df868fb99476400f4ddfb3 (diff) | |
download | FlightCore-3362cd9b55021c1325fc573a90ee0be22497bdeb.tar.gz FlightCore-3362cd9b55021c1325fc573a90ee0be22497bdeb.zip |
Merge branch 'main' into chore/bump-upload-artifact-action
Diffstat (limited to 'src-vue/src/views/mods')
-rw-r--r-- | src-vue/src/views/mods/LocalModsView.vue | 21 | ||||
-rw-r--r-- | src-vue/src/views/mods/ThunderstoreModsView.vue | 14 |
2 files changed, 30 insertions, 5 deletions
diff --git a/src-vue/src/views/mods/LocalModsView.vue b/src-vue/src/views/mods/LocalModsView.vue index 38f7a914..3979ca14 100644 --- a/src-vue/src/views/mods/LocalModsView.vue +++ b/src-vue/src/views/mods/LocalModsView.vue @@ -5,14 +5,19 @@ </div> <el-scrollbar v-else> + <el-button class="disableModsBtn" type="primary" @click="disableAllModsButCore"> + {{ $t('settings.repair.window.disable_all_but_core') }} + </el-button> <local-mod-card v-for="mod of mods" v-bind:key="mod.name" :mod="mod" /> </el-scrollbar> </template> <script lang="ts"> import { defineComponent } from 'vue'; +import { invoke } from "@tauri-apps/api"; import { NorthstarMod } from "../../../../src-tauri/bindings/NorthstarMod"; import { fuzzy_filter } from "../../utils/filter"; +import { showErrorNotification, showNotification } from "../../utils/ui"; import LocalModCard from "../../components/LocalModCard.vue"; export default defineComponent({ @@ -41,6 +46,16 @@ export default defineComponent({ }; }, methods: { + async disableAllModsButCore() { + await invoke("disable_all_but_core", { gameInstall: this.$store.state.game_install }) + .then((message) => { + showNotification(this.$t('generic.success'), this.$t('settings.repair.window.disable_all_but_core_success')); + this.$store.commit('loadInstalledMods'); + }) + .catch((error) => { + showErrorNotification(error); + }); + }, }, mounted() { this.$store.commit('loadInstalledMods'); @@ -49,5 +64,9 @@ export default defineComponent({ </script> <style scoped> - +.disableModsBtn { + margin-bottom: 10px; + top: 10px; + position: sticky; +} </style> diff --git a/src-vue/src/views/mods/ThunderstoreModsView.vue b/src-vue/src/views/mods/ThunderstoreModsView.vue index 1221f85f..1ec684a6 100644 --- a/src-vue/src/views/mods/ThunderstoreModsView.vue +++ b/src-vue/src/views/mods/ThunderstoreModsView.vue @@ -66,6 +66,9 @@ export default defineComponent({ showDeprecatedMods(): boolean {
return this.$store.state.search.showDeprecatedMods;
},
+ showNsfwMods(): boolean {
+ return this.$store.state.search.showNsfwMods;
+ },
searchValue(): string {
return this.$store.getters.searchWords;
},
@@ -95,22 +98,25 @@ export default defineComponent({ // Filter out deprecated mods
const showDeprecated = !mod.is_deprecated || this.showDeprecatedMods;
+ // Filter out NSFW mods
+ const showNsfw = !mod.has_nsfw_content || this.showNsfwMods;
+
// Filter with categories (only if some categories are selected)
const categoriesMatch: boolean = this.selectedCategories.length === 0
|| mod.categories
.filter((category: string) => this.selectedCategories.includes(category))
.length === this.selectedCategories.length;
- return inputMatches && categoriesMatch && showDeprecated;
+ return inputMatches && categoriesMatch && showDeprecated && showNsfw;
});
},
modsList(): ThunderstoreMod[] {
// Use filtered mods if user is searching, vanilla list otherwise.
const mods: ThunderstoreMod[] = this.searchValue.length !== 0 || this.selectedCategories.length !== 0
? this.filteredMods
- : this.showDeprecatedMods
- ? this.mods
- : this.mods.filter(mod => !mod.is_deprecated);
+ : this.mods
+ .filter(mod => this.showDeprecatedMods || !mod.is_deprecated)
+ .filter(mod => this.showNsfwMods || !mod.has_nsfw_content);
// Sort mods regarding user selected algorithm.
let compare: (a: ThunderstoreMod, b: ThunderstoreMod) => number;
|