移除路由动画试图保留行为, 杂物
This commit is contained in:
@@ -42,6 +42,7 @@ type IData = {
|
|||||||
apply(): void
|
apply(): void
|
||||||
access_token?: string
|
access_token?: string
|
||||||
device_id: string
|
device_id: string
|
||||||
|
override_use_mobile_ui?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
|
|||||||
@@ -3,19 +3,10 @@ import { Await } from "react-router"
|
|||||||
import getClient from "../../getClient"
|
import getClient from "../../getClient"
|
||||||
import ChatFragment from "./ChatFragment"
|
import ChatFragment from "./ChatFragment"
|
||||||
import * as React from 'react'
|
import * as React from 'react'
|
||||||
import showSnackbar from "../../utils/showSnackbar"
|
|
||||||
import EffectOnly from "../EffectOnly"
|
import EffectOnly from "../EffectOnly"
|
||||||
|
|
||||||
export default function LazyChatFragment({ chatId, openedWithRouter }: { chatId: string, openedWithRouter: boolean }) {
|
export default function LazyChatFragment({ chatId, openedWithRouter }: { chatId: string, openedWithRouter: boolean }) {
|
||||||
return <React.Suspense fallback={<EffectOnly effect={() => {
|
return <React.Suspense fallback={<EffectOnly effect={() => {}} deps={[]} />}>
|
||||||
const s = showSnackbar({
|
|
||||||
message: '请稍后...',
|
|
||||||
autoCloseDelay: 0,
|
|
||||||
})
|
|
||||||
return () => {
|
|
||||||
s.open = false
|
|
||||||
}
|
|
||||||
}} deps={[]} />}>
|
|
||||||
<Await
|
<Await
|
||||||
resolve={React.useMemo(() => Chat.getByIdOrThrow(getClient(), chatId), [chatId])}
|
resolve={React.useMemo(() => Chat.getByIdOrThrow(getClient(), chatId), [chatId])}
|
||||||
children={(chatInfo: Chat) => <ChatFragment chatInfo={chatInfo} openedWithRouter={openedWithRouter} />} />
|
children={(chatInfo: Chat) => <ChatFragment chatInfo={chatInfo} openedWithRouter={openedWithRouter} />} />
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ export default function ChatFragmentDialog() {
|
|||||||
const body = shadow.querySelector(".body") as HTMLElement
|
const body = shadow.querySelector(".body") as HTMLElement
|
||||||
body.style.height = '100%'
|
body.style.height = '100%'
|
||||||
body.style.display = 'flex'
|
body.style.display = 'flex'
|
||||||
}, [])
|
})
|
||||||
|
|
||||||
return (<>
|
return (<>
|
||||||
<mdui-dialog fullscreen ref={dialogRef}>
|
<mdui-dialog fullscreen ref={dialogRef}>
|
||||||
|
|||||||
@@ -23,8 +23,6 @@ export default function UserOrChatInfoDialog() {
|
|||||||
(context: Shared) => context.setCurrentSelectedChatId
|
(context: Shared) => context.setCurrentSelectedChatId
|
||||||
)
|
)
|
||||||
|
|
||||||
console.log(setCurrentSelectedChatId, favouriteChats)
|
|
||||||
|
|
||||||
const nav = useNavigate()
|
const nav = useNavigate()
|
||||||
|
|
||||||
const dialogRef = useRouterDialogRef()
|
const dialogRef = useRouterDialogRef()
|
||||||
|
|||||||
@@ -7,8 +7,12 @@ import RouterDialogsContext from './RouterDialogsContext'
|
|||||||
|
|
||||||
export default function useRouterDialogRef() {
|
export default function useRouterDialogRef() {
|
||||||
const dialogRef = React.useRef<Dialog>()
|
const dialogRef = React.useRef<Dialog>()
|
||||||
|
const nav = useNavigate()
|
||||||
|
|
||||||
useAsyncEffect(async () => {
|
useAsyncEffect(async () => {
|
||||||
|
dialogRef.current!.addEventListener('closed', async () => {
|
||||||
|
nav(-1)
|
||||||
|
})
|
||||||
await sleep(10)
|
await sleep(10)
|
||||||
dialogRef.current!.open = true
|
dialogRef.current!.open = true
|
||||||
}, [])
|
}, [])
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
|
import data from "../data"
|
||||||
|
|
||||||
export default function isMobileUI() {
|
export default function isMobileUI() {
|
||||||
const mobile = new URL(location.href).searchParams.get('mobile')
|
return data.override_use_mobile_ui || /Mobi|Android|iPhone/i.test(navigator.userAgent)
|
||||||
if (mobile) return mobile == 'true'
|
|
||||||
return /Mobi|Android|iPhone/i.test(navigator.userAgent)
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user