|
@@ -14,10 +14,15 @@ import Divider from '@mui/material/Divider';
|
|
import CheckBoxIcon from '@mui/icons-material/CheckBox';
|
|
import CheckBoxIcon from '@mui/icons-material/CheckBox';
|
|
import Checkbox from '@mui/material/Checkbox';
|
|
import Checkbox from '@mui/material/Checkbox';
|
|
import PushPinIcon from '@mui/icons-material/PushPin';
|
|
import PushPinIcon from '@mui/icons-material/PushPin';
|
|
|
|
+import ListItemText from '@mui/material/ListItemText';
|
|
|
|
+import ListItemIcon from '@mui/material/ListItemIcon';
|
|
|
|
+import Avatar from '@mui/material/Avatar';
|
|
|
|
+import ZoomOutIcon from '@mui/icons-material/ZoomOut';
|
|
|
|
+import ZoomInIcon from '@mui/icons-material/ZoomIn';
|
|
import CloseIcon from '@mui/icons-material/Close';
|
|
import CloseIcon from '@mui/icons-material/Close';
|
|
import { CopyToClipboard } from 'react-copy-to-clipboard';
|
|
import { CopyToClipboard } from 'react-copy-to-clipboard';
|
|
import { removeMessageById,updateMessageById,pinMessageById } from "../../../../../../api-data";
|
|
import { removeMessageById,updateMessageById,pinMessageById } from "../../../../../../api-data";
|
|
-import { timeStampMessage, timeStampEU,handleDownload,copied,emojisArr } from '../../../../../../helpers'
|
|
|
|
|
|
+import { timeStampMessage, timeStampEU,handleDownload,copied,emojisArr,firstLetter, slicedWord } from '../../../../../../helpers'
|
|
|
|
|
|
const StyledMenu = styled((props:any) => (
|
|
const StyledMenu = styled((props:any) => (
|
|
<Menu
|
|
<Menu
|
|
@@ -195,7 +200,7 @@ const useStyles = makeStyles({
|
|
top: 0,
|
|
top: 0,
|
|
left: 0,
|
|
left: 0,
|
|
width: '100vw',
|
|
width: '100vw',
|
|
- height: '100vh',
|
|
|
|
|
|
+ minHeight: '100vh',
|
|
zIndex: 100,
|
|
zIndex: 100,
|
|
backgroundColor: 'rgba(104, 105, 104, 0.6)',
|
|
backgroundColor: 'rgba(104, 105, 104, 0.6)',
|
|
overflowY: 'hidden',
|
|
overflowY: 'hidden',
|
|
@@ -205,17 +210,42 @@ const useStyles = makeStyles({
|
|
alignContent: 'center',
|
|
alignContent: 'center',
|
|
alignItems: 'center'
|
|
alignItems: 'center'
|
|
},
|
|
},
|
|
- wrapperOverlayImg: {
|
|
|
|
- width: '30%',
|
|
|
|
- maxHeight: '80%',
|
|
|
|
- position: 'relative',
|
|
|
|
|
|
+ topBar: {
|
|
|
|
+ position: 'fixed',
|
|
|
|
+ top: 0,
|
|
|
|
+ left: 0,
|
|
|
|
+ height: '7vh',
|
|
|
|
+ width: '100vw',
|
|
display: 'flex',
|
|
display: 'flex',
|
|
|
|
+ alignContent: 'center',
|
|
|
|
+ alignItems: 'center',
|
|
|
|
+ justifyContent: 'space-between',
|
|
|
|
+ backgroundColor: 'rgba(65, 65, 65, 0.9)',
|
|
|
|
+ zIndex: 10,
|
|
|
|
+ padding: '0px 20px'
|
|
},
|
|
},
|
|
- overlayDownloadIcon: {
|
|
|
|
- position: 'absolute',
|
|
|
|
- content: '',
|
|
|
|
- right: 0,
|
|
|
|
- top: -40,
|
|
|
|
|
|
+ wrapperCredentials: {
|
|
|
|
+ display: 'flex',
|
|
|
|
+ alignContent: 'center',
|
|
|
|
+ alignItems: 'center',
|
|
|
|
+ },
|
|
|
|
+ wrapperIcons: {
|
|
|
|
+ display: 'flex',
|
|
|
|
+ alignContent: 'center',
|
|
|
|
+ alignItems: 'center',
|
|
|
|
+ },
|
|
|
|
+ magnifying : {
|
|
|
|
+ marginLeft:5,
|
|
|
|
+ cursor: 'pointer',
|
|
|
|
+ color: '#e9e7e7',
|
|
|
|
+ padding: 0,
|
|
|
|
+ '&:hover': {
|
|
|
|
+ color: '#ffffff',
|
|
|
|
+ transform: 'scale(1.1)'
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ downloadIcon: {
|
|
|
|
+ marginLeft:5,
|
|
cursor: 'pointer',
|
|
cursor: 'pointer',
|
|
color: '#e9e7e7',
|
|
color: '#e9e7e7',
|
|
padding: 0,
|
|
padding: 0,
|
|
@@ -225,16 +255,25 @@ const useStyles = makeStyles({
|
|
color: '#b8b7b7',
|
|
color: '#b8b7b7',
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- overlayTime: {
|
|
|
|
- position: 'absolute',
|
|
|
|
- content: '',
|
|
|
|
- color: '#ffffff',
|
|
|
|
- top: -30,
|
|
|
|
- left: 0,
|
|
|
|
- borderRadius: 10,
|
|
|
|
- padding:'2px 6px 2px 6px',
|
|
|
|
- backgroundColor:'#707070'
|
|
|
|
|
|
+ iconCloseOverlay: {
|
|
|
|
+ marginLeft:5,
|
|
|
|
+ cursor: 'pointer',
|
|
|
|
+ color: '#e9e7e7',
|
|
|
|
+ padding: 0,
|
|
|
|
+ '&:hover': {
|
|
|
|
+ color: '#ffffff',
|
|
|
|
+ transform: 'rotate(180deg)',
|
|
|
|
+ transition: 'all 250ms ease-out ',
|
|
|
|
+ }
|
|
},
|
|
},
|
|
|
|
+ wrapperImage: {
|
|
|
|
+ display: 'flex',
|
|
|
|
+ overflow: 'auto',
|
|
|
|
+ maxWidth: '70%',
|
|
|
|
+ maxHeight:'80%',
|
|
|
|
+ height: 'auto',
|
|
|
|
+ borderRadius:5,
|
|
|
|
+ },
|
|
modalDelete: {
|
|
modalDelete: {
|
|
background: '#ffffff',
|
|
background: '#ffffff',
|
|
position: 'absolute',
|
|
position: 'absolute',
|
|
@@ -299,7 +338,7 @@ const useStyles = makeStyles({
|
|
transform: 'rotate(180deg)',
|
|
transform: 'rotate(180deg)',
|
|
transition: 'all 250ms ease-out ',
|
|
transition: 'all 250ms ease-out ',
|
|
}
|
|
}
|
|
- },
|
|
|
|
|
|
+ },
|
|
});
|
|
});
|
|
|
|
|
|
const label = { inputProps: { 'aria-label': 'Checkbox demo' } };
|
|
const label = { inputProps: { 'aria-label': 'Checkbox demo' } };
|
|
@@ -316,19 +355,32 @@ interface IMessagesLeftImage {
|
|
isSomeSelected: boolean,
|
|
isSomeSelected: boolean,
|
|
isSelected:(_id:string) => boolean,
|
|
isSelected:(_id:string) => boolean,
|
|
handleSelected: (_id:string) => void,
|
|
handleSelected: (_id:string) => void,
|
|
- _id:string
|
|
|
|
|
|
+ _id: string,
|
|
|
|
+ name: string,
|
|
|
|
+ lastName: string,
|
|
}
|
|
}
|
|
|
|
|
|
-const MessagesLeftImage = ({url,createdAt,color,fullType,caption,emoji,emojiCompanion,pinned,isSomeSelected,isSelected,handleSelected,_id}:IMessagesLeftImage) => {
|
|
|
|
|
|
+const MessagesLeftImage = ({url,createdAt,color,fullType,caption,emoji,emojiCompanion,pinned,isSomeSelected,isSelected,handleSelected,_id,name,lastName}:IMessagesLeftImage) => {
|
|
const classes = useStyles();
|
|
const classes = useStyles();
|
|
const [watch, setWatch] = useState<boolean>(false)
|
|
const [watch, setWatch] = useState<boolean>(false)
|
|
const [anchorEl, setAnchorEl] = useState<any>(null);
|
|
const [anchorEl, setAnchorEl] = useState<any>(null);
|
|
const [selected, setSelected] = useState<boolean>(false);
|
|
const [selected, setSelected] = useState<boolean>(false);
|
|
|
|
+ const [scale, setScale] = useState<number>(1)
|
|
const [modal,setModal] = useState<boolean>(false)
|
|
const [modal,setModal] = useState<boolean>(false)
|
|
const open = Boolean(anchorEl);
|
|
const open = Boolean(anchorEl);
|
|
const checked = isSelected(_id)
|
|
const checked = isSelected(_id)
|
|
|
|
+ const handleIncreaseScale = () => {
|
|
|
|
+ if(scale < 5) return setScale(scale+0.5)
|
|
|
|
+ }
|
|
|
|
+ const handleDecreaseScale = () => {
|
|
|
|
+ if(scale > 1) return setScale(scale-0.5)
|
|
|
|
+ }
|
|
const handleOpenWatch = () => !watch&&setWatch(true)
|
|
const handleOpenWatch = () => !watch&&setWatch(true)
|
|
- const handleCloseWatch = (e:any) => e.target.id === 'overlay'&&watch&&setWatch(false)
|
|
|
|
|
|
+ const handleCloseWatch = (e: any) => {
|
|
|
|
+ const id = e.target.id
|
|
|
|
+ if(id === 'overlay') setWatch(false)
|
|
|
|
+ if(id === 'close') setWatch(false)
|
|
|
|
+ }
|
|
const handleClose = (type: string | undefined): void => {
|
|
const handleClose = (type: string | undefined): void => {
|
|
if (type === 'copy') copied('Link')
|
|
if (type === 'copy') copied('Link')
|
|
if (type === 'delete') setModal(true)
|
|
if (type === 'delete') setModal(true)
|
|
@@ -358,12 +410,34 @@ const MessagesLeftImage = ({url,createdAt,color,fullType,caption,emoji,emojiComp
|
|
|
|
|
|
return (watch ?
|
|
return (watch ?
|
|
<div onClick={handleCloseWatch} id='overlay' className={classes.overlay}>
|
|
<div onClick={handleCloseWatch} id='overlay' className={classes.overlay}>
|
|
- <div className={classes.wrapperOverlayImg}>
|
|
|
|
- <span className={classes.overlayTime}>{timeStampEU(createdAt)}</span>
|
|
|
|
- <DownloadForOfflineIcon className={classes.overlayDownloadIcon} fontSize='large'
|
|
|
|
- onClick={() => handleDownload(url, fullType)}/>
|
|
|
|
- <img width='100%' height='auto' alt='imageItem' src={url} />
|
|
|
|
- </div>
|
|
|
|
|
|
+ <div className={classes.topBar}>
|
|
|
|
+ <div className={classes.wrapperCredentials}>
|
|
|
|
+ <ListItemIcon >
|
|
|
|
+ <Avatar alt={name} src={url?url:undefined}
|
|
|
|
+ sx={{ background: color, width: 44, height: 44 }}>
|
|
|
|
+ {!url&&`${firstLetter(name)}${firstLetter(lastName)}`}
|
|
|
|
+ </Avatar>
|
|
|
|
+ </ListItemIcon>
|
|
|
|
+ <ListItemText primary={`${firstLetter(name)}${slicedWord(name, 15, 1)}
|
|
|
|
+ ${firstLetter(lastName)}${slicedWord(lastName, 15, 1)}`}
|
|
|
|
+ primaryTypographyProps={{ color: '#ffffff' }}
|
|
|
|
+ secondary={timeStampEU(createdAt)} secondaryTypographyProps={{ color: '#ffffff' }} />
|
|
|
|
+ </div>
|
|
|
|
+ <div className={classes.wrapperIcons}>
|
|
|
|
+ <ZoomOutIcon onClick={handleDecreaseScale}
|
|
|
|
+ className={classes.magnifying} fontSize='large' />
|
|
|
|
+ <ZoomInIcon onClick={handleIncreaseScale}
|
|
|
|
+ className={classes.magnifying} fontSize='large' />
|
|
|
|
+ <DownloadForOfflineIcon onClick={() => handleDownload(url, fullType)}
|
|
|
|
+ className={classes.downloadIcon} fontSize='large' />
|
|
|
|
+ <CloseIcon id='close' onClick={handleCloseWatch}
|
|
|
|
+ className={classes.iconCloseOverlay} fontSize='large' />
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ <div className={classes.wrapperImage}>
|
|
|
|
+ <img style={{ transform: `scale(${scale})`, cursor: scale > 1 ? 'grab' : 'auto' }}
|
|
|
|
+ width='100%' height='auto' alt='imageItem' src={url} />
|
|
|
|
+ </div>
|
|
</div> :
|
|
</div> :
|
|
<div className={classes.container} style={{ marginBottom: caption ? 40 : 15}}>
|
|
<div className={classes.container} style={{ marginBottom: caption ? 40 : 15}}>
|
|
{isSomeSelected&&<Checkbox {...label} checked={checked} onClick={() => handleSelected(_id)}/>}
|
|
{isSomeSelected&&<Checkbox {...label} checked={checked} onClick={() => handleSelected(_id)}/>}
|