From 1e2e90f9e73eaeb5d79b2a1ad57478391005acd3 Mon Sep 17 00:00:00 2001 From: CrescentLeaf Date: Sat, 27 Dec 2025 00:49:16 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E8=B7=AF=E7=94=B1=E5=8A=A8?= =?UTF-8?q?=E7=94=BB=E8=AF=95=E5=9B=BE=E4=BF=9D=E7=95=99=E8=A1=8C=E4=B8=BA?= =?UTF-8?q?,=20=E6=9D=82=E7=89=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/data.ts | 1 + client/ui/chat-fragment/LazyChatFragment.tsx | 11 +---------- client/ui/routers/ChatFragmentDialog.tsx | 2 +- client/ui/routers/UserOrChatInfoDialog.tsx | 2 -- client/ui/routers/useRouterDialogRef.ts | 4 ++++ client/utils/isMobileUI.ts | 6 +++--- 6 files changed, 10 insertions(+), 16 deletions(-) diff --git a/client/data.ts b/client/data.ts index 6568b09..4fb95cd 100644 --- a/client/data.ts +++ b/client/data.ts @@ -42,6 +42,7 @@ type IData = { apply(): void access_token?: string device_id: string + override_use_mobile_ui?: boolean } declare global { diff --git a/client/ui/chat-fragment/LazyChatFragment.tsx b/client/ui/chat-fragment/LazyChatFragment.tsx index 6c2d021..0cf64a9 100644 --- a/client/ui/chat-fragment/LazyChatFragment.tsx +++ b/client/ui/chat-fragment/LazyChatFragment.tsx @@ -3,19 +3,10 @@ import { Await } from "react-router" import getClient from "../../getClient" import ChatFragment from "./ChatFragment" import * as React from 'react' -import showSnackbar from "../../utils/showSnackbar" import EffectOnly from "../EffectOnly" export default function LazyChatFragment({ chatId, openedWithRouter }: { chatId: string, openedWithRouter: boolean }) { - return { - const s = showSnackbar({ - message: '请稍后...', - autoCloseDelay: 0, - }) - return () => { - s.open = false - } - }} deps={[]} />}> + return {}} deps={[]} />}> Chat.getByIdOrThrow(getClient(), chatId), [chatId])} children={(chatInfo: Chat) => } /> diff --git a/client/ui/routers/ChatFragmentDialog.tsx b/client/ui/routers/ChatFragmentDialog.tsx index e5a58cd..9cd2a1a 100644 --- a/client/ui/routers/ChatFragmentDialog.tsx +++ b/client/ui/routers/ChatFragmentDialog.tsx @@ -22,7 +22,7 @@ export default function ChatFragmentDialog() { const body = shadow.querySelector(".body") as HTMLElement body.style.height = '100%' body.style.display = 'flex' - }, []) + }) return (<> diff --git a/client/ui/routers/UserOrChatInfoDialog.tsx b/client/ui/routers/UserOrChatInfoDialog.tsx index c206127..00e2e94 100644 --- a/client/ui/routers/UserOrChatInfoDialog.tsx +++ b/client/ui/routers/UserOrChatInfoDialog.tsx @@ -23,8 +23,6 @@ export default function UserOrChatInfoDialog() { (context: Shared) => context.setCurrentSelectedChatId ) - console.log(setCurrentSelectedChatId, favouriteChats) - const nav = useNavigate() const dialogRef = useRouterDialogRef() diff --git a/client/ui/routers/useRouterDialogRef.ts b/client/ui/routers/useRouterDialogRef.ts index b246d2e..2d61cd3 100644 --- a/client/ui/routers/useRouterDialogRef.ts +++ b/client/ui/routers/useRouterDialogRef.ts @@ -7,8 +7,12 @@ import RouterDialogsContext from './RouterDialogsContext' export default function useRouterDialogRef() { const dialogRef = React.useRef() + const nav = useNavigate() useAsyncEffect(async () => { + dialogRef.current!.addEventListener('closed', async () => { + nav(-1) + }) await sleep(10) dialogRef.current!.open = true }, []) diff --git a/client/utils/isMobileUI.ts b/client/utils/isMobileUI.ts index 6aa89b7..05fc130 100644 --- a/client/utils/isMobileUI.ts +++ b/client/utils/isMobileUI.ts @@ -1,5 +1,5 @@ +import data from "../data" + export default function isMobileUI() { - const mobile = new URL(location.href).searchParams.get('mobile') - if (mobile) return mobile == 'true' - return /Mobi|Android|iPhone/i.test(navigator.userAgent) + return data.override_use_mobile_ui || /Mobi|Android|iPhone/i.test(navigator.userAgent) } \ No newline at end of file