|
@@ -9,10 +9,8 @@ import {Link} from 'react-router-dom'
|
|
|
|
|
|
import { FloatBtn, ChatAvatar } from "../components"
|
|
|
import { connect } from 'react-redux'
|
|
|
-import {
|
|
|
- actionFullChatList
|
|
|
-} from "../actions"
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
const Chat = ({chat}) => {
|
|
|
|
|
|
const {_id, title, owner, members} = chat
|
|
@@ -29,27 +27,20 @@ const Chat = ({chat}) => {
|
|
|
)
|
|
|
}
|
|
|
|
|
|
-const ChatList = ({chats, getData}) => {
|
|
|
- // const [chatBlock, setChatBlock] = useState(0)
|
|
|
-
|
|
|
- // useEffect(() => {
|
|
|
- // const userId = auth.payload?.sub?.id
|
|
|
- // if (userId) {
|
|
|
- // getData(userId, chatBlock, 20)
|
|
|
- // }
|
|
|
- // },[])
|
|
|
+const ChatList = ({ chats=[] }) => {
|
|
|
|
|
|
return (
|
|
|
- <List sx={{ width: '100%', bgcolor: 'background.paper', position: 'relative', zIndex: 2 }}>
|
|
|
- <Box sx={{ position: 'fixed', top: '90%', left: '25%', zIndex: 10}} >
|
|
|
- <FloatBtn />
|
|
|
- </Box>
|
|
|
- {chats.map(chat => <Chat key={chat._id} chat={chat}/>)}
|
|
|
-
|
|
|
- </List>
|
|
|
+ <List
|
|
|
+ sx={{ width: '100%', bgcolor: 'background.paper', position: 'relative', zIndex: 2, }}
|
|
|
+ >
|
|
|
+ <Box sx={{ position: 'fixed', top: '90%', left: '25%', zIndex: 10}} >
|
|
|
+ <FloatBtn />
|
|
|
+ </Box>
|
|
|
+ {chats.map(chat => <Chat key={chat._id} chat={chat}/>)}
|
|
|
+
|
|
|
+ </List>
|
|
|
)
|
|
|
}
|
|
|
-export const CChatList = connect( state => ({ chats: Object.values(state.chats) || []}),
|
|
|
- {getData: actionFullChatList})(ChatList)
|
|
|
+export const CChatList = connect( state => ({ chats: Object.values(state.chats) }))(ChatList)
|
|
|
|
|
|
|