aboutsummaryrefslogtreecommitdiff
path: root/src-vue/src/components/ThunderstoreModCard.vue
diff options
context:
space:
mode:
authorRémy Raes <contact@remyraes.com>2023-04-10 14:25:32 +0200
committerGitHub <noreply@github.com>2023-04-10 14:25:32 +0200
commit6d58e6793d40df4fec518f37351868803a02a033 (patch)
tree8ba8b1fdf503579314e9475bee409e0ba549e7ad /src-vue/src/components/ThunderstoreModCard.vue
parent0d4744ad1f05ea6410b4cbe4e1e0270e67055ce6 (diff)
downloadFlightCore-6d58e6793d40df4fec518f37351868803a02a033.tar.gz
FlightCore-6d58e6793d40df4fec518f37351868803a02a033.zip
refactor: Notifications (#259)
* feat: wrap ElNotification class in a showNotification method * refactor: replace notification invocations in mod views * feat: add 'info' type to showNotification method * refactor: replace notification invocations in repair view * refactor: replace notification invocations in settings view * refactor: replace notification invocations in developer view * feat: showNotification method now returns a NotificationHandle * feat: showNotification has a duration argument * refactor: replace notification invocations in pull requests module * refactor: replace notification invocation in repair view * refactor: replace notification invocations in UI store * refactor: remove unused import from play view * refactor: use showErrorNotification method to wrap up error display * fix: add missing showErrorNotification imports * style: format code * style: format ThunderstoreModCard.vue * style: format pull_requests.ts * style: format SettingsView.vue * style: format RepairView.vue * style: format DeveloperView.vue * refactor: remove useless import * refactor: add missing showErrorNotification invocation * feat: showErrorNotification has an optional title argument * style: format LocalModsView.vue
Diffstat (limited to 'src-vue/src/components/ThunderstoreModCard.vue')
-rw-r--r--src-vue/src/components/ThunderstoreModCard.vue34
1 files changed, 7 insertions, 27 deletions
diff --git a/src-vue/src/components/ThunderstoreModCard.vue b/src-vue/src/components/ThunderstoreModCard.vue
index b81ed03c..fec95f14 100644
--- a/src-vue/src/components/ThunderstoreModCard.vue
+++ b/src-vue/src/components/ThunderstoreModCard.vue
@@ -72,9 +72,9 @@ import {invoke, shell} from "@tauri-apps/api";
import {ThunderstoreModStatus} from "../utils/thunderstore/ThunderstoreModStatus";
import {NorthstarMod} from "../../../src-tauri/bindings/NorthstarMod";
import {GameInstall} from "../utils/GameInstall";
-import {ElNotification} from "element-plus";
import { NorthstarState } from "../utils/NorthstarState";
import { ElMessageBox } from "element-plus";
+import { showErrorNotification, showNotification } from "../utils/ui";
export default defineComponent({
name: "ThunderstoreModCard",
@@ -214,22 +214,12 @@ export default defineComponent({
install_type: this.$store.state.install_type
} as GameInstall;
- await invoke("delete_thunderstore_mod", { gameInstall: game_install, thunderstoreModString: this.latestVersion.full_name })
+ await invoke<string>("delete_thunderstore_mod", { gameInstall: game_install, thunderstoreModString: this.latestVersion.full_name })
.then((message) => {
- ElNotification({
- title: this.$t('mods.card.remove_success', {modName: mod.name}),
- message: message as string,
- type: 'success',
- position: 'bottom-right'
- });
+ showNotification(this.$t('mods.card.remove_success', {modName: mod.name}), message);
})
.catch((error) => {
- ElNotification({
- title: this.$t('generic.error'),
- message: error,
- type: 'error',
- position: 'bottom-right'
- });
+ showErrorNotification(error);
})
.finally(() => {
this.$store.commit('loadInstalledMods');
@@ -253,21 +243,11 @@ export default defineComponent({
this.isBeingInstalled = true;
}
- await invoke("install_mod_caller", { gameInstall: game_install, thunderstoreModString: this.latestVersion.full_name }).then((message) => {
- ElNotification({
- title: this.$t('mods.card.install_success', {modName: mod.name}),
- message: message as string,
- type: 'success',
- position: 'bottom-right'
- });
+ await invoke<string>("install_mod_caller", { gameInstall: game_install, thunderstoreModString: this.latestVersion.full_name }).then((message) => {
+ showNotification(this.$t('mods.card.install_success', {modName: mod.name}), message);
})
.catch((error) => {
- ElNotification({
- title: this.$t('generic.error'),
- message: error,
- type: 'error',
- position: 'bottom-right'
- });
+ showErrorNotification(error);
})
.finally(() => {
this.isBeingInstalled = false;