彻底放弃客户端路由计划
This commit is contained in:
@@ -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} />
|
||||
)
|
||||
|
||||
@@ -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} />
|
||||
|
||||
Reference in New Issue
Block a user