From 6e717781a92d847189731aea5b44994e08b4578e Mon Sep 17 00:00:00 2001 From: beyondkmp Date: Fri, 23 May 2025 15:29:13 +0800 Subject: [PATCH] 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 --- .../MinApp/MinappPopupContainer.tsx | 28 +++++++++++++++++++ src/renderer/src/i18n/locales/en-us.json | 2 ++ src/renderer/src/i18n/locales/ja-jp.json | 2 ++ src/renderer/src/i18n/locales/ru-ru.json | 2 ++ src/renderer/src/i18n/locales/zh-cn.json | 2 ++ src/renderer/src/i18n/locales/zh-tw.json | 2 ++ 6 files changed, 38 insertions(+) diff --git a/src/renderer/src/components/MinApp/MinappPopupContainer.tsx b/src/renderer/src/components/MinApp/MinappPopupContainer.tsx index a2dd31cfab..bd360c8a30 100644 --- a/src/renderer/src/components/MinApp/MinappPopupContainer.tsx +++ b/src/renderer/src/components/MinApp/MinappPopupContainer.tsx @@ -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 = () => { )} + + + + + +