idillon | 531b6f2 | 2022-09-16 14:02:00 -0400 | [diff] [blame] | 1 | import Modal from 'react-modal'; |
simon | d47ef9e | 2022-09-28 22:24:28 -0400 | [diff] [blame] | 2 | import authManager from '../AuthManager'; |
| 3 | import ConversationAvatar from './ConversationAvatar'; |
| 4 | import Conversation from '../../../model/Conversation'; |
| 5 | import { useState } from 'react'; |
| 6 | import { useNavigate, useParams } from 'react-router-dom'; |
| 7 | import { ListItem, Stack, ListItemAvatar, ListItemText, Box, Typography } from '@mui/material'; |
ervinanoh | b81c391 | 2022-09-08 04:13:24 -0400 | [diff] [blame] | 8 | import { RemoveContactIcon, VideoCallIcon } from './svgIcons'; |
| 9 | import { AudioCallIcon, BlockContactIcon, ContactDetailsIcon, CrossIcon, MessageIcon } from './svgIcons'; |
simon | d47ef9e | 2022-09-28 22:24:28 -0400 | [diff] [blame] | 10 | import { QRCodeCanvas } from 'qrcode.react'; |
ervinanoh | 34eb947 | 2022-09-13 04:20:28 -0400 | [diff] [blame] | 11 | import { setRefreshFromSlice } from '../../redux/appSlice'; |
| 12 | import { useAppDispatch } from '../../redux/hooks'; |
| 13 | |
idillon | 531b6f2 | 2022-09-16 14:02:00 -0400 | [diff] [blame] | 14 | const customStyles = { |
| 15 | content: { |
ervinanoh | 8e91804 | 2022-09-06 10:30:59 -0400 | [diff] [blame] | 16 | // right: "auto", |
| 17 | // bottom: "auto", |
| 18 | // // marginRight: "-50%", |
| 19 | // transform: "translate(-50%, -50%)", |
ervinanoh | 8e91804 | 2022-09-06 10:30:59 -0400 | [diff] [blame] | 20 | // padding: "16px" |
| 21 | |
| 22 | // top: "1364px", |
simon | d47ef9e | 2022-09-28 22:24:28 -0400 | [diff] [blame] | 23 | left: '94px', |
| 24 | width: '180px', |
| 25 | height: '262px', |
| 26 | background: '#FFFFFF 0% 0% no-repeat padding-box', |
| 27 | boxShadow: '3px 3px 7px #00000029', |
| 28 | borderRadius: '5px 20px 20px 20px', |
| 29 | opacity: '1', |
ervinanoh | 8e91804 | 2022-09-06 10:30:59 -0400 | [diff] [blame] | 30 | |
simon | d47ef9e | 2022-09-28 22:24:28 -0400 | [diff] [blame] | 31 | textAlign: 'left', |
| 32 | font: 'normal normal normal 12px/26px Ubuntu', |
| 33 | letterSpacing: '0px', |
| 34 | color: '#000000', |
ervinanoh | b81c391 | 2022-09-08 04:13:24 -0400 | [diff] [blame] | 35 | }, |
| 36 | }; |
| 37 | |
| 38 | const cancelStyles = { |
| 39 | content: { |
simon | d47ef9e | 2022-09-28 22:24:28 -0400 | [diff] [blame] | 40 | left: '94px', |
| 41 | width: '300px', |
| 42 | height: '220px', |
| 43 | background: '#FFFFFF 0% 0% no-repeat padding-box', |
| 44 | boxShadow: '3px 3px 7px #00000029', |
| 45 | borderRadius: '20px', |
| 46 | opacity: '1', |
ervinanoh | b81c391 | 2022-09-08 04:13:24 -0400 | [diff] [blame] | 47 | |
simon | d47ef9e | 2022-09-28 22:24:28 -0400 | [diff] [blame] | 48 | textAlign: 'left', |
| 49 | font: 'normal normal normal 12px/26px Ubuntu', |
| 50 | letterSpacing: '0px', |
| 51 | color: '#000000', |
ervinanoh | b81c391 | 2022-09-08 04:13:24 -0400 | [diff] [blame] | 52 | }, |
| 53 | }; |
| 54 | |
| 55 | const contactDetailsStyles = { |
| 56 | content: { |
simon | d47ef9e | 2022-09-28 22:24:28 -0400 | [diff] [blame] | 57 | left: '94px', |
| 58 | width: '450px', |
| 59 | height: '450px', |
| 60 | background: '#FFFFFF 0% 0% no-repeat padding-box', |
| 61 | boxShadow: '3px 3px 7px #00000029', |
| 62 | borderRadius: '20px', |
| 63 | opacity: '1', |
ervinanoh | b81c391 | 2022-09-08 04:13:24 -0400 | [diff] [blame] | 64 | |
simon | d47ef9e | 2022-09-28 22:24:28 -0400 | [diff] [blame] | 65 | textAlign: 'left', |
| 66 | font: 'normal normal normal 12px/26px Ubuntu', |
| 67 | letterSpacing: '0px', |
| 68 | color: '#000000', |
idillon | 531b6f2 | 2022-09-16 14:02:00 -0400 | [diff] [blame] | 69 | }, |
| 70 | }; |
Adrien Béraud | 995e802 | 2021-04-08 13:46:51 -0400 | [diff] [blame] | 71 | |
ervinanoh | 8e91804 | 2022-09-06 10:30:59 -0400 | [diff] [blame] | 72 | const stackStyles = { |
simon | d47ef9e | 2022-09-28 22:24:28 -0400 | [diff] [blame] | 73 | flexDirection: 'row', |
| 74 | marginBottom: '4px', |
| 75 | spacing: '40px', |
ervinanoh | 8e91804 | 2022-09-06 10:30:59 -0400 | [diff] [blame] | 76 | flex: 1, |
simon | d47ef9e | 2022-09-28 22:24:28 -0400 | [diff] [blame] | 77 | alignItems: 'center', |
ervinanoh | 8e91804 | 2022-09-06 10:30:59 -0400 | [diff] [blame] | 78 | }; |
| 79 | |
ervinanoh | b81c391 | 2022-09-08 04:13:24 -0400 | [diff] [blame] | 80 | const iconTextStyle = { |
simon | d47ef9e | 2022-09-28 22:24:28 -0400 | [diff] [blame] | 81 | marginRight: '10px', |
ervinanoh | b81c391 | 2022-09-08 04:13:24 -0400 | [diff] [blame] | 82 | }; |
| 83 | |
simon | d47ef9e | 2022-09-28 22:24:28 -0400 | [diff] [blame] | 84 | const iconColor = '#005699'; |
ervinanoh | b81c391 | 2022-09-08 04:13:24 -0400 | [diff] [blame] | 85 | |
Adrien Béraud | af09a46 | 2021-04-15 18:02:29 -0400 | [diff] [blame] | 86 | export default function ConversationListItem(props) { |
idillon | 531b6f2 | 2022-09-16 14:02:00 -0400 | [diff] [blame] | 87 | const { conversationId, contactId } = useParams(); |
ervinanoh | 34eb947 | 2022-09-13 04:20:28 -0400 | [diff] [blame] | 88 | const dispatch = useAppDispatch(); |
| 89 | |
idillon | 531b6f2 | 2022-09-16 14:02:00 -0400 | [diff] [blame] | 90 | const conversation = props.conversation; |
Adrien Béraud | 995e802 | 2021-04-08 13:46:51 -0400 | [diff] [blame] | 91 | |
idillon | 531b6f2 | 2022-09-16 14:02:00 -0400 | [diff] [blame] | 92 | const pathId = conversationId || contactId; |
| 93 | const isSelected = conversation.getDisplayUri() === pathId; |
| 94 | const navigate = useNavigate(); |
| 95 | |
idillon | 531b6f2 | 2022-09-16 14:02:00 -0400 | [diff] [blame] | 96 | const [modalIsOpen, setIsOpen] = useState(false); |
| 97 | const [modalDetailsIsOpen, setModalDetailsIsOpen] = useState(false); |
| 98 | const [modalDeleteIsOpen, setModalDeleteIsOpen] = useState(false); |
ervinanoh | b81c391 | 2022-09-08 04:13:24 -0400 | [diff] [blame] | 99 | const [blockOrRemove, setBlockOrRemove] = useState(true); |
simon | d47ef9e | 2022-09-28 22:24:28 -0400 | [diff] [blame] | 100 | const [userId, setUserId] = useState(conversation?.getFirstMember()?.contact.getUri()); |
| 101 | const [isSwarm, setIsSwarm] = useState('true'); |
idillon | 531b6f2 | 2022-09-16 14:02:00 -0400 | [diff] [blame] | 102 | |
ervinanoh | b81c391 | 2022-09-08 04:13:24 -0400 | [diff] [blame] | 103 | const openModal = (e) => { |
| 104 | e.preventDefault(); |
| 105 | console.log(e); |
| 106 | setIsOpen(true); |
| 107 | }; |
idillon | 531b6f2 | 2022-09-16 14:02:00 -0400 | [diff] [blame] | 108 | const openModalDetails = () => setModalDetailsIsOpen(true); |
| 109 | const openModalDelete = () => setModalDeleteIsOpen(true); |
idillon | 531b6f2 | 2022-09-16 14:02:00 -0400 | [diff] [blame] | 110 | const closeModal = () => setIsOpen(false); |
idillon | 531b6f2 | 2022-09-16 14:02:00 -0400 | [diff] [blame] | 111 | const closeModalDetails = () => setModalDetailsIsOpen(false); |
| 112 | const closeModalDelete = () => setModalDeleteIsOpen(false); |
| 113 | |
ervinanoh | b81c391 | 2022-09-08 04:13:24 -0400 | [diff] [blame] | 114 | let subtitle; |
idillon | 531b6f2 | 2022-09-16 14:02:00 -0400 | [diff] [blame] | 115 | function afterOpenModal() { |
| 116 | // references are now sync'd and can be accessed. |
simon | d47ef9e | 2022-09-28 22:24:28 -0400 | [diff] [blame] | 117 | subtitle.style.color = '#f00'; |
idillon | 531b6f2 | 2022-09-16 14:02:00 -0400 | [diff] [blame] | 118 | } |
| 119 | |
ervinanoh | b81c391 | 2022-09-08 04:13:24 -0400 | [diff] [blame] | 120 | const getContactDetails = () => { |
idillon | 531b6f2 | 2022-09-16 14:02:00 -0400 | [diff] [blame] | 121 | const controller = new AbortController(); |
| 122 | authManager |
simon | d47ef9e | 2022-09-28 22:24:28 -0400 | [diff] [blame] | 123 | .fetch(`/api/accounts/${conversation.getAccountId()}/contacts/details/${userId}`, { |
| 124 | signal: controller.signal, |
| 125 | }) |
ervinanoh | b81c391 | 2022-09-08 04:13:24 -0400 | [diff] [blame] | 126 | .then((res) => res.json()) |
idillon | 531b6f2 | 2022-09-16 14:02:00 -0400 | [diff] [blame] | 127 | .then((result) => { |
simon | d47ef9e | 2022-09-28 22:24:28 -0400 | [diff] [blame] | 128 | console.log('CONTACT LIST - DETAILS: ', result); |
idillon | 531b6f2 | 2022-09-16 14:02:00 -0400 | [diff] [blame] | 129 | }) |
simon | d47ef9e | 2022-09-28 22:24:28 -0400 | [diff] [blame] | 130 | .catch((e) => console.log('ERROR GET CONTACT DETAILS: ', e)); |
idillon | 531b6f2 | 2022-09-16 14:02:00 -0400 | [diff] [blame] | 131 | }; |
| 132 | |
ervinanoh | b81c391 | 2022-09-08 04:13:24 -0400 | [diff] [blame] | 133 | const removeOrBlock = (typeOfRemove) => { |
| 134 | console.log(typeOfRemove); |
| 135 | setBlockOrRemove(false); |
| 136 | |
simon | d47ef9e | 2022-09-28 22:24:28 -0400 | [diff] [blame] | 137 | console.log('EEEH', typeOfRemove, conversation.getAccountId(), userId); |
ervinanoh | b81c391 | 2022-09-08 04:13:24 -0400 | [diff] [blame] | 138 | |
| 139 | const controller = new AbortController(); |
| 140 | authManager |
simon | d47ef9e | 2022-09-28 22:24:28 -0400 | [diff] [blame] | 141 | .fetch(`/api/accounts/${conversation.getAccountId()}/contacts/${typeOfRemove}/${userId}`, { |
| 142 | signal: controller.signal, |
| 143 | method: 'DELETE', |
| 144 | }) |
ervinanoh | b81c391 | 2022-09-08 04:13:24 -0400 | [diff] [blame] | 145 | .then((res) => res.json()) |
ervinanoh | 34eb947 | 2022-09-13 04:20:28 -0400 | [diff] [blame] | 146 | .then((result) => { |
simon | d47ef9e | 2022-09-28 22:24:28 -0400 | [diff] [blame] | 147 | console.log('propre'); |
ervinanoh | 34eb947 | 2022-09-13 04:20:28 -0400 | [diff] [blame] | 148 | dispatch(setRefreshFromSlice()); |
| 149 | }) |
| 150 | .catch((e) => { |
| 151 | console.log(`ERROR ${typeOfRemove}ing CONTACT : `, e); |
| 152 | dispatch(setRefreshFromSlice()); |
| 153 | }); |
ervinanoh | b81c391 | 2022-09-08 04:13:24 -0400 | [diff] [blame] | 154 | closeModalDelete(); |
ervinanoh | b81c391 | 2022-09-08 04:13:24 -0400 | [diff] [blame] | 155 | }; |
ervinanoh | b81c391 | 2022-09-08 04:13:24 -0400 | [diff] [blame] | 156 | |
simon | d47ef9e | 2022-09-28 22:24:28 -0400 | [diff] [blame] | 157 | const uri = conversation.getId() ? `conversation/${conversation.getId()}` : `addContact/${userId}`; |
idillon | 531b6f2 | 2022-09-16 14:02:00 -0400 | [diff] [blame] | 158 | if (conversation instanceof Conversation) { |
| 159 | return ( |
ervinanoh | b81c391 | 2022-09-08 04:13:24 -0400 | [diff] [blame] | 160 | <div onContextMenu={openModal}> |
| 161 | <div name="Modal conversation"> |
| 162 | <Modal |
| 163 | isOpen={modalIsOpen} |
| 164 | // onAfterOpen={afterOpenModal} |
| 165 | onRequestClose={closeModal} |
| 166 | style={customStyles} |
| 167 | contentLabel="Example Modal" |
idillon | 531b6f2 | 2022-09-16 14:02:00 -0400 | [diff] [blame] | 168 | > |
ervinanoh | b81c391 | 2022-09-08 04:13:24 -0400 | [diff] [blame] | 169 | <Stack |
| 170 | onClick={() => { |
| 171 | navigate(`/account/${conversation.getAccountId()}/${uri}`); |
| 172 | closeModal(); |
| 173 | }} |
| 174 | {...stackStyles} |
| 175 | > |
| 176 | <div style={{ ...iconTextStyle }}> |
| 177 | <MessageIcon style={{ color: iconColor }} /> |
| 178 | </div> |
| 179 | Message |
| 180 | </Stack> |
| 181 | <Stack {...stackStyles}> |
| 182 | <div style={{ ...iconTextStyle }}> |
| 183 | <AudioCallIcon style={{ color: iconColor }} /> |
| 184 | </div> |
| 185 | Démarrer appel audio |
| 186 | </Stack> |
| 187 | |
| 188 | <Stack {...stackStyles}> |
| 189 | <div style={{ ...iconTextStyle }}> |
| 190 | <VideoCallIcon style={{ color: iconColor }} /> |
| 191 | </div> |
| 192 | Démarrer appel vidéo |
| 193 | </Stack> |
| 194 | |
| 195 | <Stack |
| 196 | {...stackStyles} |
| 197 | onClick={() => { |
| 198 | navigate(`/account/${conversation.getAccountId()}/`); |
| 199 | closeModal(); |
ervinanoh | 8e91804 | 2022-09-06 10:30:59 -0400 | [diff] [blame] | 200 | }} |
| 201 | > |
ervinanoh | b81c391 | 2022-09-08 04:13:24 -0400 | [diff] [blame] | 202 | <div style={{ ...iconTextStyle }}> |
| 203 | <CrossIcon style={{ color: iconColor }} /> |
| 204 | </div> |
| 205 | Fermer la conversation |
| 206 | </Stack> |
| 207 | |
| 208 | <Stack |
| 209 | onClick={() => { |
simon | d47ef9e | 2022-09-28 22:24:28 -0400 | [diff] [blame] | 210 | console.log('open details contact for: '); |
ervinanoh | b81c391 | 2022-09-08 04:13:24 -0400 | [diff] [blame] | 211 | closeModal(); |
| 212 | openModalDetails(); |
| 213 | getContactDetails(); |
| 214 | }} |
| 215 | {...stackStyles} |
| 216 | > |
| 217 | <div style={{ ...iconTextStyle }}> |
| 218 | <ContactDetailsIcon style={{ color: iconColor }} /> |
| 219 | </div> |
| 220 | Détails de la conversation |
| 221 | </Stack> |
| 222 | |
| 223 | <Stack |
| 224 | onClick={() => { |
| 225 | setBlockOrRemove(true); |
| 226 | closeModal(); |
| 227 | openModalDelete(); |
| 228 | }} |
| 229 | {...stackStyles} |
| 230 | > |
| 231 | <div style={{ ...iconTextStyle }}> |
| 232 | <BlockContactIcon style={{ color: iconColor }} /> |
| 233 | </div> |
| 234 | Bloquer le contact |
| 235 | </Stack> |
| 236 | |
| 237 | <Stack |
| 238 | onClick={() => { |
| 239 | setBlockOrRemove(false); |
| 240 | closeModal(); |
| 241 | openModalDelete(); |
| 242 | }} |
| 243 | {...stackStyles} |
| 244 | > |
| 245 | <div style={{ ...iconTextStyle }}> |
| 246 | <RemoveContactIcon style={{ color: iconColor }} /> |
| 247 | </div> |
| 248 | Supprimer contact |
| 249 | </Stack> |
| 250 | </Modal> |
| 251 | </div> |
| 252 | |
| 253 | <div name="Contact details"> |
| 254 | <Modal |
| 255 | isOpen={modalDetailsIsOpen} |
| 256 | onRequestClose={closeModalDetails} |
| 257 | style={contactDetailsStyles} |
| 258 | contentLabel="Détails contact" |
| 259 | > |
simon | d47ef9e | 2022-09-28 22:24:28 -0400 | [diff] [blame] | 260 | <Stack direction={'row'} alignContent="flex-end"> |
| 261 | <Stack direction={'column'}> |
| 262 | <div style={{ height: '100px' }}> |
| 263 | <ConversationAvatar displayName={conversation.getDisplayNameNoFallback()} /> |
ervinanoh | b81c391 | 2022-09-08 04:13:24 -0400 | [diff] [blame] | 264 | </div> |
| 265 | |
| 266 | <div |
| 267 | style={{ |
simon | d47ef9e | 2022-09-28 22:24:28 -0400 | [diff] [blame] | 268 | fontSize: '20px', |
| 269 | marginBottom: '20px', |
| 270 | height: '20px', |
ervinanoh | b81c391 | 2022-09-08 04:13:24 -0400 | [diff] [blame] | 271 | }} |
| 272 | > |
| 273 | Informations |
| 274 | </div> |
| 275 | |
| 276 | <Typography variant="caption">Nom d'utilisateur</Typography> |
simon | d47ef9e | 2022-09-28 22:24:28 -0400 | [diff] [blame] | 277 | <div style={{ height: '20px' }} /> |
ervinanoh | b81c391 | 2022-09-08 04:13:24 -0400 | [diff] [blame] | 278 | <Typography variant="caption">Identifiant </Typography> |
simon | d47ef9e | 2022-09-28 22:24:28 -0400 | [diff] [blame] | 279 | <div style={{ height: '20px' }} /> |
ervinanoh | b81c391 | 2022-09-08 04:13:24 -0400 | [diff] [blame] | 280 | |
| 281 | <div |
| 282 | style={{ |
| 283 | flex: 1, |
simon | d47ef9e | 2022-09-28 22:24:28 -0400 | [diff] [blame] | 284 | height: '150px', |
| 285 | direction: 'column', |
| 286 | flexDirection: 'column', |
ervinanoh | b81c391 | 2022-09-08 04:13:24 -0400 | [diff] [blame] | 287 | // alignSelf: "flex-end", |
| 288 | }} |
| 289 | > |
| 290 | <Typography variant="caption">Code QR</Typography> |
| 291 | </div> |
| 292 | |
| 293 | <Typography variant="caption">est un swarm </Typography> |
| 294 | </Stack> |
| 295 | |
simon | d47ef9e | 2022-09-28 22:24:28 -0400 | [diff] [blame] | 296 | <Stack direction={'column'}> |
ervinanoh | b81c391 | 2022-09-08 04:13:24 -0400 | [diff] [blame] | 297 | <div |
| 298 | style={{ |
simon | d47ef9e | 2022-09-28 22:24:28 -0400 | [diff] [blame] | 299 | fontWeight: 'bold', |
| 300 | fontSize: '20px', |
| 301 | height: '100px', |
ervinanoh | b81c391 | 2022-09-08 04:13:24 -0400 | [diff] [blame] | 302 | }} |
| 303 | > |
simon | d47ef9e | 2022-09-28 22:24:28 -0400 | [diff] [blame] | 304 | {conversation.getDisplayNameNoFallback() + '(resolved name)'} |
ervinanoh | b81c391 | 2022-09-08 04:13:24 -0400 | [diff] [blame] | 305 | </div> |
| 306 | |
| 307 | <div |
| 308 | style={{ |
simon | d47ef9e | 2022-09-28 22:24:28 -0400 | [diff] [blame] | 309 | height: '40px', |
ervinanoh | b81c391 | 2022-09-08 04:13:24 -0400 | [diff] [blame] | 310 | }} |
| 311 | /> |
| 312 | <Typography variant="caption"> |
simon | d47ef9e | 2022-09-28 22:24:28 -0400 | [diff] [blame] | 313 | <div style={{ fontWeight: 'bold' }}>{conversation.getDisplayNameNoFallback()}</div> |
ervinanoh | b81c391 | 2022-09-08 04:13:24 -0400 | [diff] [blame] | 314 | </Typography> |
| 315 | |
simon | d47ef9e | 2022-09-28 22:24:28 -0400 | [diff] [blame] | 316 | <div style={{ height: '20px' }} /> |
ervinanoh | b81c391 | 2022-09-08 04:13:24 -0400 | [diff] [blame] | 317 | |
| 318 | <Typography variant="caption"> |
simon | d47ef9e | 2022-09-28 22:24:28 -0400 | [diff] [blame] | 319 | <div style={{ fontWeight: 'bold' }}> {userId}</div> |
ervinanoh | b81c391 | 2022-09-08 04:13:24 -0400 | [diff] [blame] | 320 | </Typography> |
| 321 | |
simon | d47ef9e | 2022-09-28 22:24:28 -0400 | [diff] [blame] | 322 | <div style={{ height: '20px' }} /> |
ervinanoh | b81c391 | 2022-09-08 04:13:24 -0400 | [diff] [blame] | 323 | |
simon | d47ef9e | 2022-09-28 22:24:28 -0400 | [diff] [blame] | 324 | <div height={'40px'}> |
ervinanoh | b81c391 | 2022-09-08 04:13:24 -0400 | [diff] [blame] | 325 | <QRCodeCanvas value={`${userId}`} /> |
| 326 | </div> |
| 327 | |
| 328 | <Typography variant="caption"> |
simon | d47ef9e | 2022-09-28 22:24:28 -0400 | [diff] [blame] | 329 | <div style={{ fontWeight: 'bold' }}> {isSwarm}</div> |
ervinanoh | b81c391 | 2022-09-08 04:13:24 -0400 | [diff] [blame] | 330 | </Typography> |
| 331 | </Stack> |
| 332 | </Stack> |
| 333 | <div |
| 334 | onClick={closeModalDetails} |
| 335 | style={{ |
simon | d47ef9e | 2022-09-28 22:24:28 -0400 | [diff] [blame] | 336 | width: '100px', |
| 337 | borderStyle: 'solid', |
| 338 | textAlign: 'center', |
| 339 | borderRadius: '5px', |
| 340 | marginLeft: '150px', |
| 341 | marginTop: '10px', |
ervinanoh | b81c391 | 2022-09-08 04:13:24 -0400 | [diff] [blame] | 342 | }} |
| 343 | > |
| 344 | <Typography variant="caption">Fermer</Typography> |
ervinanoh | 8e91804 | 2022-09-06 10:30:59 -0400 | [diff] [blame] | 345 | </div> |
ervinanoh | b81c391 | 2022-09-08 04:13:24 -0400 | [diff] [blame] | 346 | </Modal> |
| 347 | </div> |
idillon | 531b6f2 | 2022-09-16 14:02:00 -0400 | [diff] [blame] | 348 | |
ervinanoh | b81c391 | 2022-09-08 04:13:24 -0400 | [diff] [blame] | 349 | <div name="Remove or block details"> |
| 350 | <Modal |
| 351 | isOpen={modalDeleteIsOpen} |
| 352 | onRequestClose={closeModalDelete} |
| 353 | style={cancelStyles} |
| 354 | contentLabel="Merci de confirmer" |
idillon | 531b6f2 | 2022-09-16 14:02:00 -0400 | [diff] [blame] | 355 | > |
ervinanoh | b81c391 | 2022-09-08 04:13:24 -0400 | [diff] [blame] | 356 | <Typography variant="h4">Merci de confirmer</Typography> |
simon | d47ef9e | 2022-09-28 22:24:28 -0400 | [diff] [blame] | 357 | <Stack direction={'column'} justifyContent="space-around" spacing={'75px'}> |
| 358 | <div style={{ textAlign: 'center', marginTop: '10%' }}> |
ervinanoh | b81c391 | 2022-09-08 04:13:24 -0400 | [diff] [blame] | 359 | <Typography variant="body2"> |
simon | d47ef9e | 2022-09-28 22:24:28 -0400 | [diff] [blame] | 360 | Voulez vous vraiment {blockOrRemove ? 'bloquer' : 'supprimer'} ce contact? |
ervinanoh | b81c391 | 2022-09-08 04:13:24 -0400 | [diff] [blame] | 361 | </Typography> |
| 362 | </div> |
ervinanoh | 8e91804 | 2022-09-06 10:30:59 -0400 | [diff] [blame] | 363 | |
simon | d47ef9e | 2022-09-28 22:24:28 -0400 | [diff] [blame] | 364 | <Stack direction={'row'} top={'25px'} alignSelf="center" spacing={1}> |
ervinanoh | b81c391 | 2022-09-08 04:13:24 -0400 | [diff] [blame] | 365 | <Box |
| 366 | onClick={() => { |
simon | d47ef9e | 2022-09-28 22:24:28 -0400 | [diff] [blame] | 367 | if (blockOrRemove) removeOrBlock('block'); |
| 368 | else removeOrBlock('remove'); |
ervinanoh | b81c391 | 2022-09-08 04:13:24 -0400 | [diff] [blame] | 369 | }} |
| 370 | style={{ |
simon | d47ef9e | 2022-09-28 22:24:28 -0400 | [diff] [blame] | 371 | width: '100px', |
| 372 | textAlign: 'center', |
| 373 | borderStyle: 'solid', |
| 374 | borderColor: 'red', |
| 375 | borderRadius: '10px', |
| 376 | color: 'red', |
ervinanoh | b81c391 | 2022-09-08 04:13:24 -0400 | [diff] [blame] | 377 | }} |
| 378 | > |
simon | d47ef9e | 2022-09-28 22:24:28 -0400 | [diff] [blame] | 379 | {blockOrRemove ? 'Bloquer' : 'Supprimer'} |
ervinanoh | b81c391 | 2022-09-08 04:13:24 -0400 | [diff] [blame] | 380 | </Box> |
| 381 | <Box |
| 382 | onClick={closeModalDelete} |
| 383 | style={{ |
simon | d47ef9e | 2022-09-28 22:24:28 -0400 | [diff] [blame] | 384 | width: '100px', |
| 385 | textAlign: 'center', |
| 386 | paddingLeft: '12px', |
| 387 | paddingRight: '12px', |
| 388 | borderStyle: 'solid', |
| 389 | borderRadius: '10px', |
ervinanoh | b81c391 | 2022-09-08 04:13:24 -0400 | [diff] [blame] | 390 | }} |
| 391 | > |
| 392 | Annuler |
| 393 | </Box> |
| 394 | </Stack> |
| 395 | </Stack> |
| 396 | </Modal> |
| 397 | </div> |
idillon | 531b6f2 | 2022-09-16 14:02:00 -0400 | [diff] [blame] | 398 | |
| 399 | <ListItem |
| 400 | button |
| 401 | alignItems="flex-start" |
| 402 | selected={isSelected} |
simon | d47ef9e | 2022-09-28 22:24:28 -0400 | [diff] [blame] | 403 | onClick={() => navigate(`/account/${conversation.getAccountId()}/${uri}`)} |
idillon | 531b6f2 | 2022-09-16 14:02:00 -0400 | [diff] [blame] | 404 | > |
| 405 | <ListItemAvatar> |
simon | d47ef9e | 2022-09-28 22:24:28 -0400 | [diff] [blame] | 406 | <ConversationAvatar displayName={conversation.getDisplayNameNoFallback()} /> |
idillon | 531b6f2 | 2022-09-16 14:02:00 -0400 | [diff] [blame] | 407 | </ListItemAvatar> |
simon | d47ef9e | 2022-09-28 22:24:28 -0400 | [diff] [blame] | 408 | <ListItemText primary={conversation.getDisplayName()} secondary={conversation.getDisplayUri()} /> |
idillon | 531b6f2 | 2022-09-16 14:02:00 -0400 | [diff] [blame] | 409 | </ListItem> |
| 410 | </div> |
| 411 | ); |
| 412 | } else return null; |
Adrien Béraud | 995e802 | 2021-04-08 13:46:51 -0400 | [diff] [blame] | 413 | } |