Skip to content

Commit e97b51a

Browse files
committed
feat(frontend): 恢复/创建结束再关闭警告信息
#122
1 parent eca81d4 commit e97b51a

File tree

4 files changed

+17
-13
lines changed

4 files changed

+17
-13
lines changed

locales/en_US.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,8 @@
224224
"delete_game_failed": "Failed to delete game",
225225
"open_backup_folder_failed": "Failed to open backup folder",
226226
"set_config_failed": "Failed to set config",
227-
"reset_settings_failed": "Failed to reset settings"
227+
"reset_settings_failed": "Failed to reset settings",
228+
"change_description_failed": "Failed to edit description"
228229
},
229230
"tray": {
230231
"no_game_selected": "No game selected",

locales/zh_SIMPLIFIED.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,8 @@
224224
"delete_game_failed": "删除游戏失败",
225225
"open_backup_folder_failed": "打开备份文件夹失败",
226226
"set_config_failed": "设置配置失败",
227-
"reset_settings_failed": "重置设置失败"
227+
"reset_settings_failed": "重置设置失败",
228+
"change_description_failed": "编辑描述失败"
228229
},
229230
"tray": {
230231
"no_game_selected": "未选择游戏",

src/utils/notifications.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,39 @@
11
import { ElNotification } from "element-plus";
22
import { $t } from "../i18n";
33

4-
function show_error(message: string,title=$t('misc.error')) {
4+
function show_error(message: string, title = $t('misc.error'), duration = 3000) {
55
return ElNotification({
66
title,
77
message,
88
type: "error",
9-
duration: 3000,
9+
duration: duration,
1010
});
1111
}
1212

13-
function show_warning(message: string,title=$t('misc.warning')) {
13+
function show_warning(message: string, title = $t('misc.warning'), duration = 3000) {
1414
return ElNotification({
1515
title,
1616
message,
1717
type: "warning",
18-
duration: 3000,
18+
duration: duration,
1919
});
2020
}
2121

22-
function show_success(message: string,title=$t('misc.success')) {
22+
function show_success(message: string,title=$t('misc.success'),duration=1000) {
2323
return ElNotification({
2424
title,
2525
message,
2626
type: "success",
27-
duration: 1000,
27+
duration: duration,
2828
});
2929
}
3030

31-
function show_info(message: string,title=$t('misc.info')) {
31+
function show_info(message: string,title=$t('misc.info'),duration=3000) {
3232
return ElNotification({
3333
title,
3434
message,
3535
type: "info",
36-
duration: 3000,
36+
duration: duration,
3737
});
3838
}
3939

src/views/GameManage.vue

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { invoke } from "@tauri-apps/api/tauri";
55
import { useConfig } from "../stores/ConfigFile";
66
import { BackupsInfo, Game } from "../schemas/saveTypes";
77
import { useRoute, useRouter } from "vue-router";
8-
import { show_error, show_info, show_success, show_warning } from "../utils/notifications";
8+
import { show_error, show_info, show_success } from "../utils/notifications";
99
import SaveLocationDrawer from "../components/SaveLocationDrawer.vue";
1010
import { $t } from "../i18n";
1111
@@ -72,7 +72,7 @@ function refresh_backups_info() {
7272
}
7373
7474
function send_save_to_background() {
75-
show_info($t('manage.wait_for_prompt_hint'));
75+
let info = show_info($t('manage.wait_for_prompt_hint'), undefined, 0);
7676
if (!backup_button_time_limit) {
7777
show_error($t('manage.save_too_fast_error'));
7878
return;
@@ -96,6 +96,7 @@ function send_save_to_background() {
9696
show_error($t('error.backup_failed'))
9797
}
9898
).finally(() => {
99+
info.close()
99100
backup_button_backup_limit = true
100101
refresh_backups_info();
101102
})
@@ -156,7 +157,7 @@ function del_save(date: string) {
156157
}
157158
158159
function apply_save(date: string) {
159-
show_warning($t('manage.wait_for_prompt_hint'));
160+
let info = show_info($t('manage.wait_for_prompt_hint'),undefined,0);
160161
161162
if (!apply_button_apply_limit) {
162163
show_error($t('manage.last_overwrite_unfinished_error'));
@@ -175,6 +176,7 @@ function apply_save(date: string) {
175176
console.log(e)
176177
show_error($t('error.apply_backup_failed'))
177178
}).finally(() => {
179+
info.close()
178180
apply_button_apply_limit = true;
179181
refresh_backups_info();
180182
})

0 commit comments

Comments
 (0)