|
@@ -7,7 +7,6 @@ import Typography from '@mui/material/Typography';
|
|
|
import TextField from '@mui/material/TextField';
|
|
|
import CloseIcon from '@mui/icons-material/Close';
|
|
|
import List from '@mui/material/List';
|
|
|
-import Divider from '@mui/material/Divider';
|
|
|
|
|
|
import {ReactComponent as KickLogo} from '../assets/kick.svg'
|
|
|
|
|
@@ -43,7 +42,7 @@ const DelBtn = ({ onEvent }) => (
|
|
|
</IconButton>
|
|
|
)
|
|
|
|
|
|
-const ChatModal = ({ minTitle="2", chat, onСonfirm, titleError, create, render }) => {
|
|
|
+const ChatModal = ({ minTitle="2", chat, onСonfirm, titleError, myProfile, create, render }) => {
|
|
|
|
|
|
const [open, setOpen] = useState(false)
|
|
|
const handleOpen = () => setOpen(true)
|
|
@@ -117,7 +116,8 @@ const ChatModal = ({ minTitle="2", chat, onСonfirm, titleError, create, render
|
|
|
|
|
|
<Box sx={{ display: 'flex', justifyContent: 'start' }}>
|
|
|
<Typography variant="h6">
|
|
|
- {create ? 'Создание чата' : 'Редактирование чата' }
|
|
|
+ {((chat?.owner?._id !== myProfile?._id) && !create) ?
|
|
|
+ 'Информация (редактирование запрещено)' : create ? 'Создание чата' : 'Редактирование чата' }
|
|
|
</Typography>
|
|
|
</Box>
|
|
|
|
|
@@ -218,6 +218,7 @@ const ChatModal = ({ minTitle="2", chat, onСonfirm, titleError, create, render
|
|
|
<List
|
|
|
sx={{ maxWidth: '100%', bgcolor: 'background.paper' }}
|
|
|
>
|
|
|
+ {/* { create && <UserCard key={'iAm'} user={myProfile} /> } */}
|
|
|
{ members.map((member, i) => <UserCard key={member._id} user={member}
|
|
|
render={DelBtn} onAction={() => onDelMember(i)} />)}
|
|
|
</List>
|
|
@@ -242,13 +243,13 @@ const ChatModal = ({ minTitle="2", chat, onСonfirm, titleError, create, render
|
|
|
|
|
|
<Box sx={{ display: 'flex', justifyContent: 'center'}}>
|
|
|
<Button variant="contained"
|
|
|
- disabled={(title?.length >= minTitle) ? false : true}
|
|
|
+ disabled={ (title?.length < minTitle) ? true :
|
|
|
+ ((chat?.owner?._id !== myProfile?._id) && !create) ? true : false }
|
|
|
onClick={() => onСonfirm( "media", img, title,
|
|
|
prepareMembers(members), chat?._id )} >
|
|
|
Применить
|
|
|
</Button>
|
|
|
</Box>
|
|
|
-
|
|
|
</Box>
|
|
|
|
|
|
|
|
@@ -257,6 +258,7 @@ const ChatModal = ({ minTitle="2", chat, onСonfirm, titleError, create, render
|
|
|
</>
|
|
|
)
|
|
|
}
|
|
|
- export const CChatModal = connect( state => ( { chatError: state.promise.updateChat || {} }),
|
|
|
+ export const CChatModal = connect( state => ( { chatError: state.promise.updateChat || {},
|
|
|
+ myProfile: state.promise.myProfile?.payload || {} }),
|
|
|
{ onСonfirm: actionSetChatInfo })(ChatModal)
|
|
|
|