import { makeStyles,Typography } from '@material-ui/core' import { useState } from 'react'; import { styled } from '@mui/material/styles'; import Menu from '@mui/material/Menu'; import MenuItem from '@mui/material/MenuItem'; import NotificationsNoneIcon from '@mui/icons-material/NotificationsNone'; import VolumeOffIcon from '@mui/icons-material/VolumeOff'; import DeleteOutlineIcon from '@mui/icons-material/DeleteOutline'; import ListItemButton from '@mui/material/ListItemButton'; import Avatar from '@mui/material/Avatar'; import ListItemText from '@mui/material/ListItemText'; import ListItemIcon from '@mui/material/ListItemIcon'; import Badge from '@mui/material/Badge'; import DoneAllIcon from '@mui/icons-material/DoneAll'; import { muteChat } from '../../../../../api-data'; import { TChat } from '../../../../../typescript/redux/chats/types'; import { firstLetter, slicedWord, timeStampEU,prodBaseURL } from '../../../../../helpers'; import DeleteModal from './DeleteModal'; 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: '8px 8px', }, '& .MuiMenuItem-root': { marginBottom: theme.spacing(1), '& .MuiSvgIcon-root': { fontSize: 21, color: theme.palette.text.secondary, marginRight: theme.spacing(4), } }, }, })); const StyledBadge = styled(Badge)(({ theme }) => ({ '& .MuiBadge-badge': { backgroundColor: '#44b700', color: '#44b700', boxShadow: `0 0 0 2px ${theme.palette.background.paper}`, '&::after': { position: 'absolute', top: 0, left: 0, width: '100%', height: '100%', borderRadius: '50%', animation: 'ripple 1.2s infinite ease-in-out', border: '1px solid currentColor', content: '""', }, }, '@keyframes ripple': { '0%': { transform: 'scale(.8)', opacity: 1, }, '100%': { transform: 'scale(2.4)', opacity: 0, }, }, })); const useStyles = makeStyles({ listItemInnerText: { display: 'flex', alignContent: 'center', alignItems: 'center', flexWrap: 'nowrap', }, listItemInnerText__icon: { marginLeft: 5, color: '#959595', }, listItem_iconAvatar: { marginRight:10 }, listItem_iconRight: { marginRight: 10, display: 'flex', alignItems: 'center', justifyContent: 'center', alignContent: 'center', flexDirection: 'column' }, listItem_iconTimeChecked: { display: 'flex', flexWrap: 'nowrap', alignItems: 'center', justifyContent: 'center', alignContent: 'center', marginBottom:2 }, listItem_iconRightBtn: { background: '#0ac40a', borderRadius: '50%', color: '#ffffff', border: 'none', height: 24, width: 24, textAlign: 'center', display: 'flex', alignItems: 'center', justifyContent: 'center', alignContent: 'center', fontSize: 12, marginLeft: 'auto', '&:hover': { outline: 'solid 3px #3ee415', } }, listItem_iconRightBtnMute: { background: '#a7aaa7', borderRadius: '50%', color: '#ffffff', border: 'none', height: 24, width: 24, textAlign: 'center', display: 'flex', alignItems: 'center', justifyContent: 'center', alignContent: 'center', fontSize: 12, marginLeft: 'auto', '&:hover': { outline: 'solid 3px #cccbcb', } }, listItem_iconRightBtnHidden: { background: 'inherit', borderRadius: '50%', border: 'none', height: 24, width: 24, textAlign: 'center', display: 'flex', alignItems: 'center', justifyContent: 'center', alignContent: 'center', fontSize: 12, marginLeft: 'auto', }, listItem_icon_time: { fontSize: 12, marginLeft: 5, color: '#1b1b1b' }, listItem_typing: { color: '#4d4d4d', animation: 'ripple 4s infinite ease-in-out', }, listItem_dots: { color: '#1b1b1b', fontWeight: 'bold', display:'inline-block', fontFamily: 'monospace', clipPath: 'inset(0 3ch 0 0)', animation: `$run 2s steps(5) infinite`, }, '@keyframes run': { to: { clipPath: 'inset(0 -1ch 0 0)' }, }, }) interface IChatItem { chat: TChat, handleListItemClick: (companionId: string) => void, handleNewMsgs: (e: any,companionId: string) => void, } const ChatItem = ({chat,handleListItemClick,handleNewMsgs}:IChatItem) => { const classes = useStyles() const [anchorEl, setAnchorEl] = useState