quickblox-react-ui-kit 0.2.3 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -2
- package/dist/CommonTypes/FunctionResult.d.ts +5 -1
- package/dist/Data/DefaultConfigurations.d.ts +2 -2
- package/dist/Data/repository/DialogsRepository.d.ts +1 -0
- package/dist/Data/repository/EventMessagesRepository.d.ts +1 -0
- package/dist/Data/repository/MessagesRepository.d.ts +2 -2
- package/dist/Domain/entity/NotificationTypes.d.ts +1 -0
- package/dist/Domain/repository/IDialogsRepository.d.ts +1 -0
- package/dist/Domain/repository/IMessagesRepository.d.ts +2 -2
- package/dist/Domain/use_cases/CreateDialogUseCase.d.ts +2 -1
- package/dist/Domain/use_cases/LeaveDialogUseCase.d.ts +2 -1
- package/dist/Domain/use_cases/RemoveUsersFromTheDialogUseCase.d.ts +2 -1
- package/dist/Domain/use_cases/SubscribeToDialogEventsUseCase.d.ts +1 -0
- package/dist/Domain/use_cases/UpdateDialogUseCase.d.ts +2 -1
- package/dist/Domain/use_cases/ai/AIAnswerAssistUseCase.d.ts +13 -0
- package/dist/Domain/use_cases/ai/AIAnswerAssistWithProxyUseCase.d.ts +13 -0
- package/dist/Domain/use_cases/ai/AITranslateUseCase.d.ts +14 -0
- package/dist/Domain/use_cases/ai/AITranslateWithProxyUseCase.d.ts +14 -0
- package/dist/Presentation/Views/Base/BaseViewModel.d.ts +3 -0
- package/dist/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/AIMessageWidget.d.ts +4 -1
- package/dist/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/AIWidgetActions/AIWidgetActions.d.ts +3 -2
- package/dist/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/Tone.d.ts +5 -13
- package/dist/Presentation/components/UI/Dialogs/MessagesView/DefaultAttachmentComponent/DefaultAttachmentComponent.d.ts +8 -0
- package/dist/Presentation/components/UI/Dialogs/MessagesView/ErrorToast/ErrorToast.d.ts +7 -0
- package/dist/Presentation/components/UI/Dialogs/MessagesView/InComingMessage/AvatarContentIncomingUser/AvatarContentIncomingUser.d.ts +3 -0
- package/dist/Presentation/components/UI/Dialogs/MessagesView/InComingMessage/InComingMessage.d.ts +12 -3
- package/dist/Presentation/components/UI/Dialogs/MessagesView/MessagesView.d.ts +10 -0
- package/dist/Presentation/components/UI/Dialogs/MessagesView/MessagesViewModel.d.ts +2 -2
- package/dist/Presentation/components/UI/Dialogs/MessagesView/SystemDateBanner/SystemDateBanner.d.ts +7 -0
- package/dist/Presentation/components/UI/Dialogs/MessagesView/SystemMessageBanner/SystemMessageBanner.d.ts +7 -0
- package/dist/Presentation/components/UI/Dialogs/PreviewDialog/PreviewAudioFile/PreviewAudioFile.d.ts +7 -0
- package/dist/Presentation/components/UI/Dialogs/PreviewDialog/PreviewDefaultFile/PreviewDefaultFile.d.ts +7 -0
- package/dist/Presentation/components/UI/Dialogs/PreviewDialog/PreviewImageFile/PreviewImageFile.d.ts +8 -0
- package/dist/Presentation/components/UI/Dialogs/PreviewDialog/PreviewVideoFile/PreviewVideoFile.d.ts +7 -0
- package/dist/Presentation/components/UI/svgs/Icons/AIWidgets/BotIcon/BotIcon.d.ts +4 -0
- package/dist/QBconfig.d.ts +14 -3
- package/dist/index-ui.d.ts +5 -1
- package/dist/index-ui.js +410 -61
- package/dist/utils/utils.d.ts +9 -0
- package/global.d.ts +12 -4
- package/package.json +5 -1
- package/src/App.tsx +1 -1
- package/src/CommonTypes/FunctionResult.ts +6 -1
- package/src/Data/DefaultConfigurations.ts +155 -19
- package/src/Data/repository/DialogsRepository.ts +4 -0
- package/src/Data/repository/EventMessagesRepository.ts +34 -0
- package/src/Data/repository/MessagesRepository.ts +16 -10
- package/src/Data/source/exception/MapperDTOException.ts +3 -0
- package/src/Data/source/remote/RemoteDataSource.ts +134 -112
- package/src/Domain/entity/NotificationTypes.ts +2 -0
- package/src/Domain/repository/IDialogsRepository.ts +2 -0
- package/src/Domain/repository/IMessagesRepository.ts +2 -2
- package/src/Domain/use_cases/CreateDialogUseCase.ts +8 -1
- package/src/Domain/use_cases/GetAllDialogsUseCaseWithMock.ts +1 -0
- package/src/Domain/use_cases/LeaveDialogUseCase.ts +8 -1
- package/src/Domain/use_cases/RemoveUsersFromTheDialogUseCase.ts +40 -17
- package/src/Domain/use_cases/SendTextMessageUseCase.ts +3 -2
- package/src/Domain/use_cases/SubscribeToDialogEventsUseCase.ts +21 -0
- package/src/Domain/use_cases/UpdateDialogUseCase.ts +8 -1
- package/src/Domain/use_cases/ai/AIAnswerAssistUseCase.ts +69 -0
- package/src/Domain/use_cases/ai/AIAnswerAssistWithProxyUseCase.ts +71 -0
- package/src/Domain/use_cases/ai/AIRephraseUseCase.ts +38 -36
- package/src/Domain/use_cases/ai/AIRephraseWithProxyUseCase.ts +25 -21
- package/src/Domain/use_cases/ai/AITranslateUseCase.ts +76 -0
- package/src/Domain/use_cases/ai/AITranslateWithProxyUseCase.ts +79 -0
- package/src/Domain/use_cases/base/Subscribable/SubscriptionPerformer.ts +7 -10
- package/src/Presentation/Views/Base/BaseViewModel.ts +3 -0
- package/src/Presentation/Views/Dialogs/Dialogs.scss +3 -0
- package/src/Presentation/Views/Dialogs/Dialogs.tsx +1 -1
- package/src/Presentation/Views/Dialogs/useDialogsViewModel.ts +109 -48
- package/src/Presentation/assets/styles/_variables.scss +19 -0
- package/src/Presentation/components/UI/Buttons/MainButton/MainButton.scss +9 -0
- package/src/Presentation/components/UI/Dialogs/EditDialog/EditDialog.scss +3 -0
- package/src/Presentation/components/UI/Dialogs/InviteMembers/InviteMembers.scss +3 -0
- package/src/Presentation/components/UI/Dialogs/MembersList/MembersList.scss +3 -0
- package/src/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/AIMessageWidget.ts +7 -2
- package/src/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/AIWidgetActions/AIWidgetActions.tsx +10 -4
- package/src/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/Tone.ts +29 -15
- package/src/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/UseDefaultAIAssistAnswerWidget.tsx +10 -6
- package/src/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/UseDefaultAIAssistAnswerWidgetWithProxy.tsx +10 -6
- package/src/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/UseDefaultAIRephraseMessageWidget.tsx +17 -0
- package/src/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/UseDefaultAIRephraseMessageWidgetWithProxy.tsx +16 -0
- package/src/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/UseDefaultAITranslateWidget.tsx +13 -12
- package/src/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/UseDefaultAITranslateWidgetWithProxy.tsx +13 -12
- package/src/Presentation/components/UI/Dialogs/MessagesView/AudioAttachmentComponent/AudioAttachmentComponent.tsx +1 -1
- package/src/Presentation/components/UI/Dialogs/MessagesView/DefaultAttachmentComponent/DefaultAttachmentComponent.scss +76 -0
- package/src/Presentation/components/UI/Dialogs/MessagesView/DefaultAttachmentComponent/DefaultAttachmentComponent.tsx +40 -0
- package/src/Presentation/components/UI/Dialogs/MessagesView/ErrorToast/ErrorToast.scss +26 -0
- package/src/Presentation/components/UI/Dialogs/MessagesView/ErrorToast/ErrorToast.tsx +25 -0
- package/src/Presentation/components/UI/Dialogs/MessagesView/ImageAttachmentComponent/ImageAttachmentComponent.tsx +8 -6
- package/src/Presentation/components/UI/Dialogs/MessagesView/InComingMessage/AvatarContentIncomingUser/AvatarContentIncomingUser.tsx +6 -0
- package/src/Presentation/components/UI/Dialogs/MessagesView/InComingMessage/InComingMessage.scss +5 -7
- package/src/Presentation/components/UI/Dialogs/MessagesView/InComingMessage/InComingMessage.tsx +138 -405
- package/src/Presentation/components/UI/Dialogs/MessagesView/MessagesView.scss +14 -26
- package/src/Presentation/components/UI/Dialogs/MessagesView/MessagesView.tsx +658 -429
- package/src/Presentation/components/UI/Dialogs/MessagesView/MessagesViewModel.ts +2 -2
- package/src/Presentation/components/UI/Dialogs/MessagesView/OutGoingMessage/OutGoingMessage.tsx +1 -1
- package/src/Presentation/components/UI/Dialogs/MessagesView/SystemDateBanner/SystemDateBanner.scss +23 -0
- package/src/Presentation/components/UI/Dialogs/MessagesView/SystemDateBanner/SystemDateBanner.tsx +17 -0
- package/src/Presentation/components/UI/Dialogs/MessagesView/SystemMessageBanner/SystemMessageBanner.scss +21 -0
- package/src/Presentation/components/UI/Dialogs/MessagesView/SystemMessageBanner/SystemMessageBanner.tsx +17 -0
- package/src/Presentation/components/UI/Dialogs/MessagesView/useMessagesViewModel.ts +124 -83
- package/src/Presentation/components/UI/Dialogs/PreviewDialog/PreviewAudioFile/PreviewAudioFile.scss +62 -0
- package/src/Presentation/components/UI/Dialogs/PreviewDialog/PreviewAudioFile/PreviewAudioFile.tsx +25 -0
- package/src/Presentation/components/UI/Dialogs/PreviewDialog/PreviewDefaultFile/PreviewDefaultFile.scss +61 -0
- package/src/Presentation/components/UI/Dialogs/PreviewDialog/PreviewDefaultFile/PreviewDefaultFile.tsx +32 -0
- package/src/Presentation/components/UI/Dialogs/PreviewDialog/PreviewDialog.scss +29 -3
- package/src/Presentation/components/UI/Dialogs/PreviewDialog/PreviewDialog.tsx +55 -4
- package/src/Presentation/components/UI/Dialogs/PreviewDialog/PreviewImageFile/PreviewImageFile.scss +40 -0
- package/src/Presentation/components/UI/Dialogs/PreviewDialog/PreviewImageFile/PreviewImageFile.tsx +26 -0
- package/src/Presentation/components/UI/Dialogs/PreviewDialog/PreviewVideoFile/PreviewVideoFile.scss +62 -0
- package/src/Presentation/components/UI/Dialogs/PreviewDialog/PreviewVideoFile/PreviewVideoFile.tsx +25 -0
- package/src/Presentation/components/UI/svgs/Icons/AIWidgets/BotIcon/BotIcon.svg +5 -0
- package/src/Presentation/components/UI/svgs/Icons/AIWidgets/BotIcon/BotIcon.tsx +50 -0
- package/src/Presentation/components/layouts/Desktop/QuickBloxUIKitDesktopLayout.tsx +3 -15
- package/src/Presentation/components/providers/QuickBloxUIKitProvider/useQbInitializedDataContext.ts +15 -14
- package/src/QBconfig.ts +156 -10
- package/src/index-ui.ts +8 -1
- package/src/index.scss +0 -1
- package/src/package_artan_react_ui.json +13 -9
- package/src/package_original.json +5 -1
- package/src/utils/utils.ts +63 -0
- package/src/Presentation/assets/styles/_reset-styles.scss +0 -435
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import BaseViewModel, {
|
|
2
|
-
|
|
2
|
+
FunctionTypeFileToToBoolean,
|
|
3
3
|
FunctionTypePaginationToVoid,
|
|
4
4
|
FunctionTypeStringToVoid,
|
|
5
5
|
FunctionTypeVoidToVoid,
|
|
@@ -13,7 +13,7 @@ export interface MessagesViewModel extends BaseViewModel<DialogEntity> {
|
|
|
13
13
|
messages: MessageEntity[]; // content
|
|
14
14
|
getMessages: FunctionTypePaginationToVoid; // prepareContent
|
|
15
15
|
sendTextMessage: FunctionTypeStringToVoid;
|
|
16
|
-
sendAttachmentMessage:
|
|
16
|
+
sendAttachmentMessage: FunctionTypeFileToToBoolean;
|
|
17
17
|
release: FunctionTypeVoidToVoid; // release Content
|
|
18
18
|
sendTypingTextMessage: FunctionTypeVoidToVoid; //
|
|
19
19
|
typingText: string;
|
package/src/Presentation/components/UI/Dialogs/MessagesView/SystemDateBanner/SystemDateBanner.scss
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
.system-date-banner-chat-banner,
|
|
2
|
+
.system-date-banner-chat-banner * {
|
|
3
|
+
box-sizing: border-box;
|
|
4
|
+
}
|
|
5
|
+
.system-date-banner-chat-banner {
|
|
6
|
+
background: var(--incoming-background);
|
|
7
|
+
border-radius: 30px;
|
|
8
|
+
padding: 2px 8px 2px 8px;
|
|
9
|
+
display: flex;
|
|
10
|
+
flex-direction: row;
|
|
11
|
+
gap: 10px;
|
|
12
|
+
align-items: center;
|
|
13
|
+
justify-content: center;
|
|
14
|
+
flex-shrink: 0;
|
|
15
|
+
position: relative;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.system-date-this-chat {
|
|
19
|
+
color: var(--secondary-text);
|
|
20
|
+
text-align: center;
|
|
21
|
+
font: var(--label-label-small, 500 11px/16px "Roboto", sans-serif);
|
|
22
|
+
position: relative;
|
|
23
|
+
}
|
package/src/Presentation/components/UI/Dialogs/MessagesView/SystemDateBanner/SystemDateBanner.tsx
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './SystemDateBanner.scss';
|
|
3
|
+
|
|
4
|
+
type SystemDateBannerProps = {
|
|
5
|
+
text: string;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
// eslint-disable-next-line react/function-component-definition
|
|
9
|
+
export const SystemDateBanner: React.FC<SystemDateBannerProps> = ({
|
|
10
|
+
text,
|
|
11
|
+
}: SystemDateBannerProps) => {
|
|
12
|
+
return (
|
|
13
|
+
<div className="system-date-banner-chat-banner">
|
|
14
|
+
<div className="system-date-this-chat">{text}</div>
|
|
15
|
+
</div>
|
|
16
|
+
);
|
|
17
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
.system-message-chat-banner,
|
|
2
|
+
.system-message-chat-banner * {
|
|
3
|
+
box-sizing: border-box;
|
|
4
|
+
}
|
|
5
|
+
.system-message-chat-banner {
|
|
6
|
+
padding: 2px 8px 2px 8px;
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-direction: row;
|
|
9
|
+
gap: 10px;
|
|
10
|
+
align-items: center;
|
|
11
|
+
justify-content: center;
|
|
12
|
+
flex-shrink: 0;
|
|
13
|
+
width: 328px;
|
|
14
|
+
position: relative;
|
|
15
|
+
}
|
|
16
|
+
.username-join-this-chat {
|
|
17
|
+
color: var(--secondary-text);
|
|
18
|
+
text-align: center;
|
|
19
|
+
font: var(--label-label-small, 500 11px/16px "Roboto", sans-serif);
|
|
20
|
+
position: relative;
|
|
21
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './SystemMessageBanner.scss';
|
|
3
|
+
|
|
4
|
+
type SystemMessageBannerProps = {
|
|
5
|
+
messageText: string;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
// eslint-disable-next-line react/function-component-definition
|
|
9
|
+
export const SystemMessageBanner: React.FC<SystemMessageBannerProps> = ({
|
|
10
|
+
messageText,
|
|
11
|
+
}: SystemMessageBannerProps) => {
|
|
12
|
+
return (
|
|
13
|
+
<div className="system-message-chat-banner">
|
|
14
|
+
<div className="username-join-this-chat">{messageText}</div>
|
|
15
|
+
</div>
|
|
16
|
+
);
|
|
17
|
+
};
|
|
@@ -161,32 +161,33 @@ export default function useMessagesViewModel(
|
|
|
161
161
|
console.log('EXECUTE USE CASE MessagesViewModelWithMockUseCase EXECUTED');
|
|
162
162
|
}
|
|
163
163
|
|
|
164
|
-
const
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
[sender_id],
|
|
173
|
-
);
|
|
164
|
+
const getSender = async (sender_id: number) => {
|
|
165
|
+
const getUser: GetUsersByIdsUseCase = new GetUsersByIdsUseCase(
|
|
166
|
+
new UsersRepository(
|
|
167
|
+
currentContext.storage.LOCAL_DATA_SOURCE,
|
|
168
|
+
currentContext.storage.REMOTE_DATA_SOURCE,
|
|
169
|
+
),
|
|
170
|
+
[sender_id],
|
|
171
|
+
);
|
|
174
172
|
|
|
175
|
-
|
|
173
|
+
let userEntity: UserEntity | undefined;
|
|
176
174
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
175
|
+
await getUser
|
|
176
|
+
.execute()
|
|
177
|
+
// eslint-disable-next-line promise/always-return
|
|
178
|
+
.then((data) => {
|
|
179
|
+
// eslint-disable-next-line prefer-destructuring
|
|
180
|
+
userEntity = data[0];
|
|
181
|
+
})
|
|
182
|
+
.catch((e) => {
|
|
183
|
+
console.log('have ERROR get users :', JSON.stringify(e));
|
|
184
|
+
});
|
|
187
185
|
|
|
188
|
-
|
|
189
|
-
|
|
186
|
+
return userEntity;
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
const dialogUpdateHandler = (dialogInfo: DialogEventInfo) => {
|
|
190
|
+
console.log('call dialogUpdateHandler in useMessagesViewModel');
|
|
190
191
|
|
|
191
192
|
if (dialogInfo.eventMessageType === EventMessageType.LocalMessage) {
|
|
192
193
|
if (dialogInfo.messageStatus) {
|
|
@@ -233,9 +234,20 @@ export default function useMessagesViewModel(
|
|
|
233
234
|
})
|
|
234
235
|
.finally(() => {
|
|
235
236
|
setMessages((prevState) => {
|
|
236
|
-
|
|
237
|
+
let newState = [...prevState];
|
|
238
|
+
|
|
239
|
+
if (newState.find((it) => it.id === messageId)) {
|
|
240
|
+
newState = newState.map((elem) => {
|
|
241
|
+
const v: MessageEntity = {
|
|
242
|
+
...elem,
|
|
243
|
+
delivered_ids: ResultMessage.delivered_ids,
|
|
244
|
+
};
|
|
237
245
|
|
|
238
|
-
|
|
246
|
+
return v;
|
|
247
|
+
});
|
|
248
|
+
} else {
|
|
249
|
+
newState.push(ResultMessage);
|
|
250
|
+
}
|
|
239
251
|
|
|
240
252
|
return newState;
|
|
241
253
|
});
|
|
@@ -311,7 +323,7 @@ export default function useMessagesViewModel(
|
|
|
311
323
|
fileEntity.uid = '';
|
|
312
324
|
fileEntity.name = file.name;
|
|
313
325
|
fileEntity.size = file.size;
|
|
314
|
-
fileEntity.type = file.type;
|
|
326
|
+
fileEntity.type = file.type || 'application/zip';
|
|
315
327
|
const uploadFileUseCase: UploadFileUseCase = new UploadFileUseCase(
|
|
316
328
|
new FileRepository(
|
|
317
329
|
currentContext.storage.LOCAL_DATA_SOURCE,
|
|
@@ -343,6 +355,27 @@ export default function useMessagesViewModel(
|
|
|
343
355
|
// eslint-disable-next-line promise/catch-or-return
|
|
344
356
|
sendTextMessageUseCase
|
|
345
357
|
.execute()
|
|
358
|
+
// eslint-disable-next-line promise/always-return
|
|
359
|
+
.then((me) => {
|
|
360
|
+
//
|
|
361
|
+
// eslint-disable-next-line promise/catch-or-return
|
|
362
|
+
getSender(me.sender_id)
|
|
363
|
+
// eslint-disable-next-line promise/always-return
|
|
364
|
+
.then((user) => {
|
|
365
|
+
// eslint-disable-next-line no-param-reassign
|
|
366
|
+
me.sender = user;
|
|
367
|
+
})
|
|
368
|
+
.finally(() => {
|
|
369
|
+
setMessages((prevState) => {
|
|
370
|
+
const newState = [...prevState];
|
|
371
|
+
|
|
372
|
+
newState.push(me);
|
|
373
|
+
|
|
374
|
+
return newState;
|
|
375
|
+
});
|
|
376
|
+
});
|
|
377
|
+
//
|
|
378
|
+
})
|
|
346
379
|
.catch((reason) => {
|
|
347
380
|
const errorMessage: string = stringifyError(reason);
|
|
348
381
|
|
|
@@ -388,70 +421,78 @@ export default function useMessagesViewModel(
|
|
|
388
421
|
};
|
|
389
422
|
|
|
390
423
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
391
|
-
const sendAttachmentMessage = (newMessage: File) => {
|
|
424
|
+
const sendAttachmentMessage = async (newMessage: File): Promise<boolean> => {
|
|
392
425
|
console.log('call sendTextMessage');
|
|
393
426
|
setLoading(true);
|
|
394
427
|
const currentUserId =
|
|
395
428
|
currentContext.storage.REMOTE_DATA_SOURCE.authInformation?.userId || 0;
|
|
396
429
|
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
.then((fileMessage: FileEntity) => {
|
|
400
|
-
console.log(JSON.stringify(fileMessage));
|
|
401
|
-
// '[attachment]'
|
|
402
|
-
const recipientId =
|
|
403
|
-
dialog.type === DialogType.private
|
|
404
|
-
? (dialog as PrivateDialogEntity).participantId
|
|
405
|
-
: currentUserId;
|
|
406
|
-
|
|
430
|
+
try {
|
|
431
|
+
await uploadFile(newMessage)
|
|
407
432
|
// eslint-disable-next-line promise/always-return
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
Stubs.createMessageEntityWithParams(
|
|
411
|
-
'',
|
|
412
|
-
dialog.id,
|
|
413
|
-
messageBody,
|
|
414
|
-
Date.now().toString(),
|
|
415
|
-
Date.now(),
|
|
416
|
-
Date.now().toString(),
|
|
417
|
-
[],
|
|
418
|
-
[],
|
|
419
|
-
1,
|
|
420
|
-
currentUserId,
|
|
421
|
-
// eslint-disable-next-line promise/always-return
|
|
422
|
-
recipientId,
|
|
423
|
-
[],
|
|
424
|
-
'',
|
|
425
|
-
DialogType.group,
|
|
426
|
-
);
|
|
427
|
-
|
|
428
|
-
messageToSend.dialogType = dialog.type;
|
|
429
|
-
const attachments: ChatMessageAttachmentEntity[] = [
|
|
430
|
-
{
|
|
431
|
-
id: fileMessage.id as string,
|
|
432
|
-
uid: fileMessage.uid,
|
|
433
|
-
type: fileMessage.type!,
|
|
434
|
-
file: fileMessage,
|
|
435
|
-
name: fileMessage.name,
|
|
436
|
-
size: fileMessage.size,
|
|
437
|
-
url: fileMessage.url,
|
|
438
|
-
},
|
|
439
|
-
];
|
|
440
|
-
|
|
441
|
-
messageToSend.attachments = attachments;
|
|
442
|
-
|
|
443
|
-
messageToSend.message = `MediaContentEntity|${messageBody}|${
|
|
444
|
-
fileMessage.uid
|
|
445
|
-
}|${fileMessage.type!.toString()}`;
|
|
446
|
-
sendMessage(messageToSend);
|
|
447
|
-
//
|
|
448
|
-
})
|
|
449
|
-
.catch((reason) => {
|
|
450
|
-
const errorMessage = stringifyError(reason);
|
|
433
|
+
.then((fileMessage: FileEntity) => {
|
|
434
|
+
console.log(JSON.stringify(fileMessage));
|
|
451
435
|
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
436
|
+
const recipientId =
|
|
437
|
+
dialog.type === DialogType.private
|
|
438
|
+
? (dialog as PrivateDialogEntity).participantId
|
|
439
|
+
: currentUserId;
|
|
440
|
+
|
|
441
|
+
// eslint-disable-next-line promise/always-return
|
|
442
|
+
const messageBody = fileMessage.name || '[attachment]';
|
|
443
|
+
const messageToSend: MessageEntity =
|
|
444
|
+
Stubs.createMessageEntityWithParams(
|
|
445
|
+
'',
|
|
446
|
+
dialog.id,
|
|
447
|
+
messageBody,
|
|
448
|
+
Date.now().toString(),
|
|
449
|
+
Date.now(),
|
|
450
|
+
Date.now().toString(),
|
|
451
|
+
[],
|
|
452
|
+
[],
|
|
453
|
+
1,
|
|
454
|
+
currentUserId,
|
|
455
|
+
// eslint-disable-next-line promise/always-return
|
|
456
|
+
recipientId,
|
|
457
|
+
[],
|
|
458
|
+
'',
|
|
459
|
+
DialogType.group,
|
|
460
|
+
);
|
|
461
|
+
|
|
462
|
+
messageToSend.dialogType = dialog.type;
|
|
463
|
+
const attachments: ChatMessageAttachmentEntity[] = [
|
|
464
|
+
{
|
|
465
|
+
id: fileMessage.id as string,
|
|
466
|
+
uid: fileMessage.uid,
|
|
467
|
+
type: fileMessage.type!,
|
|
468
|
+
file: fileMessage,
|
|
469
|
+
name: fileMessage.name,
|
|
470
|
+
size: fileMessage.size,
|
|
471
|
+
url: fileMessage.url,
|
|
472
|
+
},
|
|
473
|
+
];
|
|
474
|
+
|
|
475
|
+
messageToSend.attachments = attachments;
|
|
476
|
+
|
|
477
|
+
messageToSend.message = `MediaContentEntity|${messageBody}|${
|
|
478
|
+
fileMessage.uid
|
|
479
|
+
}|${fileMessage.type!.toString()}`;
|
|
480
|
+
sendMessage(messageToSend);
|
|
481
|
+
//
|
|
482
|
+
})
|
|
483
|
+
.catch((reason) => {
|
|
484
|
+
setLoading(false);
|
|
485
|
+
const errorMessage = stringifyError(reason);
|
|
486
|
+
|
|
487
|
+
console.log('EXCEPTION in sendAttachmentMessage', errorMessage);
|
|
488
|
+
|
|
489
|
+
throw new Error(errorMessage);
|
|
490
|
+
});
|
|
491
|
+
} catch (e) {
|
|
492
|
+
return false;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
return true;
|
|
455
496
|
};
|
|
456
497
|
|
|
457
498
|
return {
|
package/src/Presentation/components/UI/Dialogs/PreviewDialog/PreviewAudioFile/PreviewAudioFile.scss
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
.preview-audio-file-container,
|
|
2
|
+
.preview-audio-file-container * {
|
|
3
|
+
box-sizing: border-box;
|
|
4
|
+
}
|
|
5
|
+
.preview-audio-file-container {
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: row;
|
|
8
|
+
gap: 8px;
|
|
9
|
+
align-items: center;
|
|
10
|
+
justify-content: flex-start;
|
|
11
|
+
align-self: stretch;
|
|
12
|
+
flex-shrink: 0;
|
|
13
|
+
position: relative;
|
|
14
|
+
|
|
15
|
+
&--placeholder {
|
|
16
|
+
flex-shrink: 0;
|
|
17
|
+
width: 32px;
|
|
18
|
+
height: 32px;
|
|
19
|
+
position: static;
|
|
20
|
+
|
|
21
|
+
&__bg {
|
|
22
|
+
background: var(--incoming-background, #e4e6e8);
|
|
23
|
+
border-radius: 8px;
|
|
24
|
+
width: 32px;
|
|
25
|
+
height: 32px;
|
|
26
|
+
position: absolute;
|
|
27
|
+
left: 0px;
|
|
28
|
+
top: 0px;
|
|
29
|
+
}
|
|
30
|
+
&__icon {
|
|
31
|
+
border-radius: 4px;
|
|
32
|
+
padding: 4px;
|
|
33
|
+
display: flex;
|
|
34
|
+
flex-direction: row;
|
|
35
|
+
gap: 0px;
|
|
36
|
+
align-items: center;
|
|
37
|
+
justify-content: center;
|
|
38
|
+
width: 24px;
|
|
39
|
+
height: 24px;
|
|
40
|
+
position: absolute;
|
|
41
|
+
left: 4px;
|
|
42
|
+
top: 4px;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
&--audio-mp-3 {
|
|
47
|
+
color: var(--main-text, #0b121b);
|
|
48
|
+
text-align: left;
|
|
49
|
+
font: 400 12px/16px "Roboto", sans-serif;
|
|
50
|
+
position: relative;
|
|
51
|
+
flex: 1;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
.media-audio-file {
|
|
57
|
+
align-self: stretch;
|
|
58
|
+
flex: 1;
|
|
59
|
+
position: relative;
|
|
60
|
+
overflow: visible;
|
|
61
|
+
}
|
|
62
|
+
|
package/src/Presentation/components/UI/Dialogs/PreviewDialog/PreviewAudioFile/PreviewAudioFile.tsx
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import './PreviewAudioFile.scss';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import AudioFile from '../../../svgs/Icons/Media/AudioFile';
|
|
4
|
+
|
|
5
|
+
type PreviewAudioFileProps = {
|
|
6
|
+
fileName: string;
|
|
7
|
+
};
|
|
8
|
+
// eslint-disable-next-line react/function-component-definition
|
|
9
|
+
const PreviewAudioFile: React.FC<PreviewAudioFileProps> = ({
|
|
10
|
+
fileName,
|
|
11
|
+
}: PreviewAudioFileProps) => {
|
|
12
|
+
return (
|
|
13
|
+
<div className="preview-audio-file-container">
|
|
14
|
+
<div className="preview-audio-file-container--placeholder">
|
|
15
|
+
<div className="preview-audio-file-container--placeholder__bg" />
|
|
16
|
+
<div className="preview-audio-file-container--placeholder__icon">
|
|
17
|
+
<AudioFile width="16" height="16" applyZoom color="var(--caption)" />
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
<div className="preview-audio-file-container--audio-mp-3">{fileName}</div>
|
|
21
|
+
</div>
|
|
22
|
+
);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export default PreviewAudioFile;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
.preview-default-file-container,
|
|
2
|
+
.preview-default-file-container * {
|
|
3
|
+
box-sizing: border-box;
|
|
4
|
+
}
|
|
5
|
+
.preview-default-file-container {
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: row;
|
|
8
|
+
gap: 8px;
|
|
9
|
+
align-items: center;
|
|
10
|
+
justify-content: flex-start;
|
|
11
|
+
align-self: stretch;
|
|
12
|
+
flex-shrink: 0;
|
|
13
|
+
position: relative;
|
|
14
|
+
|
|
15
|
+
&--placeholder {
|
|
16
|
+
flex-shrink: 0;
|
|
17
|
+
width: 32px;
|
|
18
|
+
height: 32px;
|
|
19
|
+
position: static;
|
|
20
|
+
|
|
21
|
+
&__bg {
|
|
22
|
+
background: var(--incoming-background, #e4e6e8);
|
|
23
|
+
border-radius: 8px;
|
|
24
|
+
width: 32px;
|
|
25
|
+
height: 32px;
|
|
26
|
+
position: absolute;
|
|
27
|
+
left: 0px;
|
|
28
|
+
top: 0px;
|
|
29
|
+
}
|
|
30
|
+
&__icon {
|
|
31
|
+
border-radius: 4px;
|
|
32
|
+
padding: 4px;
|
|
33
|
+
display: flex;
|
|
34
|
+
flex-direction: row;
|
|
35
|
+
gap: 0px;
|
|
36
|
+
align-items: center;
|
|
37
|
+
justify-content: center;
|
|
38
|
+
width: 24px;
|
|
39
|
+
height: 24px;
|
|
40
|
+
position: absolute;
|
|
41
|
+
left: 4px;
|
|
42
|
+
top: 4px;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
&--default-file {
|
|
47
|
+
color: var(--main-text, #0b121b);
|
|
48
|
+
text-align: left;
|
|
49
|
+
font: 400 12px/16px "Roboto", sans-serif;
|
|
50
|
+
position: relative;
|
|
51
|
+
flex: 1;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.media-text-document {
|
|
56
|
+
align-self: stretch;
|
|
57
|
+
flex: 1;
|
|
58
|
+
position: relative;
|
|
59
|
+
overflow: visible;
|
|
60
|
+
}
|
|
61
|
+
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import './PreviewDefaultFile.scss';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import TextDocument from '../../../svgs/Icons/Media/TextDocument';
|
|
4
|
+
|
|
5
|
+
type PreviewDefaultFileProps = {
|
|
6
|
+
fileName: string;
|
|
7
|
+
};
|
|
8
|
+
// eslint-disable-next-line react/function-component-definition
|
|
9
|
+
const PreviewDefaultFile: React.FC<PreviewDefaultFileProps> = ({
|
|
10
|
+
fileName,
|
|
11
|
+
}: PreviewDefaultFileProps) => {
|
|
12
|
+
return (
|
|
13
|
+
<div className="preview-default-file-container">
|
|
14
|
+
<div className="preview-default-file-container--placeholder">
|
|
15
|
+
<div className="preview-default-file-container--placeholder__bg" />
|
|
16
|
+
<div className="preview-default-file-container--placeholder__icon">
|
|
17
|
+
<TextDocument
|
|
18
|
+
width="16"
|
|
19
|
+
height="16"
|
|
20
|
+
applyZoom
|
|
21
|
+
color="var(--caption)"
|
|
22
|
+
/>
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
<div className="preview-default-file-container--default-file">
|
|
26
|
+
{fileName}
|
|
27
|
+
</div>
|
|
28
|
+
</div>
|
|
29
|
+
);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export default PreviewDefaultFile;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
$preview-dialog-color-divider: var(--color-divider);
|
|
4
4
|
$row-center-container-base-font-size: 12px;
|
|
5
|
-
$row-center-container-base-font-line-height:
|
|
5
|
+
$row-center-container-base-font-line-height: 32px;
|
|
6
6
|
$row--main-container-min-height: 72px;
|
|
7
7
|
$row--main-container-min-width: 320px;
|
|
8
8
|
$row--main-container-text-title-width: 120px;
|
|
@@ -33,6 +33,10 @@ $preview-dialog-avatar-wrapper-background-color-private: var(--caption);
|
|
|
33
33
|
text-overflow: ellipsis;
|
|
34
34
|
white-space: nowrap;
|
|
35
35
|
overflow: hidden;
|
|
36
|
+
color: var(--main-text, #0b121b);
|
|
37
|
+
text-align: left;
|
|
38
|
+
font: var(--label-label-medium, 500 12px/16px "Roboto", sans-serif);
|
|
39
|
+
position: relative;
|
|
36
40
|
}
|
|
37
41
|
&__text {
|
|
38
42
|
position: relative;
|
|
@@ -55,8 +59,14 @@ $preview-dialog-avatar-wrapper-background-color-private: var(--caption);
|
|
|
55
59
|
word-wrap: break-word;
|
|
56
60
|
overflow: hidden;
|
|
57
61
|
max-height: $row-center-container-base-font-line-height; /* (Number of lines you want visible) * (line-height) */
|
|
58
|
-
line-height: $row-center-container-base-font-size;
|
|
59
|
-
text-align:justify;
|
|
62
|
+
line-height: 11px; // $row-center-container-base-font-size;
|
|
63
|
+
//text-align:justify;
|
|
64
|
+
color: var(--main-text);
|
|
65
|
+
text-align: left;
|
|
66
|
+
font: var(--body-body-small, 400 12px/16px "Roboto", sans-serif);
|
|
67
|
+
position: relative;
|
|
68
|
+
align-self: stretch;
|
|
69
|
+
height: 32px;
|
|
60
70
|
}
|
|
61
71
|
|
|
62
72
|
//&__text.ellipsis::after {
|
|
@@ -98,3 +108,19 @@ $preview-dialog-avatar-wrapper-background-color-private: var(--caption);
|
|
|
98
108
|
padding-top: 2px;
|
|
99
109
|
}
|
|
100
110
|
|
|
111
|
+
.dialog-item-preview-text{
|
|
112
|
+
color: var(--main-text);
|
|
113
|
+
text-align: left;
|
|
114
|
+
font: var(--body-body-small, 400 12px/16px "Roboto", sans-serif);
|
|
115
|
+
position: relative;
|
|
116
|
+
align-self: stretch;
|
|
117
|
+
height: 32px;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.dialog-item-date-time-sent{
|
|
121
|
+
color: var(--secondary-text);
|
|
122
|
+
text-align: right;
|
|
123
|
+
font: var(--label-label-small, 500 11px/16px "Roboto", sans-serif);
|
|
124
|
+
position: relative;
|
|
125
|
+
}
|
|
126
|
+
|