|
@@ -1,10 +1,16 @@
|
|
-import React, {useState, useEffect, useRef} from 'react'
|
|
|
|
|
|
+import React, {useState, useEffect, useContext} from 'react'
|
|
|
|
+import { useTheme } from '@mui/material/styles';
|
|
|
|
+import useMediaQuery from '@mui/material/useMediaQuery';
|
|
import IconButton from '@mui/material/IconButton';
|
|
import IconButton from '@mui/material/IconButton';
|
|
import ArrowBackIcon from '@mui/icons-material/ArrowBack';
|
|
import ArrowBackIcon from '@mui/icons-material/ArrowBack';
|
|
import MoreVertIcon from '@mui/icons-material/MoreVert';
|
|
import MoreVertIcon from '@mui/icons-material/MoreVert';
|
|
import Menu from '@mui/material/Menu';
|
|
import Menu from '@mui/material/Menu';
|
|
import MenuItem from '@mui/material/MenuItem';
|
|
import MenuItem from '@mui/material/MenuItem';
|
|
|
|
|
|
|
|
+import {Link} from 'react-router-dom'
|
|
|
|
+
|
|
|
|
+import { AdaptiveContext } from '../App'
|
|
|
|
+
|
|
import { ChatAvatar, CChatModal } from "../components"
|
|
import { ChatAvatar, CChatModal } from "../components"
|
|
|
|
|
|
import { printEnding } from "../helpers"
|
|
import { printEnding } from "../helpers"
|
|
@@ -21,31 +27,34 @@ const chatMngBody = {
|
|
const blockMobile = {
|
|
const blockMobile = {
|
|
flexShrink: 0,
|
|
flexShrink: 0,
|
|
flexGrow: 0,
|
|
flexGrow: 0,
|
|
- flexBasis: "60px",
|
|
|
|
|
|
+ flexBasis: "50px",
|
|
display: "flex",
|
|
display: "flex",
|
|
justifyContent: "flex-start",
|
|
justifyContent: "flex-start",
|
|
aligneItems: "center",
|
|
aligneItems: "center",
|
|
- display: "none"
|
|
|
|
}
|
|
}
|
|
const blockLeft = {
|
|
const blockLeft = {
|
|
- flexShrink: 1,
|
|
|
|
flexGrow: 1,
|
|
flexGrow: 1,
|
|
|
|
+ width: "calc(100% - 100px)",
|
|
display: "flex",
|
|
display: "flex",
|
|
justifyContent: "flex-start",
|
|
justifyContent: "flex-start",
|
|
aligneItems: "center",
|
|
aligneItems: "center",
|
|
cursor: "pointer"
|
|
cursor: "pointer"
|
|
}
|
|
}
|
|
const blockAv = {
|
|
const blockAv = {
|
|
|
|
+ flexShrink: 0,
|
|
|
|
+ flexGrow: 0,
|
|
|
|
+ flexBasis: "40px",
|
|
margin: "auto 0"
|
|
margin: "auto 0"
|
|
}
|
|
}
|
|
const blockInfo = {
|
|
const blockInfo = {
|
|
display: "flex",
|
|
display: "flex",
|
|
flexDirection: "column",
|
|
flexDirection: "column",
|
|
justifyContent: "space-between",
|
|
justifyContent: "space-between",
|
|
|
|
+ overflow: "hidden",
|
|
whiteSpace: "nowrap",
|
|
whiteSpace: "nowrap",
|
|
- textOverFlow: "ellipsis",
|
|
|
|
|
|
+ textOverflow: "ellipsis",
|
|
marginLeft: "15px",
|
|
marginLeft: "15px",
|
|
- userSelect: "none"
|
|
|
|
|
|
+ userSelect: "none",
|
|
}
|
|
}
|
|
const blockName = {
|
|
const blockName = {
|
|
fontSize: "16px",
|
|
fontSize: "16px",
|
|
@@ -58,7 +67,7 @@ const chatMngBody = {
|
|
const blockRight = {
|
|
const blockRight = {
|
|
flexShrink: 0,
|
|
flexShrink: 0,
|
|
flexGrow: 0,
|
|
flexGrow: 0,
|
|
- flexBasis: "10%",
|
|
|
|
|
|
+ flexBasis: "50px",
|
|
display: "flex",
|
|
display: "flex",
|
|
justifyContent: "flex-end",
|
|
justifyContent: "flex-end",
|
|
aligneItems: "center"
|
|
aligneItems: "center"
|
|
@@ -91,8 +100,6 @@ const chatMinInfo = ({ chat, OPEN }) => {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
const ChatMenu = ({ chatId, onLeave }) => {
|
|
const ChatMenu = ({ chatId, onLeave }) => {
|
|
const [anchorEl, setAnchorEl] = useState(null)
|
|
const [anchorEl, setAnchorEl] = useState(null)
|
|
const open = !!anchorEl
|
|
const open = !!anchorEl
|
|
@@ -138,19 +145,33 @@ const CChatMenu = connect(null, {onLeave: removeUserChat})(ChatMenu)
|
|
const ChatMngHeader = ({ chats, chatId }) => {
|
|
const ChatMngHeader = ({ chats, chatId }) => {
|
|
|
|
|
|
const chat = chats[chatId]
|
|
const chat = chats[chatId]
|
|
- // console.log(chat)
|
|
|
|
|
|
+
|
|
|
|
+ const theme = useTheme()
|
|
|
|
+ const matches = useMediaQuery(theme.breakpoints.up('sm'))
|
|
|
|
+
|
|
|
|
+ const contextObj = useContext(AdaptiveContext)
|
|
return (
|
|
return (
|
|
<div style={chatMngBody}>
|
|
<div style={chatMngBody}>
|
|
|
|
|
|
- <div style={blockMobile}>
|
|
|
|
- <IconButton style={{ color: '#fff' }} >
|
|
|
|
- <ArrowBackIcon />
|
|
|
|
- </IconButton>
|
|
|
|
- </div>
|
|
|
|
-
|
|
|
|
|
|
+ { matches ||
|
|
|
|
+ <div style={ blockMobile } >
|
|
|
|
+ <Link
|
|
|
|
+ style={{ textDecoration: 'none' }}
|
|
|
|
+ to={`/main`}
|
|
|
|
+ onClick={() => {
|
|
|
|
+ contextObj.setAside(true)
|
|
|
|
+ }}
|
|
|
|
+ >
|
|
|
|
+ <IconButton
|
|
|
|
+ style={{ color: '#fff' }}
|
|
|
|
+ >
|
|
|
|
+ <ArrowBackIcon />
|
|
|
|
+ </IconButton>
|
|
|
|
+ </Link>
|
|
|
|
+ </div>
|
|
|
|
+ }
|
|
|
|
|
|
- <CChatModal key={chatId} create={false} chat={chat} render={chatMinInfo} />
|
|
|
|
-
|
|
|
|
|
|
+ <CChatModal key={chatId} create={false} chat={chat} render={chatMinInfo} />
|
|
|
|
|
|
<div style={blockRight}>
|
|
<div style={blockRight}>
|
|
<CChatMenu chatId={chatId} />
|
|
<CChatMenu chatId={chatId} />
|