index.tsx 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. import { makeStyles } from '@material-ui/core'
  2. import { useSelector } from 'react-redux';
  3. import ListItemText from '@mui/material/ListItemText';
  4. import ListItemAvatar from '@mui/material/ListItemAvatar';
  5. import Avatar from '@mui/material/Avatar';
  6. import MinimizeIcon from '@mui/icons-material/Minimize';
  7. import CropLandscapeIcon from '@mui/icons-material/CropLandscape';
  8. import CloseIcon from '@mui/icons-material/Close';
  9. import ScreenShareIcon from '@mui/icons-material/ScreenShare';
  10. import StopScreenShareIcon from '@mui/icons-material/StopScreenShare';
  11. import VideocamIcon from '@mui/icons-material/Videocam';
  12. import VideocamOffIcon from '@mui/icons-material/VideocamOff';
  13. import MicIcon from '@mui/icons-material/Mic';
  14. import MicOffIcon from '@mui/icons-material/MicOff';
  15. import CallEndIcon from '@mui/icons-material/CallEnd';
  16. import { getChat } from '../../../../../../redux/chat/selector';
  17. import { prodAwsS3,firstLetter,slicedWord } from '../../../../../../helpers'
  18. const useStyles = makeStyles({
  19. overlay: {
  20. position: 'fixed',
  21. top: 0,
  22. left: 0,
  23. width: '100vw',
  24. height: '100vh',
  25. zIndex: 100,
  26. overflowY: 'hidden',
  27. },
  28. modalCall: {
  29. background: 'rgb(36, 36, 36)',
  30. position: 'absolute',
  31. display: 'flex',
  32. flexDirection: 'column',
  33. justifyContent: 'start',
  34. alignItems: 'center',
  35. justifyItems:"center",
  36. width: '34vw',
  37. // height:'50vh',
  38. left: '33vw',
  39. top: 0,
  40. // bottom: '25vh',
  41. borderRadius: 7,
  42. },
  43. rightIcons: {
  44. display: 'flex',
  45. justifyContent: 'end',
  46. alignContent: 'center',
  47. alignItems: 'center',
  48. marginBottom: 40,
  49. width:'100%'
  50. },
  51. rightIconWrapper: {
  52. color: '#ffffff',
  53. cursor: 'pointer',
  54. padding:'3px 10px 3px 10px',
  55. '&:hover': {
  56. backgroundColor:'rgb(54, 54, 54)'
  57. }
  58. },
  59. rightIconWrapperClose: {
  60. color: '#ffffff',
  61. cursor: 'pointer',
  62. padding:'3px 10px 3px 10px',
  63. borderTopRightRadius:7,
  64. '&:hover': {
  65. backgroundColor:'#f02a2a'
  66. }
  67. },
  68. statusCall: {
  69. color: "#dfdfdf",
  70. animation: 'ripple 4s infinite ease-in-out',
  71. },
  72. animatedDots: {
  73. fontWeight: 'bold',
  74. display:'inline-block',
  75. fontFamily: 'monospace',
  76. clipPath: 'inset(0 3ch 0 0)',
  77. animation: `$run 2s steps(5) infinite`,
  78. },
  79. '@keyframes run': {
  80. to: {
  81. clipPath: 'inset(0 -1ch 0 0)'
  82. },
  83. },
  84. })
  85. const CallModal = ({setModalCall}:{setModalCall:any}) => {
  86. const classes = useStyles()
  87. const {name,lastName,avatarUrl,color,companionId} = useSelector(getChat)
  88. const handleDeleteModal = (e: any) => {
  89. // const id = e.target.id
  90. // if (id === 'overlay' || id === 'cancel') return setModalCall(false)
  91. // if (id === 'delete') {
  92. // setModalCall(false)
  93. // }
  94. }
  95. return (
  96. <div onClick={handleDeleteModal} className={classes.overlay} id='overlay'>
  97. <div className={classes.modalCall}>
  98. <div className={classes.rightIcons}>
  99. <div className={classes.rightIconWrapper}>
  100. <MinimizeIcon fontSize='small' />
  101. </div>
  102. <div className={classes.rightIconWrapper}>
  103. <CropLandscapeIcon fontSize='small' />
  104. </div>
  105. <div className={classes.rightIconWrapperClose}>
  106. <CloseIcon fontSize='small' />
  107. </div>
  108. </div>
  109. <ListItemAvatar style={{marginBottom:15}}>
  110. <Avatar alt={name} src={avatarUrl?`${prodAwsS3}/${avatarUrl}`:undefined}
  111. sx={{ background: color, width: 120, height: 120, marginRight: 2, fontSize:30}}>
  112. {`${firstLetter(name)}${firstLetter(lastName)}`}
  113. </Avatar>
  114. </ListItemAvatar>
  115. <ListItemText primary={`${firstLetter(name)}${slicedWord(name, 15, 1)}
  116. ${firstLetter(lastName)}${slicedWord(lastName, 15, 1)}`}
  117. primaryTypographyProps={{ color: '#ffffff', fontSize: 20, fontWeight: 500 }} />
  118. <ListItemText secondary={<span className={classes.statusCall}>
  119. ringing<span className={classes.animatedDots}>
  120. ...</span>
  121. </span>}/>
  122. </div>
  123. </div>
  124. )
  125. }
  126. export default CallModal