// ** React Imports import { Fragment } from 'react' // ** MUI Imports import Badge from '@mui/material/Badge' import MuiAvatar from '@mui/material/Avatar' import { styled } from '@mui/material/styles' import Typography from '@mui/material/Typography' import IconButton from '@mui/material/IconButton' import Box, { BoxProps } from '@mui/material/Box' // ** Icon Imports import Icon from 'src/@core/components/icon' // ** Custom Components Import import ChatLog from './ChatLog' import SendMsgForm from 'src/views/apps/chat/SendMsgForm' import CustomAvatar from 'src/@core/components/mui/avatar' import OptionsMenu from 'src/@core/components/option-menu' import UserProfileRight from 'src/views/apps/chat/UserProfileRight' // ** Types import { ChatContentType } from 'src/types/apps/chatTypes' // ** Styled Components const ChatWrapperStartChat = styled(Box)(({ theme }) => ({ flexGrow: 1, height: '100%', display: 'flex', borderRadius: 1, alignItems: 'center', flexDirection: 'column', justifyContent: 'center', backgroundColor: theme.palette.action.hover })) const ChatContent = (props: ChatContentType) => { // ** Props const { store, hidden, sendMsg, mdAbove, dispatch, statusObj, getInitials, sidebarWidth, userProfileRightOpen, handleLeftSidebarToggle, handleUserProfileRightSidebarToggle } = props const handleStartConversation = () => { if (!mdAbove) { handleLeftSidebarToggle() } } const renderContent = () => { if (store) { const selectedChat = store.selectedChat if (!selectedChat) { return ( Start Conversation ) } else { return ( `1px solid ${theme.palette.divider}` }} > {mdAbove ? null : ( )} `0 0 0 2px ${theme.palette.background.paper}`, backgroundColor: `${statusObj[selectedChat.contact.status]}.main` }} /> } > {selectedChat.contact.avatar ? ( ) : ( {getInitials(selectedChat.contact.fullName)} )} {selectedChat.contact.fullName} {selectedChat.contact.role} {mdAbove ? ( ) : null} } iconButtonProps={{ size: 'small', sx: { color: 'text.secondary' } }} options={['View Contact', 'Mute Notifications', 'Block Contact', 'Clear Chat', 'Report']} /> {selectedChat && store.userProfile ? ( ) } } else { return null } } return renderContent() } export default ChatContent