import List from '@mui/material/List'; import ListItem from '@mui/material/ListItem'; import ListItemText from '@mui/material/ListItemText'; import ListItemAvatar from '@mui/material/ListItemAvatar'; import VideoLibraryIcon from '@mui/icons-material/VideoLibrary'; import Divider from '@mui/material/Divider'; import { makeStyles } from '@material-ui/core' import { useEffect } from 'react'; import AlertInfo from '../../../../reusableComponents/AlertInfo'; import { timeStampEU,handleDownload,filteredMessages,handleSort,prodAwsS3 } from '../../../../../helpers' import { TAllMessages } from '../../../../../typescript/redux/allMessages/types' const useStyles = makeStyles({ container: { width: '100%', maxHeight: '86vh', overflowY: 'scroll', '&::-webkit-scrollbar': { width: '0.4em' }, '&::-webkit-scrollbar-track': { boxShadow: 'inset 0 0 6px rgba(0,0,0,0.00)', webkitBoxShadow: 'inset 0 0 6px rgba(0,0,0,0.00)', backgroundColor: '#eceeec', }, '&::-webkit-scrollbar-thumb': { backgroundColor: '#ccc8c8', }, "&::-webkit-scrollbar-thumb:focus": { backgroundColor: "#959595", }, "&::-webkit-scrollbar-thumb:active": { backgroundColor: "#959595", }, }, folderIcon: { color: '#54b0fc', cursor: 'pointer', '&:hover': { color: '#016cc3' }, }, listItem: { '&:hover': { backgroundColor: '#f0f0f0', } }, }) interface IVideoList { messagesMemo: TAllMessages, value: string, date: any, setDisabled: React.Dispatch, sort: boolean } const VideoList = ({ messagesMemo,value,date,sort,setDisabled }: IVideoList) => { const classes = useStyles() const filtered = messagesMemo.filter(({type}) => type === 'video') const filteredAndSorted = filteredMessages(handleSort('createdAt', filtered, sort),date,value) useEffect(() => { setDisabled(filtered.length > 0?false:true) }, [filtered, setDisabled]) return ( <> {filteredAndSorted.length > 0 && {filteredAndSorted.map(({ message, createdAt, fullType }) =>
handleDownload(`${prodAwsS3}/${message}`, fullType)} className={classes.folderIcon} fontSize='large' />
)}
} {(value || date)&& filteredAndSorted.length === 0 && } {!value && !date && filteredAndSorted.length === 0 && } ) } export default VideoList