refactor: unify chat context type

This commit is contained in:
Tristan Yang
2023-05-15 13:26:55 +08:00
parent c6edf3e8b1
commit 110b0891ad
30 changed files with 79 additions and 51 deletions
@@ -12,8 +12,9 @@ import CustomList from './CustomList';
import CustomHeader from './CustomHeader';
import { useDispatch } from 'react-redux';
import { updateHistoryMark } from '../../../../app/slices/footprint';
import { ChatContext } from '../../../../types/common';
type Props = {
context: "user" | "channel",
context: ChatContext,
id: number
}
// const firstMsgIndex = 10000;
@@ -36,8 +37,8 @@ const VirtualMessageFeed = ({ context, id }: Props) => {
footprint
} = useAppSelector((store) => {
return {
historyMid: context == "user" ? store.footprint.historyUsers[id] : store.footprint.historyChannels[id],
mids: context == "user" ? store.userMessage.byId[id] : store.channelMessage[id],
historyMid: context == "dm" ? store.footprint.historyUsers[id] : store.footprint.historyChannels[id],
mids: context == "dm" ? store.userMessage.byId[id] : store.channelMessage[id],
selects: store.ui.selectMessages[`${context}_${id}`],
footprint: store.footprint,
loginUser: store.authData.user,