simon | 575c940 | 2022-10-25 16:21:40 -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 | */ |
idillon | 9e542ca | 2022-12-15 17:54:07 -0500 | [diff] [blame] | 18 | import { Box, ListItemButton, Stack, Typography } from '@mui/material'; |
| 19 | import dayjs from 'dayjs'; |
idillon | 07d31cc | 2022-12-06 22:40:14 -0500 | [diff] [blame] | 20 | import { IConversationSummary } from 'jami-web-common'; |
simon | 575c940 | 2022-10-25 16:21:40 -0400 | [diff] [blame] | 21 | import { QRCodeCanvas } from 'qrcode.react'; |
simon | 21f7d9f | 2022-11-28 14:21:54 -0500 | [diff] [blame] | 22 | import { useCallback, useContext, useMemo, useState } from 'react'; |
simon | 4e7445c | 2022-11-16 21:18:46 -0500 | [diff] [blame] | 23 | import { useTranslation } from 'react-i18next'; |
simon | 21f7d9f | 2022-11-28 14:21:54 -0500 | [diff] [blame] | 24 | import { useNavigate } from 'react-router-dom'; |
simon | 575c940 | 2022-10-25 16:21:40 -0400 | [diff] [blame] | 25 | |
simon | 5da8ca6 | 2022-11-09 15:21:25 -0500 | [diff] [blame] | 26 | import { useAuthContext } from '../contexts/AuthProvider'; |
simon | e35acc2 | 2022-12-02 16:51:12 -0500 | [diff] [blame] | 27 | import { CallManagerContext } from '../contexts/CallManagerProvider'; |
Michelle Sepkap Sime | c050d9c | 2022-12-05 09:39:34 -0500 | [diff] [blame] | 28 | import { CallStatus, useCallContext } from '../contexts/CallProvider'; |
idillon | 07d31cc | 2022-12-06 22:40:14 -0500 | [diff] [blame] | 29 | import { useUrlParams } from '../hooks/useUrlParams'; |
simon | 575c940 | 2022-10-25 16:21:40 -0400 | [diff] [blame] | 30 | import { setRefreshFromSlice } from '../redux/appSlice'; |
| 31 | import { useAppDispatch } from '../redux/hooks'; |
idillon | 07d31cc | 2022-12-06 22:40:14 -0500 | [diff] [blame] | 32 | import { ConversationRouteParams } from '../router'; |
idillon | 9e542ca | 2022-12-15 17:54:07 -0500 | [diff] [blame] | 33 | import { getMessageCallText, getMessageMemberText } from '../utils/chatmessages'; |
| 34 | import { formatRelativeDate, formatTime } from '../utils/dates×'; |
idillon | ef9ab81 | 2022-11-18 13:46:24 -0500 | [diff] [blame] | 35 | import ContextMenu, { ContextMenuHandler, useContextMenuHandler } from './ContextMenu'; |
simon | 575c940 | 2022-10-25 16:21:40 -0400 | [diff] [blame] | 36 | import ConversationAvatar from './ConversationAvatar'; |
idillon | ef9ab81 | 2022-11-18 13:46:24 -0500 | [diff] [blame] | 37 | import { ConfirmationDialog, DialogContentList, InfosDialog, useDialogHandler } from './Dialog'; |
| 38 | import { PopoverListItemData } from './PopoverList'; |
idillon | 07d31cc | 2022-12-06 22:40:14 -0500 | [diff] [blame] | 39 | import { AudioCallIcon, CancelIcon, MessageIcon, PersonIcon, VideoCallIcon } from './SvgIcon'; |
simon | 575c940 | 2022-10-25 16:21:40 -0400 | [diff] [blame] | 40 | |
simon | 575c940 | 2022-10-25 16:21:40 -0400 | [diff] [blame] | 41 | type ConversationListItemProps = { |
idillon | 07d31cc | 2022-12-06 22:40:14 -0500 | [diff] [blame] | 42 | conversationSummary: IConversationSummary; |
simon | 575c940 | 2022-10-25 16:21:40 -0400 | [diff] [blame] | 43 | }; |
| 44 | |
idillon | 07d31cc | 2022-12-06 22:40:14 -0500 | [diff] [blame] | 45 | export default function ConversationListItem({ conversationSummary }: ConversationListItemProps) { |
idillon | 9e542ca | 2022-12-15 17:54:07 -0500 | [diff] [blame] | 46 | const { account } = useAuthContext(); |
idillon | 07d31cc | 2022-12-06 22:40:14 -0500 | [diff] [blame] | 47 | const { |
| 48 | urlParams: { conversationId: selectedConversationId }, |
| 49 | } = useUrlParams<ConversationRouteParams>(); |
idillon | ef9ab81 | 2022-11-18 13:46:24 -0500 | [diff] [blame] | 50 | const contextMenuHandler = useContextMenuHandler(); |
Michelle Sepkap Sime | c050d9c | 2022-12-05 09:39:34 -0500 | [diff] [blame] | 51 | const callContext = useCallContext(true); |
| 52 | const { callData } = useContext(CallManagerContext); |
idillon | 9e542ca | 2022-12-15 17:54:07 -0500 | [diff] [blame] | 53 | const { t, i18n } = useTranslation(); |
simon | 575c940 | 2022-10-25 16:21:40 -0400 | [diff] [blame] | 54 | const navigate = useNavigate(); |
idillon | 07d31cc | 2022-12-06 22:40:14 -0500 | [diff] [blame] | 55 | |
| 56 | const conversationId = conversationSummary.id; |
| 57 | const isSelected = conversationId === selectedConversationId; |
simon | ff1cb35 | 2022-11-24 15:15:26 -0500 | [diff] [blame] | 58 | |
simon | 21f7d9f | 2022-11-28 14:21:54 -0500 | [diff] [blame] | 59 | const onClick = useCallback(() => { |
idillon | 07d31cc | 2022-12-06 22:40:14 -0500 | [diff] [blame] | 60 | if (conversationId) { |
| 61 | navigate(`/conversation/${conversationId}`); |
simon | 21f7d9f | 2022-11-28 14:21:54 -0500 | [diff] [blame] | 62 | } |
idillon | 07d31cc | 2022-12-06 22:40:14 -0500 | [diff] [blame] | 63 | }, [navigate, conversationId]); |
simon | 21f7d9f | 2022-11-28 14:21:54 -0500 | [diff] [blame] | 64 | |
idillon | 9e542ca | 2022-12-15 17:54:07 -0500 | [diff] [blame] | 65 | const timeIndicator = useMemo(() => { |
| 66 | const message = conversationSummary.lastMessage; |
| 67 | const time = dayjs.unix(Number(message.timestamp)); |
| 68 | if (time.isToday()) { |
| 69 | return formatTime(time, i18n); |
| 70 | } else { |
| 71 | return formatRelativeDate(time, i18n); |
| 72 | } |
| 73 | }, [conversationSummary, i18n]); |
| 74 | |
| 75 | const lastMessageText = useMemo(() => { |
idillon | 07d31cc | 2022-12-06 22:40:14 -0500 | [diff] [blame] | 76 | if (!callContext || !callData || callData.conversationId !== conversationSummary.id) { |
idillon | 9e542ca | 2022-12-15 17:54:07 -0500 | [diff] [blame] | 77 | const message = conversationSummary.lastMessage; |
| 78 | switch (message.type) { |
| 79 | case 'initial': { |
| 80 | return t('message_swarm_created'); |
| 81 | } |
| 82 | case 'application/data-transfer+json': { |
| 83 | return message.fileId; |
| 84 | } |
| 85 | case 'application/call-history+json': { |
| 86 | const isAccountMessage = message.author === account.getUri(); |
| 87 | return getMessageCallText(isAccountMessage, message, i18n); |
| 88 | } |
| 89 | case 'member': { |
| 90 | return getMessageMemberText(message, i18n); |
| 91 | } |
| 92 | case 'text/plain': { |
| 93 | return message.body; |
| 94 | } |
| 95 | default: { |
| 96 | console.error(`${ConversationListItem.name} received an unexpected lastMessage type: ${message.type}`); |
| 97 | return ''; |
| 98 | } |
| 99 | } |
Michelle Sepkap Sime | c050d9c | 2022-12-05 09:39:34 -0500 | [diff] [blame] | 100 | } |
| 101 | |
| 102 | if (callContext.callStatus === CallStatus.InCall) { |
| 103 | return callContext.isAudioOn ? t('ongoing_call_unmuted') : t('ongoing_call_muted'); |
| 104 | } |
| 105 | |
| 106 | if (callContext.callStatus === CallStatus.Connecting) { |
| 107 | return t('connecting_call'); |
| 108 | } |
| 109 | |
| 110 | return callContext.callRole === 'caller' ? t('outgoing_call') : t('incoming_call'); |
idillon | 9e542ca | 2022-12-15 17:54:07 -0500 | [diff] [blame] | 111 | }, [account, conversationSummary, callContext, callData, t, i18n]); |
idillon | 07d31cc | 2022-12-06 22:40:14 -0500 | [diff] [blame] | 112 | |
| 113 | const conversationName = useMemo( |
idillon | 9e542ca | 2022-12-15 17:54:07 -0500 | [diff] [blame] | 114 | () => conversationSummary.title || conversationSummary.membersNames.join(', ') || account.getDisplayName(), |
| 115 | [account, conversationSummary] |
idillon | 07d31cc | 2022-12-06 22:40:14 -0500 | [diff] [blame] | 116 | ); |
Michelle Sepkap Sime | c050d9c | 2022-12-05 09:39:34 -0500 | [diff] [blame] | 117 | |
idillon | ef9ab81 | 2022-11-18 13:46:24 -0500 | [diff] [blame] | 118 | return ( |
idillon | 22ed819 | 2022-11-29 12:17:04 -0500 | [diff] [blame] | 119 | <Box> |
idillon | ef9ab81 | 2022-11-18 13:46:24 -0500 | [diff] [blame] | 120 | <ConversationMenu |
idillon | 07d31cc | 2022-12-06 22:40:14 -0500 | [diff] [blame] | 121 | conversationId={conversationId} |
| 122 | conversationName={conversationName} |
simon | 21f7d9f | 2022-11-28 14:21:54 -0500 | [diff] [blame] | 123 | onMessageClick={onClick} |
idillon | ef9ab81 | 2022-11-18 13:46:24 -0500 | [diff] [blame] | 124 | isSelected={isSelected} |
| 125 | contextMenuProps={contextMenuHandler.props} |
| 126 | /> |
idillon | 9e542ca | 2022-12-15 17:54:07 -0500 | [diff] [blame] | 127 | <ListItemButton alignItems="flex-start" selected={isSelected} onClick={onClick}> |
| 128 | <Stack direction="row" spacing="10px"> |
idillon | 07d31cc | 2022-12-06 22:40:14 -0500 | [diff] [blame] | 129 | <ConversationAvatar displayName={conversationName} /> |
idillon | 9e542ca | 2022-12-15 17:54:07 -0500 | [diff] [blame] | 130 | <Stack> |
| 131 | <Typography variant="body1">{conversationName}</Typography> |
| 132 | <Stack direction="row" spacing="5px"> |
| 133 | <Typography variant="body2" fontWeight={isSelected ? 'bold' : 'normal'}> |
| 134 | {timeIndicator} |
| 135 | </Typography> |
| 136 | <Typography variant="body2">{lastMessageText}</Typography> |
| 137 | </Stack> |
| 138 | </Stack> |
| 139 | </Stack> |
| 140 | </ListItemButton> |
idillon | ef9ab81 | 2022-11-18 13:46:24 -0500 | [diff] [blame] | 141 | </Box> |
| 142 | ); |
| 143 | } |
| 144 | |
| 145 | interface ConversationMenuProps { |
idillon | 07d31cc | 2022-12-06 22:40:14 -0500 | [diff] [blame] | 146 | conversationId: string; |
| 147 | conversationName: string; |
simon | 21f7d9f | 2022-11-28 14:21:54 -0500 | [diff] [blame] | 148 | onMessageClick: () => void; |
idillon | ef9ab81 | 2022-11-18 13:46:24 -0500 | [diff] [blame] | 149 | isSelected: boolean; |
| 150 | contextMenuProps: ContextMenuHandler['props']; |
| 151 | } |
| 152 | |
simon | 21f7d9f | 2022-11-28 14:21:54 -0500 | [diff] [blame] | 153 | const ConversationMenu = ({ |
idillon | 07d31cc | 2022-12-06 22:40:14 -0500 | [diff] [blame] | 154 | conversationId, |
| 155 | conversationName, |
simon | 21f7d9f | 2022-11-28 14:21:54 -0500 | [diff] [blame] | 156 | onMessageClick, |
| 157 | isSelected, |
| 158 | contextMenuProps, |
| 159 | }: ConversationMenuProps) => { |
idillon | ef9ab81 | 2022-11-18 13:46:24 -0500 | [diff] [blame] | 160 | const { t } = useTranslation(); |
simon | e35acc2 | 2022-12-02 16:51:12 -0500 | [diff] [blame] | 161 | const { startCall } = useContext(CallManagerContext); |
simon | 416d079 | 2022-11-03 02:46:18 -0400 | [diff] [blame] | 162 | const [isSwarm] = useState(true); |
simon | 575c940 | 2022-10-25 16:21:40 -0400 | [diff] [blame] | 163 | |
idillon | ef9ab81 | 2022-11-18 13:46:24 -0500 | [diff] [blame] | 164 | const detailsDialogHandler = useDialogHandler(); |
idillon | 07d31cc | 2022-12-06 22:40:14 -0500 | [diff] [blame] | 165 | const RemoveConversationDialogHandler = useDialogHandler(); |
simon | 575c940 | 2022-10-25 16:21:40 -0400 | [diff] [blame] | 166 | |
idillon | ef9ab81 | 2022-11-18 13:46:24 -0500 | [diff] [blame] | 167 | const navigate = useNavigate(); |
| 168 | |
idillon | ef9ab81 | 2022-11-18 13:46:24 -0500 | [diff] [blame] | 169 | const menuOptions: PopoverListItemData[] = useMemo( |
| 170 | () => [ |
| 171 | { |
| 172 | label: t('conversation_message'), |
| 173 | Icon: MessageIcon, |
simon | 21f7d9f | 2022-11-28 14:21:54 -0500 | [diff] [blame] | 174 | onClick: onMessageClick, |
idillon | ef9ab81 | 2022-11-18 13:46:24 -0500 | [diff] [blame] | 175 | }, |
| 176 | { |
| 177 | label: t('conversation_start_audiocall'), |
| 178 | Icon: AudioCallIcon, |
| 179 | onClick: () => { |
simon | ff1cb35 | 2022-11-24 15:15:26 -0500 | [diff] [blame] | 180 | if (conversationId) { |
simon | e35acc2 | 2022-12-02 16:51:12 -0500 | [diff] [blame] | 181 | startCall({ |
| 182 | conversationId, |
| 183 | role: 'caller', |
| 184 | }); |
simon | ff1cb35 | 2022-11-24 15:15:26 -0500 | [diff] [blame] | 185 | } |
idillon | ef9ab81 | 2022-11-18 13:46:24 -0500 | [diff] [blame] | 186 | }, |
| 187 | }, |
| 188 | { |
| 189 | label: t('conversation_start_videocall'), |
| 190 | Icon: VideoCallIcon, |
| 191 | onClick: () => { |
simon | ff1cb35 | 2022-11-24 15:15:26 -0500 | [diff] [blame] | 192 | if (conversationId) { |
simon | e35acc2 | 2022-12-02 16:51:12 -0500 | [diff] [blame] | 193 | startCall({ |
| 194 | conversationId, |
| 195 | role: 'caller', |
| 196 | withVideoOn: true, |
simon | ff1cb35 | 2022-11-24 15:15:26 -0500 | [diff] [blame] | 197 | }); |
| 198 | } |
idillon | ef9ab81 | 2022-11-18 13:46:24 -0500 | [diff] [blame] | 199 | }, |
| 200 | }, |
| 201 | ...(isSelected |
| 202 | ? [ |
| 203 | { |
| 204 | label: t('conversation_close'), |
| 205 | Icon: CancelIcon, |
| 206 | onClick: () => { |
| 207 | navigate(`/`); |
| 208 | }, |
| 209 | }, |
| 210 | ] |
| 211 | : []), |
| 212 | { |
| 213 | label: t('conversation_details'), |
idillon | 07d31cc | 2022-12-06 22:40:14 -0500 | [diff] [blame] | 214 | Icon: PersonIcon, |
idillon | ef9ab81 | 2022-11-18 13:46:24 -0500 | [diff] [blame] | 215 | onClick: () => { |
| 216 | detailsDialogHandler.openDialog(); |
idillon | ef9ab81 | 2022-11-18 13:46:24 -0500 | [diff] [blame] | 217 | }, |
| 218 | }, |
| 219 | { |
| 220 | label: t('conversation_delete'), |
idillon | 07d31cc | 2022-12-06 22:40:14 -0500 | [diff] [blame] | 221 | Icon: CancelIcon, |
idillon | ef9ab81 | 2022-11-18 13:46:24 -0500 | [diff] [blame] | 222 | onClick: () => { |
idillon | 07d31cc | 2022-12-06 22:40:14 -0500 | [diff] [blame] | 223 | RemoveConversationDialogHandler.openDialog(); |
idillon | ef9ab81 | 2022-11-18 13:46:24 -0500 | [diff] [blame] | 224 | }, |
| 225 | }, |
| 226 | ], |
| 227 | [ |
idillon | ef9ab81 | 2022-11-18 13:46:24 -0500 | [diff] [blame] | 228 | navigate, |
simon | 21f7d9f | 2022-11-28 14:21:54 -0500 | [diff] [blame] | 229 | onMessageClick, |
idillon | ef9ab81 | 2022-11-18 13:46:24 -0500 | [diff] [blame] | 230 | isSelected, |
idillon | ef9ab81 | 2022-11-18 13:46:24 -0500 | [diff] [blame] | 231 | detailsDialogHandler, |
idillon | 07d31cc | 2022-12-06 22:40:14 -0500 | [diff] [blame] | 232 | RemoveConversationDialogHandler, |
idillon | ef9ab81 | 2022-11-18 13:46:24 -0500 | [diff] [blame] | 233 | t, |
simon | ff1cb35 | 2022-11-24 15:15:26 -0500 | [diff] [blame] | 234 | startCall, |
| 235 | conversationId, |
idillon | ef9ab81 | 2022-11-18 13:46:24 -0500 | [diff] [blame] | 236 | ] |
| 237 | ); |
simon | 575c940 | 2022-10-25 16:21:40 -0400 | [diff] [blame] | 238 | |
idillon | ef9ab81 | 2022-11-18 13:46:24 -0500 | [diff] [blame] | 239 | return ( |
| 240 | <> |
| 241 | <ContextMenu {...contextMenuProps} items={menuOptions} /> |
| 242 | |
idillon | 07d31cc | 2022-12-06 22:40:14 -0500 | [diff] [blame] | 243 | <DetailsDialog |
| 244 | {...detailsDialogHandler.props} |
| 245 | conversationId={conversationId} |
| 246 | conversationName={conversationName} |
| 247 | isSwarm={isSwarm} |
| 248 | /> |
idillon | ef9ab81 | 2022-11-18 13:46:24 -0500 | [diff] [blame] | 249 | |
idillon | 07d31cc | 2022-12-06 22:40:14 -0500 | [diff] [blame] | 250 | <RemoveConversationDialog {...RemoveConversationDialogHandler.props} conversationId={conversationId} /> |
idillon | ef9ab81 | 2022-11-18 13:46:24 -0500 | [diff] [blame] | 251 | </> |
| 252 | ); |
| 253 | }; |
| 254 | |
| 255 | interface DetailsDialogProps { |
idillon | 07d31cc | 2022-12-06 22:40:14 -0500 | [diff] [blame] | 256 | conversationId: string; |
| 257 | conversationName: string; |
idillon | ef9ab81 | 2022-11-18 13:46:24 -0500 | [diff] [blame] | 258 | open: boolean; |
| 259 | onClose: () => void; |
| 260 | isSwarm: boolean; |
| 261 | } |
| 262 | |
idillon | 07d31cc | 2022-12-06 22:40:14 -0500 | [diff] [blame] | 263 | const DetailsDialog = ({ conversationId, conversationName, open, onClose, isSwarm }: DetailsDialogProps) => { |
idillon | ef9ab81 | 2022-11-18 13:46:24 -0500 | [diff] [blame] | 264 | const { t } = useTranslation(); |
| 265 | const items = useMemo( |
| 266 | () => [ |
| 267 | { |
idillon | 07d31cc | 2022-12-06 22:40:14 -0500 | [diff] [blame] | 268 | label: t('conversation_details_name'), |
| 269 | value: conversationName, |
idillon | ef9ab81 | 2022-11-18 13:46:24 -0500 | [diff] [blame] | 270 | }, |
| 271 | { |
| 272 | label: t('conversation_details_identifier'), |
idillon | 07d31cc | 2022-12-06 22:40:14 -0500 | [diff] [blame] | 273 | value: conversationId, |
idillon | ef9ab81 | 2022-11-18 13:46:24 -0500 | [diff] [blame] | 274 | }, |
| 275 | { |
| 276 | label: t('conversation_details_qr_code'), |
idillon | 07d31cc | 2022-12-06 22:40:14 -0500 | [diff] [blame] | 277 | value: <QRCodeCanvas size={80} value={`${conversationId}`} />, |
idillon | ef9ab81 | 2022-11-18 13:46:24 -0500 | [diff] [blame] | 278 | }, |
| 279 | { |
| 280 | label: t('conversation_details_is_swarm'), |
| 281 | value: isSwarm ? t('conversation_details_is_swarm_true') : t('conversation_details_is_swarm_false'), |
| 282 | }, |
| 283 | ], |
idillon | 07d31cc | 2022-12-06 22:40:14 -0500 | [diff] [blame] | 284 | [conversationId, conversationName, isSwarm, t] |
idillon | ef9ab81 | 2022-11-18 13:46:24 -0500 | [diff] [blame] | 285 | ); |
| 286 | return ( |
| 287 | <InfosDialog |
| 288 | open={open} |
| 289 | onClose={onClose} |
idillon | 07d31cc | 2022-12-06 22:40:14 -0500 | [diff] [blame] | 290 | icon={<ConversationAvatar sx={{ width: 'inherit', height: 'inherit' }} displayName={conversationName} />} |
| 291 | title={conversationName} |
idillon | ef9ab81 | 2022-11-18 13:46:24 -0500 | [diff] [blame] | 292 | content={<DialogContentList title={t('conversation_details_informations')} items={items} />} |
| 293 | /> |
| 294 | ); |
| 295 | }; |
| 296 | |
idillon | 07d31cc | 2022-12-06 22:40:14 -0500 | [diff] [blame] | 297 | interface RemoveConversationDialogProps { |
| 298 | conversationId: string; |
idillon | ef9ab81 | 2022-11-18 13:46:24 -0500 | [diff] [blame] | 299 | open: boolean; |
| 300 | onClose: () => void; |
| 301 | } |
| 302 | |
idillon | 07d31cc | 2022-12-06 22:40:14 -0500 | [diff] [blame] | 303 | const RemoveConversationDialog = ({ conversationId, open, onClose }: RemoveConversationDialogProps) => { |
idillon | ef9ab81 | 2022-11-18 13:46:24 -0500 | [diff] [blame] | 304 | const { axiosInstance } = useAuthContext(); |
| 305 | const { t } = useTranslation(); |
| 306 | const dispatch = useAppDispatch(); |
| 307 | |
| 308 | const remove = async () => { |
| 309 | const controller = new AbortController(); |
| 310 | try { |
idillon | 07d31cc | 2022-12-06 22:40:14 -0500 | [diff] [blame] | 311 | await axiosInstance.delete(`/conversations/${conversationId}`, { |
idillon | ef9ab81 | 2022-11-18 13:46:24 -0500 | [diff] [blame] | 312 | signal: controller.signal, |
| 313 | }); |
| 314 | dispatch(setRefreshFromSlice()); |
| 315 | } catch (e) { |
idillon | 07d31cc | 2022-12-06 22:40:14 -0500 | [diff] [blame] | 316 | console.error(`Error removing conversation : `, e); |
idillon | ef9ab81 | 2022-11-18 13:46:24 -0500 | [diff] [blame] | 317 | dispatch(setRefreshFromSlice()); |
| 318 | } |
| 319 | onClose(); |
| 320 | }; |
| 321 | |
| 322 | return ( |
| 323 | <ConfirmationDialog |
| 324 | open={open} |
| 325 | onClose={onClose} |
| 326 | title={t('dialog_confirm_title_default')} |
| 327 | content={t('conversation_ask_confirm_remove')} |
| 328 | onConfirm={remove} |
| 329 | confirmButtonText={t('conversation_confirm_remove')} |
| 330 | /> |
| 331 | ); |
| 332 | }; |