改 state 为 reducer state, Context 共享数据修改, 完善资料卡对话框逻辑, 完善

This commit is contained in:
CrescentLeaf
2025-12-13 18:05:09 +08:00
parent dee8a24f0b
commit 3351d7dc4e
7 changed files with 183 additions and 29 deletions

View File

@@ -1,5 +1,6 @@
import { Chat, UserMySelf } from "lingchair-client-protocol"
import { createContext } from "use-context-selector"
import { SharedState } from "./MainSharedReducer"
type Shared = {
functions_lazy: React.MutableRefObject<{
@@ -7,17 +8,13 @@ type Shared = {
updateRecentChats: () => void
updateAllChats: () => void
}>
favouriteChats: Chat[]
setFavouriteChats: React.Dispatch<React.SetStateAction<Chat[]>>
state: SharedState
setShowLoginDialog: React.Dispatch<React.SetStateAction<boolean>>
setShowRegisterDialog: React.Dispatch<React.SetStateAction<boolean>>
setShowAddFavourtieChatDialog: React.Dispatch<React.SetStateAction<boolean>>
currentSelectedChatId: string
setCurrentSelectedChatId: React.Dispatch<React.SetStateAction<string>>
myProfileCache?: UserMySelf
}
const MainSharedContext = createContext({} as Shared)