From 759779a98d8cc76889b5342255effd53ec25e4dd Mon Sep 17 00:00:00 2001 From: Huang Xin Date: Thu, 17 Apr 2025 17:17:07 +0800 Subject: [PATCH] fix: links in about window is now clickable in apps (#902) --- .../src/components/AboutWindow.tsx | 16 ++++--------- apps/readest-app/src/components/Link.tsx | 23 +++++++++++++++++++ 2 files changed, 28 insertions(+), 11 deletions(-) create mode 100644 apps/readest-app/src/components/Link.tsx diff --git a/apps/readest-app/src/components/AboutWindow.tsx b/apps/readest-app/src/components/AboutWindow.tsx index b5a54b79..b2c748e0 100644 --- a/apps/readest-app/src/components/AboutWindow.tsx +++ b/apps/readest-app/src/components/AboutWindow.tsx @@ -6,6 +6,7 @@ import { useTranslation } from '@/hooks/useTranslation'; import { checkForAppUpdates } from '@/helpers/updater'; import { parseWebViewVersion } from '@/utils/ua'; import Dialog from './Dialog'; +import Link from './Link'; export const setAboutDialogVisible = (visible: boolean) => { const dialog = document.getElementById('about_window'); @@ -75,27 +76,20 @@ export const AboutWindow = () => {

This software is licensed under the{' '} - GNU Affero General Public License v3.0 - + . You are free to use, modify, and distribute this software under the terms of the AGPL v3 license. Please see the license for more details.

Source code is available at{' '} - + GitHub - + .

diff --git a/apps/readest-app/src/components/Link.tsx b/apps/readest-app/src/components/Link.tsx new file mode 100644 index 00000000..7b2d3020 --- /dev/null +++ b/apps/readest-app/src/components/Link.tsx @@ -0,0 +1,23 @@ +import { isTauriAppPlatform } from '@/services/environment'; +import { openUrl } from '@tauri-apps/plugin-opener'; + +interface LinkProps extends React.AnchorHTMLAttributes { + href: string; +} + +const Link: React.FC = ({ href, children, ...props }) => { + const handleClick = async (e: React.MouseEvent) => { + if (isTauriAppPlatform()) { + e.preventDefault(); + await openUrl(href); + } + }; + + return ( + + {children} + + ); +}; + +export default Link;