feat: add navigation buttons for webview history in MinApp popup (#6342)

* feat: add navigation buttons for webview history in MinApp popup

- Implemented 'Go Back' and 'Go Forward' functionality in the MinApp popup.
- Added corresponding translations for English, Japanese, Russian, and Chinese locales.
- Included icons for navigation buttons to enhance user experience.

* fix: update Russian and Traditional Chinese translations for UI elements

- Revised translations for "rightclick_copyurl", "close", and "minimize" to improve clarity and consistency in the Russian and Traditional Chinese locales.
- Ensured that the translations align better with user expectations and common usage.

* fix: update Russian translations for MinApp popup UI elements

- Revised translations for "close" and "minimize" to specify their context within the MinApp, enhancing clarity for users.
- Ensured consistency with existing translations and improved user understanding of the interface.

---------

Co-authored-by: beyondkmp <beyondkmkp@gmail.com>
This commit is contained in:
beyondkmp 2025-05-23 15:29:13 +08:00 committed by GitHub
parent 7a8870f070
commit 6e717781a9
6 changed files with 38 additions and 0 deletions

View File

@ -1,4 +1,6 @@
import {
ArrowLeftOutlined,
ArrowRightOutlined,
CloseOutlined,
CodeOutlined,
CopyOutlined,
@ -241,6 +243,22 @@ const MinappPopupContainer: React.FC = () => {
dispatch(setMinappsOpenLinkExternal(!minappsOpenLinkExternal))
}
/** navigate back in webview history */
const handleGoBack = (appid: string) => {
const webview = webviewRefs.current.get(appid)
if (webview && webview.canGoBack()) {
webview.goBack()
}
}
/** navigate forward in webview history */
const handleGoForward = (appid: string) => {
const webview = webviewRefs.current.get(appid)
if (webview && webview.canGoForward()) {
webview.goForward()
}
}
/** Title bar of the popup */
const Title = ({ appInfo, url }: { appInfo: AppInfo | null; url: string | null }) => {
if (!appInfo) return null
@ -286,6 +304,16 @@ const MinappPopupContainer: React.FC = () => {
)}
<Spacer />
<ButtonsGroup className={isWindows || isLinux ? 'windows' : ''}>
<Tooltip title={t('minapp.popup.goBack')} mouseEnterDelay={0.8} placement="bottom">
<Button onClick={() => handleGoBack(appInfo.id)}>
<ArrowLeftOutlined />
</Button>
</Tooltip>
<Tooltip title={t('minapp.popup.goForward')} mouseEnterDelay={0.8} placement="bottom">
<Button onClick={() => handleGoForward(appInfo.id)}>
<ArrowRightOutlined />
</Button>
</Tooltip>
<Tooltip title={t('minapp.popup.refresh')} mouseEnterDelay={0.8} placement="bottom">
<Button onClick={() => handleReload(appInfo.id)}>
<ReloadOutlined />

View File

@ -681,6 +681,8 @@
"minapp": {
"popup": {
"refresh": "Refresh",
"goBack": "Go Back",
"goForward": "Go Forward",
"close": "Close MinApp",
"minimize": "Minimize MinApp",
"devtools": "Developer Tools",

View File

@ -682,6 +682,8 @@
"minapp": {
"popup": {
"refresh": "更新",
"goBack": "戻る",
"goForward": "進む",
"close": "ミニアプリを閉じる",
"minimize": "ミニアプリを最小化",
"devtools": "開発者ツール",

View File

@ -683,6 +683,8 @@
"refresh": "Обновить",
"close": "Закрыть встроенное приложение",
"minimize": "Свернуть встроенное приложение",
"goBack": "Назад",
"goForward": "Вперед",
"devtools": "Инструменты разработчика",
"openExternal": "Открыть в браузере",
"rightclick_copyurl": "ПКМ → Копировать URL",

View File

@ -681,6 +681,8 @@
"minapp": {
"popup": {
"refresh": "刷新",
"goBack": "后退",
"goForward": "前进",
"close": "关闭小程序",
"minimize": "最小化小程序",
"devtools": "开发者工具",

View File

@ -682,6 +682,8 @@
"minapp": {
"popup": {
"refresh": "重新整理",
"goBack": "上一頁",
"goForward": "下一頁",
"close": "關閉小工具",
"minimize": "最小化小工具",
"devtools": "開發者工具",