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