|
@@ -7,11 +7,12 @@ import ListItemText from '@mui/material/ListItemText';
|
|
import ListItemAvatar from '@mui/material/ListItemAvatar';
|
|
import ListItemAvatar from '@mui/material/ListItemAvatar';
|
|
import Avatar from '@mui/material/Avatar';
|
|
import Avatar from '@mui/material/Avatar';
|
|
import Typography from '@mui/material/Typography';
|
|
import Typography from '@mui/material/Typography';
|
|
|
|
+import Divider from '@mui/material/Divider';
|
|
|
|
+import { CopyToClipboard } from 'react-copy-to-clipboard';
|
|
import Search from './Search'
|
|
import Search from './Search'
|
|
import AlertInfo from "../../../../../reusableComponents/AlertInfo";
|
|
import AlertInfo from "../../../../../reusableComponents/AlertInfo";
|
|
import { getMessages } from '../../../../../../redux/messages/selector'
|
|
import { getMessages } from '../../../../../../redux/messages/selector'
|
|
-import { timeStamp,timeStampFilter,firstLetter,slicedWord } from '../../../../../../helpers'
|
|
|
|
-
|
|
|
|
|
|
+import { timeStamp,timeStampFilter,firstLetter,slicedWord,copied } from '../../../../../../helpers'
|
|
|
|
|
|
const useStyles = makeStyles({
|
|
const useStyles = makeStyles({
|
|
containerAbsolute: {
|
|
containerAbsolute: {
|
|
@@ -26,9 +27,8 @@ const useStyles = makeStyles({
|
|
backgroundColor: '#ffffff'
|
|
backgroundColor: '#ffffff'
|
|
},
|
|
},
|
|
listItem: {
|
|
listItem: {
|
|
- borderBottom: 'solid 1px #e6e6e6',
|
|
|
|
'&:hover': {
|
|
'&:hover': {
|
|
- backgroundColor: '#e6e6e6',
|
|
|
|
|
|
+ backgroundColor: '#f0f0f0',
|
|
}
|
|
}
|
|
},
|
|
},
|
|
})
|
|
})
|
|
@@ -56,31 +56,35 @@ return (
|
|
<div className={classes.containerAbsolute}>
|
|
<div className={classes.containerAbsolute}>
|
|
{messages.length > 0 ? arr.length > 0 ?
|
|
{messages.length > 0 ? arr.length > 0 ?
|
|
<List sx={{ width: '100%' }}>
|
|
<List sx={{ width: '100%' }}>
|
|
- {arr.map(({ name, lastName, avatarUrl, color, message, createdAt }) =>
|
|
|
|
- <ListItem alignItems="flex-start" className={classes.listItem} key={createdAt}
|
|
|
|
- onClick={() => console.log('clicked message in rightList')}>
|
|
|
|
- <ListItemAvatar>
|
|
|
|
- <Avatar alt={name} src={avatarUrl?`http://localhost:3000/${avatarUrl}`:undefined}
|
|
|
|
- sx={{ background: color, width: 44, height: 44, marginRight:2 }}>
|
|
|
|
- {!avatarUrl&&`${firstLetter(name)}${firstLetter(lastName)}`}
|
|
|
|
|
|
+ {arr.map(({ name, lastName, avatarUrl, color, message, createdAt }) =>
|
|
|
|
+ <div key={createdAt}>
|
|
|
|
+ <CopyToClipboard onCopy={() => copied()} text={message}>
|
|
|
|
+ <ListItem alignItems="flex-start" className={classes.listItem}>
|
|
|
|
+ <ListItemAvatar>
|
|
|
|
+ <Avatar alt={name} src={avatarUrl?`http://localhost:3000/${avatarUrl}`:undefined}
|
|
|
|
+ sx={{ background: color, width: 44, height: 44, marginRight:2 }}>
|
|
|
|
+ {!avatarUrl&&`${firstLetter(name)}${firstLetter(lastName)}`}
|
|
</Avatar>
|
|
</Avatar>
|
|
- </ListItemAvatar>
|
|
|
|
- <ListItemText
|
|
|
|
- primary={`${firstLetter(name)}${slicedWord(name, 15, 1)}
|
|
|
|
- ${firstLetter(lastName)}${slicedWord(lastName, 15, 1)}`}
|
|
|
|
- secondary={<>
|
|
|
|
- <Typography
|
|
|
|
- sx={{ display: 'block',wordBreak:'break-word' }}
|
|
|
|
- component="span"
|
|
|
|
- variant="body2"
|
|
|
|
- color="text.primary"
|
|
|
|
- >
|
|
|
|
- {message}
|
|
|
|
- </Typography>
|
|
|
|
- {timeStamp(createdAt)}
|
|
|
|
- </>}
|
|
|
|
- />
|
|
|
|
- </ListItem>)}
|
|
|
|
|
|
+ </ListItemAvatar>
|
|
|
|
+ <ListItemText
|
|
|
|
+ primary={`${firstLetter(name)}${slicedWord(name, 15, 1)}
|
|
|
|
+ ${firstLetter(lastName)}${slicedWord(lastName, 15, 1)}`}
|
|
|
|
+ secondary={<>
|
|
|
|
+ <Typography
|
|
|
|
+ sx={{ display: 'block',wordBreak:'break-word' }}
|
|
|
|
+ component="span"
|
|
|
|
+ variant="body2"
|
|
|
|
+ color="text.primary"
|
|
|
|
+ >
|
|
|
|
+ {message}
|
|
|
|
+ </Typography>
|
|
|
|
+ {timeStamp(createdAt)}
|
|
|
|
+ </>}
|
|
|
|
+ />
|
|
|
|
+ </ListItem>
|
|
|
|
+ </CopyToClipboard>
|
|
|
|
+ <Divider variant="inset"/>
|
|
|
|
+ </div>)}
|
|
</List> :
|
|
</List> :
|
|
<AlertInfo name={!date&&value ? `Can not find message by request: ${value}`:
|
|
<AlertInfo name={!date&&value ? `Can not find message by request: ${value}`:
|
|
`Can not find message by request: ${value} and DataPicker: ${timeStampFilter(date)}`} />:
|
|
`Can not find message by request: ${value} and DataPicker: ${timeStampFilter(date)}`} />:
|