|
@@ -10,16 +10,6 @@ import {Link} from 'react-router-dom'
|
|
import { FloatBtn, ChatAvatar } from "../components"
|
|
import { FloatBtn, ChatAvatar } from "../components"
|
|
import { connect } from 'react-redux'
|
|
import { connect } from 'react-redux'
|
|
|
|
|
|
-const selectedChat = {
|
|
|
|
- color: "#fff",
|
|
|
|
- backgroundColor: "#1976d2dd"
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-const notSelectedChat = {
|
|
|
|
- color: "#1976d2",
|
|
|
|
- backgroundColor: "#fff"
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
|
|
|
|
const Chat = ({ chat, currChat }) => {
|
|
const Chat = ({ chat, currChat }) => {
|
|
|
|
|
|
@@ -29,7 +19,7 @@ const Chat = ({ chat, currChat }) => {
|
|
// const { text, owner: msgOwner, media, createdAt } = messages
|
|
// const { text, owner: msgOwner, media, createdAt } = messages
|
|
|
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
- setMsgText( chat.messages && chat.messages[0]?.text || 'нема')
|
|
|
|
|
|
+ setMsgText( chat.messages && chat.messages[0]?.text || '...')
|
|
}, [chat])
|
|
}, [chat])
|
|
|
|
|
|
return (
|
|
return (
|
|
@@ -37,30 +27,34 @@ const Chat = ({ chat, currChat }) => {
|
|
style={{ textDecoration: 'none' }}
|
|
style={{ textDecoration: 'none' }}
|
|
to={`/main/${chat._id}`}
|
|
to={`/main/${chat._id}`}
|
|
>
|
|
>
|
|
- <ListItem
|
|
|
|
- className="chatItem"
|
|
|
|
- style={ currChat ? selectedChat : notSelectedChat }
|
|
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+ <div
|
|
|
|
+ className={`chatItem ${currChat ? "selectedChat" : "notSelectedChat"} `}
|
|
>
|
|
>
|
|
- <ListItemAvatar>
|
|
|
|
|
|
+ <div className={"chatAvatar"}>
|
|
<ChatAvatar chat={chat} />
|
|
<ChatAvatar chat={chat} />
|
|
- </ListItemAvatar>
|
|
|
|
- <ListItemText
|
|
|
|
- primary={chat.title}
|
|
|
|
- secondary={msgText} />
|
|
|
|
- </ListItem>
|
|
|
|
-
|
|
|
|
- {/* <div
|
|
|
|
- style={ currChat ? selectedChat : notSelectedChat }
|
|
|
|
- >
|
|
|
|
- <strong>
|
|
|
|
- {chat.title}
|
|
|
|
- </strong>
|
|
|
|
- <div>
|
|
|
|
|
|
+ </div>
|
|
|
|
+
|
|
|
|
+ <div className={"chatBody"}>
|
|
|
|
+
|
|
|
|
+ <div className={"chatTitle"}>
|
|
|
|
+
|
|
|
|
+ <div className={"chatName"}>
|
|
|
|
+ {chat.title}
|
|
|
|
+ </div>
|
|
|
|
+
|
|
|
|
+ <div className={"chatStatus"}>
|
|
|
|
+
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+
|
|
|
|
+ <div className={"chatSubTitle"}>
|
|
{msgText}
|
|
{msgText}
|
|
- </div>
|
|
|
|
-
|
|
|
|
- </div> */}
|
|
|
|
|
|
+ </div>
|
|
|
|
+
|
|
|
|
+ </div>
|
|
|
|
+
|
|
|
|
+ </div>
|
|
</Link>
|
|
</Link>
|
|
)
|
|
)
|
|
}
|
|
}
|
|
@@ -68,7 +62,6 @@ const Chat = ({ chat, currChat }) => {
|
|
const ChatList = ({ chats=[], currChatId }) => {
|
|
const ChatList = ({ chats=[], currChatId }) => {
|
|
|
|
|
|
// const [chatsInput, setChats] = useState(chats)
|
|
// const [chatsInput, setChats] = useState(chats)
|
|
-
|
|
|
|
// useEffect(() => {
|
|
// useEffect(() => {
|
|
// setChats(chats)
|
|
// setChats(chats)
|
|
// }, [chats])
|
|
// }, [chats])
|
|
@@ -81,7 +74,6 @@ const ChatList = ({ chats=[], currChatId }) => {
|
|
<Box sx={{ position: 'fixed', top: '90%', left: '25%', zIndex: 10}} >
|
|
<Box sx={{ position: 'fixed', top: '90%', left: '25%', zIndex: 10}} >
|
|
<FloatBtn />
|
|
<FloatBtn />
|
|
</Box>
|
|
</Box>
|
|
-
|
|
|
|
{chats.map(chat =>
|
|
{chats.map(chat =>
|
|
<Chat key={chat._id} chat={chat} currChat={currChatId === chat._id} />
|
|
<Chat key={chat._id} chat={chat} currChat={currChatId === chat._id} />
|
|
)}
|
|
)}
|
|
@@ -95,3 +87,36 @@ const ChatList = ({ chats=[], currChatId }) => {
|
|
export const CChatList = connect( state => ({ chats: Object.values(state.chats).filter(el => !!el._id)}))(ChatList)
|
|
export const CChatList = connect( state => ({ chats: Object.values(state.chats).filter(el => !!el._id)}))(ChatList)
|
|
|
|
|
|
|
|
|
|
|
|
+{/* <div class="ListItem Chat chat-item-clickable private no-selection has-ripple" style="top: 0px;">
|
|
|
|
+ <div class="ListItem-button" role="button" tabindex="0">
|
|
|
|
+ <div class="status">
|
|
|
|
+ <div class="Avatar size-large color-bg-8 saved-messages">
|
|
|
|
+ <i class="icon-avatar-saved-messages"></i>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="info">
|
|
|
|
+ <div class="title">
|
|
|
|
+ <h3>Saved Messages</h3>
|
|
|
|
+ <div class="LastMessageMeta">
|
|
|
|
+ <div class="MessageOutgoingStatus">
|
|
|
|
+ <div class="Transition reveal">
|
|
|
|
+ <div class="Transition__slide--active">
|
|
|
|
+ <i class="icon-message-succeeded"></i>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ <span class="time">Mon</span>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="subtitle">
|
|
|
|
+ <p class="last-message" dir="ltr">https://dolgvol.github.io/ToDoListProd/</p>
|
|
|
|
+ <div class="Badge-transition open shown">
|
|
|
|
+ <div class="Badge pinned">
|
|
|
|
+ <i class="icon-pinned-chat"></i>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="ripple-container"></div>
|
|
|
|
+</div>
|
|
|
|
+</div> */}
|