From 29ea6f91426f20a0514c56f75d42ff49cf72fbe3 Mon Sep 17 00:00:00 2001 From: CrescentLeaf Date: Wed, 1 Oct 2025 00:02:20 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E8=BF=81=E7=A7=BB=E5=B7=A5=E5=85=B7?= =?UTF-8?q?=E6=96=B9=E6=B3=95=20isMobileUI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/index.ts | 3 ++- client/ui/isMobileUI.ts | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 client/ui/isMobileUI.ts diff --git a/client/index.ts b/client/index.ts index 3b712d7..22e230d 100644 --- a/client/index.ts +++ b/client/index.ts @@ -21,7 +21,8 @@ urlParams.get('debug') == 'true' && window.addEventListener('error', ({ message, import App from './ui/App.tsx' import AppMobile from './ui/AppMobile.tsx' -ReactDOM.createRoot(document.getElementById('app') as HTMLElement).render(React.createElement(urlParams.get('mobile') == 'true' ? AppMobile : App, null)) +import isMobileUI from "./ui/isMobileUI.ts" +ReactDOM.createRoot(document.getElementById('app') as HTMLElement).render(React.createElement(isMobileUI() ? AppMobile : App, null)) const onResize = () => { document.body.style.setProperty('--whitesilk-widget-message-maxwidth', breakpoint().down('md') ? "80%" : "70%") diff --git a/client/ui/isMobileUI.ts b/client/ui/isMobileUI.ts new file mode 100644 index 0000000..dc0bde4 --- /dev/null +++ b/client/ui/isMobileUI.ts @@ -0,0 +1,3 @@ +export default function isMobileUI() { + return new URL(location.href).searchParams.get('mobile') == 'true' +} \ No newline at end of file