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