import { makeStyles } from "@material-ui/core/styles"; import { styled } from '@mui/material/styles'; import { useState } from "react"; import DownloadForOfflineIcon from '@mui/icons-material/DownloadForOffline'; import { IconButton } from "@material-ui/core"; import ImageIcon from '@mui/icons-material/Image'; import FileDownloadIcon from '@mui/icons-material/FileDownload'; import Button from '@mui/material/Button'; import ContentCopyIcon from '@mui/icons-material/ContentCopy'; import DeleteOutlineIcon from '@mui/icons-material/DeleteOutline'; import Menu from '@mui/material/Menu'; import MenuItem from '@mui/material/MenuItem'; import Divider from '@mui/material/Divider'; import CheckBoxIcon from '@mui/icons-material/CheckBox'; import Checkbox from '@mui/material/Checkbox'; import { CopyToClipboard } from 'react-copy-to-clipboard'; import { removeMessageById,updateMessageById } from "../../../../../../api-data"; import { timeStampMessage, timeStampEU,handleDownload,copied,emojisArr } from '../../../../../../helpers' const StyledMenu = styled((props:any) => (
))(({ theme }:any) => ({ '& .MuiPaper-root': { borderRadius: 10, marginTop: theme.spacing(0), minWidth: 220, color: theme.palette.mode === 'light' ? 'rgb(55, 65, 81)' : theme.palette.grey[500], boxShadow: 'rgb(255, 255, 255) 0px 0px 0px 0px, rgba(0, 0, 0, 0.05) 0px 0px 0px 1px, rgba(0, 0, 0, 0.1) 0px 10px 15px -3px, rgba(0, 0, 0, 0.05) 0px 4px 6px -2px', '& .MuiMenu-list': { padding: '4px 4px', }, '& .MuiMenuItem-root': { marginBottom: theme.spacing(1), '& .MuiSvgIcon-root': { fontSize: 21, color: theme.palette.text.secondary, marginRight: theme.spacing(2), } }, }, })); const useStyles = makeStyles({ container: { display: "flex", justifyContent: "flex-end", borderRadius: 7, }, wrapper: { width: 400, position: 'relative', display: 'flex', alignItems: 'center', alignContent: 'center', justifyContent: 'space-between', borderRadius: 7, padding: '12px 5px 18px 5px', backgroundColor: '#deffa9', "&:after": { content: "''", position: "absolute", width: "0", height: "0", borderBottom: "15px solid #deffa9", borderLeft: "15px solid transparent", borderRight: "15px solid transparent", bottom: "0", right: "-15px" }, "&:before": { content: "''", position: "absolute", width: "0", height: "0", borderBottom: "17px solid #deffa9", borderLeft: "16px solid transparent", borderRight: "16px solid transparent", bottom: "0px", right: "-17px" } }, wrapperActive: { width: 400, position: 'relative', display: 'flex', alignItems: 'center', alignContent: 'center', justifyContent: 'space-between', borderRadius: 7, padding: '12px 5px 18px 5px', backgroundColor: '#ced8d7', "&:after": { content: "''", position: "absolute", width: "0", height: "0", borderBottom: "15px solid #ced8d7", borderLeft: "15px solid transparent", borderRight: "15px solid transparent", bottom: "0", right: "-15px" }, "&:before": { content: "''", position: "absolute", width: "0", height: "0", borderBottom: "17px solid #ced8d7", borderLeft: "16px solid transparent", borderRight: "16px solid transparent", bottom: "0px", right: "-17px" } }, image: { borderRadius: 7, width: 300, maxHeight: 400, cursor:'pointer', }, time: { position: "absolute", fontSize: ".65em", fontWeight:600, bottom: 0, right: 6, color: '#414141', padding: 3, borderRadius: 5, }, captionWrapper: { position: "absolute", fontSize: ".85em", color: '#626262', maxWidth:'76%', fontWeight:600, bottom: -25, right: 40, borderRadius: 5, wordBreak:'break-word', textAlign: "left", font: "400 .9em 'Open Sans', sans-serif", backgroundColor: '#ffffff', padding:10, "&:after": { content: "''", position: "absolute", width: "0", height: "0", borderBottom: "15px solid #ffffff", borderLeft: "15px solid transparent", borderRight: "15px solid transparent", bottom: "0", right: "-15px" }, "&:before": { content: "''", position: "absolute", width: "0", height: "0", borderBottom: "17px solid #ffffff", borderLeft: "16px solid transparent", borderRight: "16px solid transparent", bottom: "-1px", right: "-17px" } }, bntDownload: { backgroundColor: 'inherit', color: '#54b0fc', width: 30, height:30, '&:hover': { backgroundColor: '#54b0fc', color:'#ffffff' } }, overlay: { position: 'fixed', top: 0, left: 0, width: '100vw', height: '100vh', zIndex: 100, backgroundColor: 'rgba(104, 105, 104, 0.6)', overflowY: 'hidden', boxSizing: 'border-box', display: 'flex', justifyContent: 'center', alignContent: 'center', alignItems: 'center' }, wrapperOverlayImg: { width: '30%', maxHeight: '80%', position: 'relative', display: 'flex', }, overlayDownloadIcon: { position: 'absolute', content: '', right: 0, top: -40, cursor: 'pointer', color: '#e9e7e7', padding: 0, borderRadius: '50%', '&:hover': { backgroundColor: '#ffffff', color: '#b8b7b7', } }, overlayTime: { position: 'absolute', content: '', color: '#ffffff', top: -30, left: 0, borderRadius: 10, padding:'2px 6px 2px 6px', backgroundColor:'#707070' }, modalDelete: { background: '#ffffff', position: 'absolute', content:'', width: '20%', height:'auto', left: '40%', bottom: '48.5%', borderRadius: 10, padding: 10, display: 'flex', flexDirection:'column' }, overlayDelete: { position: 'fixed', top: 0, left: 0, width: '100vw', height: '100vh', zIndex: 100, backgroundColor: 'rgba(104, 105, 104, 0.6)', overflowY: 'hidden', }, emojiTitle: { position: "absolute", fontSize: "1.7em", fontWeight:600, bottom: 0, left: -40, }, emojiCompanionTitle: { position: "absolute", fontSize: "1.7em", fontWeight:600, bottom: '2rem', left: -40, }, emoji: { cursor: 'pointer', fontSize: '1.7rem', transition: 'all 0.3s', '&:hover': { transform: 'scale(1.5)' } }, emojiActive: { cursor: 'pointer', fontSize: '1.2rem', animation: `$emoji 0.6s ease-out`, animationDirection: 'forwards', animationIterationCount: 1, }, '@keyframes emoji': { '5%': { transform: 'translateY(1rem)'}, '10%': { transform: 'translateY(0) scale(1)',opacity: 1}, '50%': { transform: 'translateY(-4rem) scale(1.5) rotateY(90deg)'}, '80%': {opacity: 0}, '100%': {transform: 'translateY(-8rem) scale(2) rotateY(180deg)',opacity: 0}, }, }); const label = { inputProps: { 'aria-label': 'Checkbox demo' } }; interface IMessageRightImage { url:string, createdAt:string, color: string, fullType: string, caption: string, emoji: string, emojiCompanion: string, isSomeSelected: boolean, isSelected:(_id:string) => boolean, handleSelected: (_id:string) => void, _id:string } const MessageRightImage = ({url,createdAt,color,fullType,caption,emoji,emojiCompanion,isSomeSelected,isSelected,handleSelected,_id}:IMessageRightImage) => { const classes = useStyles(); const [watch, setWatch] = useStateAre you sure you want to delete message?