Skip to content

Commit 80d906d

Browse files
committed
Add restart widgets feature and update translations
1 parent 5c8b6ed commit 80d906d

File tree

3 files changed

+29
-4
lines changed

3 files changed

+29
-4
lines changed

src/i18n/tray/en.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,9 @@
1212
"exit": "Exit",
1313
"suggestions": "Suggestions & Feedback",
1414
"infoCopied": "Info Copied",
15-
"downloadLinkCopied": "Download link copied to clipboard"
15+
"downloadLinkCopied": "Download link copied to clipboard",
16+
"restartWidgets": "Restart",
17+
"restartWidgetsConfirm": "Restart all widgets?",
18+
"yes": "Yes",
19+
"no": "No"
1620
}

src/i18n/tray/zh.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,9 @@
1212
"exit": "退出",
1313
"suggestions": "建议与反馈",
1414
"infoCopied": "已复制信息",
15-
"downloadLinkCopied": "已复制下载链接到剪贴板"
15+
"downloadLinkCopied": "已复制下载链接到剪贴板",
16+
"restartWidgets": "重启组件",
17+
"restartWidgetsConfirm": "是否重启所有组件?",
18+
"yes": "",
19+
"no": ""
1620
}

src/views/tray/TrayMenuView.vue

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script setup lang="ts">
22
import { useI18n } from 'vue-i18n'
3-
import { Logout, Plus, Refresh, Setting, ShareOne } from '@icon-park/vue-next'
4-
import { AppApi, BrowserWindowApi, NotificationApi } from '@widget-js/core'
3+
import { LoadingOne, Logout, Plus, Refresh, Setting, ShareOne } from '@icon-park/vue-next'
4+
import { AppApi, BrowserWindowApi, NotificationApi, WidgetApi } from '@widget-js/core'
55
import { ref } from 'vue'
66
import SocialLinks from '@/views/tray/SocialLinks.vue'
77
import { useAppRuntimeInfo } from '@/composition/useAppRuntimeInfo'
@@ -25,6 +25,9 @@ function copyAndReport() {
2525
NotificationApi.success(t('tray.infoCopied'))
2626
BrowserWindowApi.openUrl('https://support.qq.com/product/450189', { external: true })
2727
}
28+
function restartWidgets() {
29+
WidgetApi.restartWidgets()
30+
}
2831
</script>
2932

3033
<template>
@@ -67,6 +70,20 @@ function copyAndReport() {
6770
<ShareOne />
6871
{{ t('tray.shareApp') }}
6972
</div>
73+
<el-popconfirm
74+
width="200"
75+
:cancel-button-text="t('tray.no')"
76+
:confirm-button-text="t('tray.yes')"
77+
:title="t('tray.restartWidgetsConfirm')"
78+
@confirm="restartWidgets"
79+
>
80+
<template #reference>
81+
<div class="menu-item">
82+
<LoadingOne />
83+
{{ t('tray.restartWidgets') }}
84+
</div>
85+
</template>
86+
</el-popconfirm>
7087
<div class="menu-item" @click="AppApi.exit">
7188
<Logout />
7289
{{ t('tray.exit') }}

0 commit comments

Comments
 (0)