彻底放弃客户端路由计划

This commit is contained in:
CrescentLeaf
2025-12-27 23:03:58 +08:00
parent 1e2e90f9e7
commit 12039612ca
19 changed files with 28 additions and 720 deletions

View File

@@ -9,8 +9,7 @@ import isMobileUI from "../../utils/isMobileUI.ts"
import { useContextSelector } from "use-context-selector"
import MainSharedContext, { Shared } from "../MainSharedContext.ts"
import ClientCache from "../../ClientCache.ts"
import gotoChatInfo from "../routers/gotoChatInfo.ts"
import { useNavigate } from "react-router"
import AppStateContext from "../app-state/AppStateContext.ts"
export default function AllChatsList({ ...props }: React.HTMLAttributes<HTMLElement>) {
const shared = useContextSelector(MainSharedContext, (context: Shared) => ({
@@ -22,7 +21,7 @@ export default function AllChatsList({ ...props }: React.HTMLAttributes<HTMLElem
const [searchText, setSearchText] = React.useState('')
const [allChatsList, setAllChatsList] = React.useState<Chat[]>([])
const nav = useNavigate()
const DialogState = React.useContext(AppStateContext)
useEventListener(searchRef, 'input', (e) => {
setSearchText((e.target as unknown as TextField).value)
@@ -76,7 +75,7 @@ export default function AllChatsList({ ...props }: React.HTMLAttributes<HTMLElem
active={isMobileUI() ? false : shared.state.currentSelectedChatId == v.getId()}
key={v.getId()}
onClick={() => {
gotoChatInfo(nav, v.getId())
DialogState.openChatInfo(v.getId())
}}
chat={v} />
)

View File

@@ -11,6 +11,7 @@ import isMobileUI from "../../utils/isMobileUI.ts"
import gotoChatInfo from "../routers/gotoChatInfo.ts"
import ClientCache from "../../ClientCache.ts"
import { useNavigate } from "react-router"
import AppStateContext from "../app-state/AppStateContext.ts"
export default function FavouriteChatsList({ ...props }: React.HTMLAttributes<HTMLElement>) {
const shared = useContextSelector(MainSharedContext, (context: Shared) => ({
@@ -24,7 +25,7 @@ export default function FavouriteChatsList({ ...props }: React.HTMLAttributes<HT
const [searchText, setSearchText] = React.useState('')
const [checkedList, setCheckedList] = React.useState<{ [key: string]: boolean }>({})
const nav = useNavigate()
const DialogState = React.useContext(AppStateContext)
useEventListener(searchRef, 'input', (e) => {
setSearchText((e.target as unknown as TextField).value)
@@ -74,7 +75,7 @@ export default function FavouriteChatsList({ ...props }: React.HTMLAttributes<HT
<mdui-list-item rounded style={{
marginTop: '13px',
width: '100%',
}} icon="person_add" onClick={() => nav('/add/favourite_chat')}></mdui-list-item>
}} icon="person_add" onClick={() => DialogState.openAddFavouriteChat()}></mdui-list-item>
<mdui-list-item rounded style={{
width: '100%',
}} icon="refresh" onClick={() => shared.functions_lazy.current.updateFavouriteChats()}></mdui-list-item>
@@ -161,7 +162,7 @@ export default function FavouriteChatsList({ ...props }: React.HTMLAttributes<HT
[v.getId()]: !checkedList[v.getId()],
})
else
gotoChatInfo(nav, v.getId())
DialogState.openChatInfo(v.getId())
}}
key={v.getId()}
chat={v} />