quickblox-react-ui-kit 0.1.8 → 0.2.1
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/dist/Data/DefaultConfigurations.d.ts +11 -0
- package/dist/Data/Stubs.d.ts +1 -1
- package/dist/Data/source/AISource.d.ts +13 -0
- package/dist/Domain/entity/MessageEntity.d.ts +1 -1
- package/dist/Presentation/Views/Base/BaseViewModel.d.ts +10 -5
- package/dist/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/AIMessageWidget.d.ts +16 -0
- package/dist/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/AIWidgetActions/AIWidgetActions.d.ts +14 -0
- package/dist/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/ErrorMessageIcon.d.ts +11 -0
- package/dist/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/SliderMenu.d.ts +23 -0
- package/dist/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/Tone.d.ts +15 -0
- package/dist/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/UseDefaultAIAssistAnswerWidget.d.ts +10 -0
- package/dist/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/UseDefaultAIRephraseMessageWidget.d.ts +10 -0
- package/dist/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/UseDefaultAITranslateWidget.d.ts +10 -0
- package/dist/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/useDefaultVoiceInputWidget.d.ts +2 -0
- package/dist/Presentation/components/UI/Dialogs/MessagesView/ContextMenu.d.ts +11 -0
- package/dist/Presentation/components/UI/Dialogs/MessagesView/DropDownMenu/DropDownMenu.d.ts +26 -0
- package/dist/Presentation/components/UI/Dialogs/MessagesView/DropDownMenu/ItemDropDownMenu/ItemDropDownMenu.d.ts +11 -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 +15 -0
- package/dist/Presentation/components/UI/Dialogs/MessagesView/MessagesView.d.ts +5 -1
- package/dist/Presentation/components/UI/Dialogs/MessagesView/OutGoingMessage/OutGoingMessage.d.ts +9 -0
- package/dist/Presentation/components/UI/svgs/Icons/AIWidgets/BookIcon/BookIcon.d.ts +3 -0
- package/dist/Presentation/components/UI/svgs/Icons/AIWidgets/HammerIcon/index.d.ts +3 -0
- package/dist/Presentation/components/UI/svgs/Icons/AIWidgets/HandshakeIcon/index.d.ts +3 -0
- package/dist/Presentation/components/UI/svgs/Icons/AIWidgets/MuscleIcon/index.d.ts +3 -0
- package/dist/Presentation/components/UI/svgs/Icons/AIWidgets/NecktieIcon/index.d.ts +3 -0
- package/dist/Presentation/components/UI/svgs/Icons/AIWidgets/NeutralFaceIcon/index.d.ts +3 -0
- package/dist/Presentation/components/UI/svgs/Icons/AIWidgets/PalmsUpTogetherIcon/index.d.ts +3 -0
- package/dist/Presentation/components/UI/svgs/Icons/AIWidgets/PerformingArtsIcon/index.d.ts +3 -0
- package/dist/Presentation/components/UI/svgs/Icons/AIWidgets/PointUpIcon/index.d.ts +3 -0
- package/dist/Presentation/components/UI/svgs/Icons/AIWidgets/SmileyIcon/index.d.ts +3 -0
- package/dist/Presentation/components/UI/svgs/Icons/AIWidgets/SmirkIcon/index.d.ts +3 -0
- package/dist/Presentation/components/UI/svgs/Icons/AIWidgets/WhiteCheckMarkIcon/index.d.ts +3 -0
- package/dist/Presentation/components/UI/svgs/Icons/Actions/AssistAnswer/index.d.ts +4 -0
- package/dist/Presentation/components/UI/svgs/Icons/Actions/Summarize/index.d.ts +4 -0
- package/dist/Presentation/components/UI/svgs/Icons/Actions/Tone/index.d.ts +4 -0
- package/dist/Presentation/components/UI/svgs/Icons/Media/Translate/index.d.ts +4 -0
- package/dist/Presentation/components/layouts/Desktop/QuickBloxUIKitDesktopLayout.d.ts +9 -0
- package/dist/QBconfig.d.ts +22 -0
- package/dist/index-ui.d.ts +5 -1
- package/dist/index-ui.js +388 -25
- package/dist/utils/utils.d.ts +3 -0
- package/package.json +1 -1
- package/src/App.tsx +12 -18
- package/src/Data/DefaultConfigurations.ts +128 -0
- package/src/Data/Stubs.ts +15 -15
- package/src/Data/mapper/MessageLocalDTOMapper.ts +3 -2
- package/src/Data/mapper/MessageRemoteDTOMapper.ts +3 -2
- package/src/Data/source/AISource.ts +133 -0
- package/src/Data/source/remote/Mapper/MessageDTOMapper.ts +1 -1
- package/src/Domain/entity/MessageEntity.ts +1 -1
- package/src/Presentation/Views/Base/BaseViewModel.ts +20 -7
- package/src/Presentation/Views/Dialogs/Dialogs.tsx +37 -22
- package/src/Presentation/components/UI/Dialogs/HeaderDialogs/HeaderDialogs.scss +2 -2
- package/src/Presentation/components/UI/Dialogs/HeaderDialogs/HeaderDialogs.tsx +5 -5
- package/src/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/AIMessageWidget.ts +24 -0
- package/src/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/AIWidgetActions/AIWidgetActions.scss +55 -0
- package/src/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/AIWidgetActions/AIWidgetActions.tsx +116 -0
- package/src/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/ErrorMessageIcon.tsx +98 -0
- package/src/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/SliderMenu.tsx +172 -0
- package/src/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/Tone.ts +21 -0
- package/src/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/UseDefaultAIAssistAnswerWidget.tsx +99 -0
- package/src/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/UseDefaultAIRephraseMessageWidget.tsx +105 -0
- package/src/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/UseDefaultAITranslateWidget.tsx +106 -0
- package/src/Presentation/components/UI/Dialogs/MessagesView/{InputWidget → AIWidgets}/useDefaultVoiceInputWidget.tsx +8 -7
- package/src/Presentation/components/UI/Dialogs/MessagesView/ContextMenu.tsx +95 -0
- package/src/Presentation/components/UI/Dialogs/MessagesView/DropDownMenu/DropDownMenu.scss +84 -0
- package/src/Presentation/components/UI/Dialogs/MessagesView/DropDownMenu/DropDownMenu.tsx +105 -0
- package/src/Presentation/components/UI/Dialogs/MessagesView/DropDownMenu/ItemDropDownMenu/ItemDropDownMenu.scss +50 -0
- package/src/Presentation/components/UI/Dialogs/MessagesView/DropDownMenu/ItemDropDownMenu/ItemDropDownMenu.tsx +43 -0
- package/src/Presentation/components/UI/Dialogs/MessagesView/HeaderMessages/HeaderMessages.tsx +14 -11
- package/src/Presentation/components/UI/Dialogs/MessagesView/InComingMessage/AvatarContentIncomingUser/AvatarContentIncomingUser.scss +39 -0
- package/src/Presentation/components/UI/Dialogs/MessagesView/InComingMessage/AvatarContentIncomingUser/AvatarContentIncomingUser.tsx +26 -0
- package/src/Presentation/components/UI/Dialogs/MessagesView/InComingMessage/InComingMessage.scss +394 -0
- package/src/Presentation/components/UI/Dialogs/MessagesView/InComingMessage/InComingMessage.tsx +747 -0
- package/src/Presentation/components/UI/Dialogs/MessagesView/MessagesView.scss +88 -4
- package/src/Presentation/components/UI/Dialogs/MessagesView/MessagesView.tsx +625 -227
- package/src/Presentation/components/UI/Dialogs/MessagesView/OutGoingMessage/OutGoingMessage.scss +7 -0
- package/src/Presentation/components/UI/Dialogs/MessagesView/OutGoingMessage/OutGoingMessage.tsx +99 -0
- package/src/Presentation/components/UI/Dialogs/MessagesView/useMessagesViewModel.ts +2 -2
- package/src/Presentation/components/UI/svgs/Icons/AIWidgets/BookIcon/BookIcon.tsx +7 -0
- package/src/Presentation/components/UI/svgs/Icons/AIWidgets/HammerIcon/index.tsx +7 -0
- package/src/Presentation/components/UI/svgs/Icons/AIWidgets/HandshakeIcon/index.tsx +7 -0
- package/src/Presentation/components/UI/svgs/Icons/AIWidgets/MuscleIcon/index.tsx +7 -0
- package/src/Presentation/components/UI/svgs/Icons/AIWidgets/NecktieIcon/index.tsx +7 -0
- package/src/Presentation/components/UI/svgs/Icons/AIWidgets/NeutralFaceIcon/index.tsx +7 -0
- package/src/Presentation/components/UI/svgs/Icons/AIWidgets/PalmsUpTogetherIcon/index.tsx +7 -0
- package/src/Presentation/components/UI/svgs/Icons/AIWidgets/PerformingArtsIcon/index.tsx +7 -0
- package/src/Presentation/components/UI/svgs/Icons/AIWidgets/PointUpIcon/index.tsx +7 -0
- package/src/Presentation/components/UI/svgs/Icons/AIWidgets/SmileyIcon/index.tsx +20 -0
- package/src/Presentation/components/UI/svgs/Icons/AIWidgets/SmirkIcon/index.tsx +7 -0
- package/src/Presentation/components/UI/svgs/Icons/AIWidgets/WhiteCheckMarkIcon/index.tsx +7 -0
- package/src/Presentation/components/UI/svgs/Icons/Actions/AssistAnswer/AssistAnswer.svg +3 -0
- package/src/Presentation/components/UI/svgs/Icons/Actions/AssistAnswer/index.tsx +93 -0
- package/src/Presentation/components/UI/svgs/Icons/Actions/Summarize/Summarize.svg +6 -0
- package/src/Presentation/components/UI/svgs/Icons/Actions/Summarize/index.tsx +58 -0
- package/src/Presentation/components/UI/svgs/Icons/Actions/Tone/Tone.svg +3 -0
- package/src/Presentation/components/UI/svgs/Icons/Actions/Tone/index.tsx +34 -0
- package/src/Presentation/components/UI/svgs/Icons/Media/Translate/Translate.svg +3 -0
- package/src/Presentation/components/UI/svgs/Icons/Media/Translate/index.tsx +35 -0
- package/src/Presentation/components/layouts/Desktop/QuickBloxUIKitDesktopLayout.tsx +150 -37
- package/src/QBconfig.ts +31 -3
- package/src/index-ui.ts +9 -0
- package/src/utils/utils.ts +39 -0
- package/dist/Presentation/components/UI/Dialogs/MessagesView/InputWidget/InputWidget.d.ts +0 -8
- package/dist/Presentation/components/UI/Dialogs/MessagesView/InputWidget/UseDefaultTextInputWidget.d.ts +0 -2
- package/dist/Presentation/components/UI/Dialogs/MessagesView/InputWidget/useDefaultVoiceInputWidget.d.ts +0 -2
- package/src/Presentation/components/UI/Dialogs/MessagesView/InputWidget/InputWidget.ts +0 -15
- package/src/Presentation/components/UI/Dialogs/MessagesView/InputWidget/UseDefaultTextInputWidget.tsx +0 -60
- /package/dist/Presentation/components/UI/svgs/Icons/{Media → AIWidgets}/AIWidget/index.d.ts +0 -0
- /package/src/Presentation/components/UI/svgs/Icons/{Media → AIWidgets}/AIWidget/Send.svg +0 -0
- /package/src/Presentation/components/UI/svgs/Icons/{Media → AIWidgets}/AIWidget/index.tsx +0 -0
|
@@ -15,7 +15,6 @@ import useMessagesViewModel from './useMessagesViewModel';
|
|
|
15
15
|
import LoaderComponent from '../../Placeholders/LoaderComponent/LoaderComponent';
|
|
16
16
|
import ErrorComponent from '../../Placeholders/ErrorComponent/ErrorComponent';
|
|
17
17
|
import HeaderMessages from './HeaderMessages/HeaderMessages';
|
|
18
|
-
import { FunctionTypeVoidToVoid } from '../../../../Views/Base/BaseViewModel';
|
|
19
18
|
import VideoAttachmentComponent from './VideoAttachmentComponent/VideoAttachmentComponent';
|
|
20
19
|
import ImageAttachmentComponent from './ImageAttachmentComponent/ImageAttachmentComponent';
|
|
21
20
|
import { DialogType } from '../../../../../Domain/entity/DialogTypes';
|
|
@@ -28,31 +27,47 @@ import {
|
|
|
28
27
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
29
28
|
getDateShortFormatEU,
|
|
30
29
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
31
|
-
formatShortTime3,
|
|
30
|
+
// formatShortTime3,
|
|
32
31
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
33
|
-
formatShortTime4,
|
|
34
|
-
getTimeShort24hFormat,
|
|
32
|
+
// formatShortTime4,
|
|
33
|
+
// getTimeShort24hFormat,
|
|
35
34
|
} from '../../../../../utils/DateTimeFormatter';
|
|
36
|
-
import User from '../../svgs/Icons/Contents/User';
|
|
37
35
|
import ActiveSvg from '../../svgs/ActiveSvg/ActiveSvg';
|
|
38
36
|
import AttachmentIcon from '../../svgs/Icons/Media/Attachment';
|
|
39
37
|
import SendIcon from '../../svgs/Icons/Actions/Send';
|
|
40
38
|
import AudioAttachmentComponent from './AudioAttachmentComponent/AudioAttachmentComponent';
|
|
41
39
|
import AudioFile from '../../svgs/Icons/Media/AudioFile';
|
|
42
40
|
import VoiceIcon from '../../svgs/Icons/Actions/Voice';
|
|
43
|
-
import SentStatusIcon from '../../svgs/Icons/Status/Sent';
|
|
44
|
-
import ViewedDelivered from '../../svgs/Icons/Status/ViewedDelivered';
|
|
45
41
|
import { stringifyError } from '../../../../../utils/parse';
|
|
46
42
|
import VoiceRecordingProgress from './VoiceRecordingProgress/VoiceRecordingProgress';
|
|
47
43
|
import UiKitTheme from '../../../../assets/UiKitTheme';
|
|
44
|
+
import { AIMessageWidget } from './AIWidgets/AIMessageWidget';
|
|
48
45
|
import { DialogsViewModel } from '../../../../Views/Dialogs/DialogViewModel';
|
|
49
46
|
import { HighLightLink, messageHasUrls } from './HighLightLink/HighLightLink';
|
|
50
|
-
|
|
47
|
+
import { loopToLimitTokens } from '../../../../../utils/utils';
|
|
48
|
+
import { OutGoingMessage } from './OutGoingMessage/OutGoingMessage';
|
|
49
|
+
import { InComingMessage } from './InComingMessage/InComingMessage';
|
|
50
|
+
import { Tone } from './AIWidgets/Tone';
|
|
51
|
+
import NecktieIcon from '../../svgs/Icons/AIWidgets/NecktieIcon';
|
|
52
|
+
import HandshakeIcon from '../../svgs/Icons/AIWidgets/HandshakeIcon';
|
|
53
|
+
import WhiteCheckMarkIcon from '../../svgs/Icons/AIWidgets/WhiteCheckMarkIcon';
|
|
54
|
+
import MuscleIcon from '../../svgs/Icons/AIWidgets/MuscleIcon';
|
|
55
|
+
import PalmsUpTogetherIcon from '../../svgs/Icons/AIWidgets/PalmsUpTogetherIcon';
|
|
56
|
+
import NeutralFaceIcon from '../../svgs/Icons/AIWidgets/NeutralFaceIcon';
|
|
57
|
+
import HammerIcon from '../../svgs/Icons/AIWidgets/HammerIcon';
|
|
58
|
+
import BookIcon from '../../svgs/Icons/AIWidgets/BookIcon/BookIcon';
|
|
59
|
+
import PointUpIcon from '../../svgs/Icons/AIWidgets/PointUpIcon';
|
|
60
|
+
import SmirkIcon from '../../svgs/Icons/AIWidgets/SmirkIcon';
|
|
61
|
+
import PerformingArtsIcon from '../../svgs/Icons/AIWidgets/PerformingArtsIcon';
|
|
62
|
+
import { FunctionTypeVoidToVoid } from '../../../../Views/Base/BaseViewModel';
|
|
63
|
+
import { IChatMessage } from '../../../../../Data/source/AISource';
|
|
64
|
+
// import ToneIcon from '../../svgs/Icons/Actions/Tone';
|
|
65
|
+
// import AIWidgetActions from './AIWidgets/AIWidgetActions/AIWidgetActions';
|
|
51
66
|
|
|
52
67
|
type HeaderDialogsMessagesProps = {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
68
|
+
AIRephrase?: AIMessageWidget;
|
|
69
|
+
AITranslate?: AIMessageWidget;
|
|
70
|
+
AIAssist?: AIMessageWidget;
|
|
56
71
|
dialogsViewModel: DialogsViewModel;
|
|
57
72
|
onDialogInformationHandler?: FunctionTypeVoidToVoid;
|
|
58
73
|
maxWidthToResize?: string;
|
|
@@ -64,11 +79,11 @@ type HeaderDialogsMessagesProps = {
|
|
|
64
79
|
// eslint-disable-next-line react/function-component-definition
|
|
65
80
|
const MessagesView: React.FC<HeaderDialogsMessagesProps> = ({
|
|
66
81
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
67
|
-
|
|
82
|
+
AIRephrase,
|
|
68
83
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
69
|
-
|
|
84
|
+
AITranslate,
|
|
70
85
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
71
|
-
|
|
86
|
+
AIAssist,
|
|
72
87
|
dialogsViewModel,
|
|
73
88
|
onDialogInformationHandler,
|
|
74
89
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
@@ -88,6 +103,7 @@ const MessagesView: React.FC<HeaderDialogsMessagesProps> = ({
|
|
|
88
103
|
currentContext.storage.REMOTE_DATA_SOURCE.authInformation?.userId;
|
|
89
104
|
const currentUserName =
|
|
90
105
|
currentContext.storage.REMOTE_DATA_SOURCE.authInformation?.userName;
|
|
106
|
+
// const translations: Record<number, string> = {};
|
|
91
107
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
92
108
|
const { connectionRepository, browserOnline } = useQBConnection();
|
|
93
109
|
const [dialogMessagesCount, setDialogMessageCount] = useState(100);
|
|
@@ -97,6 +113,32 @@ const MessagesView: React.FC<HeaderDialogsMessagesProps> = ({
|
|
|
97
113
|
[],
|
|
98
114
|
);
|
|
99
115
|
|
|
116
|
+
const [waitAIWidget, setWaitAIWidget] = useState<boolean>(false);
|
|
117
|
+
const messageEntitiesToIChatMessageCollection = (
|
|
118
|
+
messageEntities: MessageEntity[],
|
|
119
|
+
): IChatMessage[] => {
|
|
120
|
+
const MAX_TOKENS = 3584;
|
|
121
|
+
const items = messageEntities.filter(
|
|
122
|
+
(it) =>
|
|
123
|
+
!it.notification_type ||
|
|
124
|
+
(it.notification_type && it.notification_type.length === 0),
|
|
125
|
+
);
|
|
126
|
+
const messages = loopToLimitTokens(
|
|
127
|
+
MAX_TOKENS,
|
|
128
|
+
items,
|
|
129
|
+
({ message }) => message || '',
|
|
130
|
+
).reverse();
|
|
131
|
+
const chatCompletionMessages: IChatMessage[] = messages.map(
|
|
132
|
+
({ message, sender_id }) => ({
|
|
133
|
+
role: sender_id === currentUserId ? 'user' : 'assistant',
|
|
134
|
+
content: message,
|
|
135
|
+
}),
|
|
136
|
+
);
|
|
137
|
+
|
|
138
|
+
//
|
|
139
|
+
return chatCompletionMessages;
|
|
140
|
+
};
|
|
141
|
+
|
|
100
142
|
const messagesViewModel: MessagesViewModel = useMessagesViewModel(
|
|
101
143
|
dialogsViewModel.entity?.type,
|
|
102
144
|
dialogsViewModel.entity,
|
|
@@ -190,6 +232,26 @@ const MessagesView: React.FC<HeaderDialogsMessagesProps> = ({
|
|
|
190
232
|
);
|
|
191
233
|
};
|
|
192
234
|
|
|
235
|
+
// function sendMessageToTranslate(message: MessageEntity) {
|
|
236
|
+
// if (!waitAIWidget) {
|
|
237
|
+
// setWaitAIWidget(true);
|
|
238
|
+
// AITranslation?.textToWidget(
|
|
239
|
+
// message.message,
|
|
240
|
+
// messageEntitiesToIChatMessageCollection(messagesToView),
|
|
241
|
+
// );
|
|
242
|
+
// }
|
|
243
|
+
// }
|
|
244
|
+
//
|
|
245
|
+
// function sendMessageToAIAssistAnswer(message: MessageEntity) {
|
|
246
|
+
// if (!waitAIWidget) {
|
|
247
|
+
// setWaitAIWidget(true);
|
|
248
|
+
// AIAnswerToMessage?.textToWidget(
|
|
249
|
+
// message.message,
|
|
250
|
+
// messageEntitiesToIChatMessageCollection(messagesToView),
|
|
251
|
+
// );
|
|
252
|
+
// }
|
|
253
|
+
// }
|
|
254
|
+
|
|
193
255
|
const renderMessage = (message: MessageEntity, index: number) => {
|
|
194
256
|
const SystemMessage = 'SystemMessage';
|
|
195
257
|
const IncomingMessage = 'IncomingMessage';
|
|
@@ -310,108 +372,56 @@ const MessagesView: React.FC<HeaderDialogsMessagesProps> = ({
|
|
|
310
372
|
);
|
|
311
373
|
} else if (messageTypes === IncomingMessage) {
|
|
312
374
|
messageView = (
|
|
313
|
-
<
|
|
314
|
-
className="message-view-container--incoming-message-wrapper"
|
|
375
|
+
<InComingMessage
|
|
315
376
|
key={message.id}
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
{getTimeShort24hFormat(message.date_sent)}
|
|
356
|
-
</div>
|
|
357
|
-
<div
|
|
358
|
-
className="message-view-container__incoming-time"
|
|
359
|
-
onClick={() => {
|
|
360
|
-
// IncomingMessageWidgetToRightPlaceHolder?.textToWidget(
|
|
361
|
-
// message.message,
|
|
362
|
-
// );
|
|
363
|
-
}}
|
|
364
|
-
>
|
|
365
|
-
{/* {IncomingMessageWidgetToRightPlaceHolder?.renderWidget()} */}
|
|
366
|
-
</div>
|
|
367
|
-
</div>
|
|
377
|
+
theme={theme}
|
|
378
|
+
senderName={getSenderName(message.sender)}
|
|
379
|
+
message={message}
|
|
380
|
+
// element={messageContentRender(message)}
|
|
381
|
+
onLoader={() => {
|
|
382
|
+
// sendMessageToTranslate(message);
|
|
383
|
+
setWaitAIWidget(true);
|
|
384
|
+
}}
|
|
385
|
+
// renderWidget={
|
|
386
|
+
// <ContextMenu
|
|
387
|
+
// widgetToRender={
|
|
388
|
+
// <AIWidgetIcon applyZoom color="var(--main-elements)" />
|
|
389
|
+
// }
|
|
390
|
+
// items={[
|
|
391
|
+
// {
|
|
392
|
+
// title: 'AI Assist Answer',
|
|
393
|
+
// action: () => {
|
|
394
|
+
// sendMessageToAIAssistAnswer(message);
|
|
395
|
+
// },
|
|
396
|
+
// },
|
|
397
|
+
// {
|
|
398
|
+
// title: 'AI Translate',
|
|
399
|
+
// action: () => {
|
|
400
|
+
// sendMessageToTranslate(message);
|
|
401
|
+
// },
|
|
402
|
+
// },
|
|
403
|
+
// ]}
|
|
404
|
+
// />
|
|
405
|
+
// }
|
|
406
|
+
currentUserId={currentUserId}
|
|
407
|
+
messagesToView={messagesToView}
|
|
408
|
+
AITranslation={AITranslate}
|
|
409
|
+
AIAnswerToMessage={AIAssist}
|
|
410
|
+
// translationDATA={translations}
|
|
411
|
+
// index={index}
|
|
412
|
+
// updateData={(ind: number, v: string) => {
|
|
413
|
+
// translations[ind] = v;
|
|
414
|
+
// }}
|
|
415
|
+
/>
|
|
368
416
|
);
|
|
369
417
|
} else {
|
|
370
418
|
messageView = (
|
|
371
|
-
<
|
|
372
|
-
className="message-view-container--outgoing-message-wrapper"
|
|
419
|
+
<OutGoingMessage
|
|
373
420
|
key={message.id}
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
<ViewedDelivered
|
|
379
|
-
width="13"
|
|
380
|
-
height="13"
|
|
381
|
-
applyZoom
|
|
382
|
-
color={theme ? theme.mainElements() : 'var(--main-elements)'}
|
|
383
|
-
/>
|
|
384
|
-
) : (
|
|
385
|
-
<SentStatusIcon
|
|
386
|
-
width="13"
|
|
387
|
-
height="13"
|
|
388
|
-
applyZoom
|
|
389
|
-
color={theme ? theme.mainElements() : 'var(--main-elements)'}
|
|
390
|
-
/>
|
|
391
|
-
)}
|
|
392
|
-
</div>
|
|
393
|
-
<div
|
|
394
|
-
style={theme ? { color: theme.mainText() } : {}}
|
|
395
|
-
className="message-view-container__incoming-time"
|
|
396
|
-
>
|
|
397
|
-
{getTimeShort24hFormat(message.date_sent)}
|
|
398
|
-
</div>
|
|
399
|
-
</div>
|
|
400
|
-
|
|
401
|
-
<div
|
|
402
|
-
style={
|
|
403
|
-
theme
|
|
404
|
-
? {
|
|
405
|
-
color: theme.mainText(),
|
|
406
|
-
backgroundColor: theme.outgoingBackground(),
|
|
407
|
-
}
|
|
408
|
-
: {}
|
|
409
|
-
}
|
|
410
|
-
className="message-view-container__outgoing-message"
|
|
411
|
-
>
|
|
412
|
-
{messageContentRender(message)}
|
|
413
|
-
</div>
|
|
414
|
-
</div>
|
|
421
|
+
message={message}
|
|
422
|
+
theme={theme}
|
|
423
|
+
element={messageContentRender(message)}
|
|
424
|
+
/>
|
|
415
425
|
);
|
|
416
426
|
}
|
|
417
427
|
|
|
@@ -634,7 +644,11 @@ const MessagesView: React.FC<HeaderDialogsMessagesProps> = ({
|
|
|
634
644
|
setFileToSend(voiceMessage);
|
|
635
645
|
if (useAudioWidget) {
|
|
636
646
|
setUseAudioWidget(false);
|
|
637
|
-
//
|
|
647
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
|
648
|
+
// AITranslation?.fileToWidget(
|
|
649
|
+
// voiceMessage,
|
|
650
|
+
// messageEntitiesToIChatMessageCollection(messagesToView),
|
|
651
|
+
// );
|
|
638
652
|
}
|
|
639
653
|
//
|
|
640
654
|
}
|
|
@@ -699,49 +713,204 @@ const MessagesView: React.FC<HeaderDialogsMessagesProps> = ({
|
|
|
699
713
|
}
|
|
700
714
|
}
|
|
701
715
|
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
// }
|
|
713
|
-
// }, [InputWidgetToLeftPlaceHolder?.textToInput]);
|
|
714
|
-
//
|
|
715
|
-
// useEffect(() => {
|
|
716
|
-
// if (
|
|
717
|
-
// InputWidgetToRightPlaceHolder?.textToInput &&
|
|
718
|
-
// InputWidgetToRightPlaceHolder?.textToInput.length > 0
|
|
719
|
-
// ) {
|
|
720
|
-
// setMessageText(InputWidgetToRightPlaceHolder?.textToInput);
|
|
721
|
-
// setWidgetTextContent(InputWidgetToRightPlaceHolder?.textToInput);
|
|
722
|
-
// setTimeout(() => {
|
|
723
|
-
// setWidgetTextContent('');
|
|
724
|
-
// }, 45 * 1000);
|
|
725
|
-
// }
|
|
726
|
-
// }, [InputWidgetToRightPlaceHolder?.textToInput]);
|
|
727
|
-
//
|
|
728
|
-
// useEffect(() => {
|
|
729
|
-
// if (
|
|
730
|
-
// IncomingMessageWidgetToRightPlaceHolder?.textToInput &&
|
|
731
|
-
// IncomingMessageWidgetToRightPlaceHolder?.textToInput.length > 0
|
|
732
|
-
// ) {
|
|
733
|
-
// setWidgetTextContent(
|
|
734
|
-
// IncomingMessageWidgetToRightPlaceHolder?.textToInput,
|
|
735
|
-
// );
|
|
736
|
-
// setTimeout(() => {
|
|
737
|
-
// setWidgetTextContent('');
|
|
738
|
-
// }, 45 * 1000);
|
|
739
|
-
// }
|
|
740
|
-
// }, [IncomingMessageWidgetToRightPlaceHolder?.textToInput]);
|
|
716
|
+
useEffect(() => {
|
|
717
|
+
setWaitAIWidget(false);
|
|
718
|
+
if (AIRephrase?.textToContent && AIRephrase?.textToContent.length > 0) {
|
|
719
|
+
setMessageText(AIRephrase?.textToContent);
|
|
720
|
+
setWidgetTextContent(AIRephrase?.textToContent);
|
|
721
|
+
setTimeout(() => {
|
|
722
|
+
setWidgetTextContent('');
|
|
723
|
+
}, 45 * 1000);
|
|
724
|
+
}
|
|
725
|
+
}, [AIRephrase?.textToContent]);
|
|
741
726
|
|
|
727
|
+
useEffect(() => {
|
|
728
|
+
setWaitAIWidget(false);
|
|
729
|
+
// if (
|
|
730
|
+
// AITranslation?.textToContent &&
|
|
731
|
+
// AITranslation?.textToContent.length > 0
|
|
732
|
+
// ) {
|
|
733
|
+
// setMessageText(AITranslation?.textToContent);
|
|
734
|
+
// setWidgetTextContent(AITranslation?.textToContent);
|
|
735
|
+
// setTimeout(() => {
|
|
736
|
+
// setWidgetTextContent('');
|
|
737
|
+
// }, 45 * 1000);
|
|
738
|
+
// }
|
|
739
|
+
}, [AITranslate?.textToContent]);
|
|
740
|
+
|
|
741
|
+
useEffect(() => {
|
|
742
|
+
setWaitAIWidget(false);
|
|
743
|
+
if (AIAssist?.textToContent && AIAssist?.textToContent.length > 0) {
|
|
744
|
+
setMessageText(AIAssist?.textToContent);
|
|
745
|
+
setWidgetTextContent(AIAssist?.textToContent);
|
|
746
|
+
setTimeout(() => {
|
|
747
|
+
setWidgetTextContent('');
|
|
748
|
+
}, 45 * 1000);
|
|
749
|
+
}
|
|
750
|
+
}, [AIAssist?.textToContent]);
|
|
742
751
|
const useSubContent = subHeaderContent || false;
|
|
743
752
|
const useUpContent = upHeaderContent || false;
|
|
744
753
|
|
|
754
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
755
|
+
function getAIEditingMessagesItems() {
|
|
756
|
+
return [
|
|
757
|
+
{
|
|
758
|
+
title: 'Professional Tone',
|
|
759
|
+
icon: <NecktieIcon />,
|
|
760
|
+
action: () => {
|
|
761
|
+
if (messageText && messageText.length > 0 && !waitAIWidget) {
|
|
762
|
+
setWaitAIWidget(true);
|
|
763
|
+
AIRephrase?.textToWidget(
|
|
764
|
+
messageText,
|
|
765
|
+
messageEntitiesToIChatMessageCollection(messagesToView),
|
|
766
|
+
{ tone: Tone.Professional },
|
|
767
|
+
);
|
|
768
|
+
}
|
|
769
|
+
},
|
|
770
|
+
},
|
|
771
|
+
{
|
|
772
|
+
title: 'Friendly Tone',
|
|
773
|
+
icon: <HandshakeIcon />,
|
|
774
|
+
action: () => {
|
|
775
|
+
if (messageText && messageText.length > 0 && !waitAIWidget) {
|
|
776
|
+
setWaitAIWidget(true);
|
|
777
|
+
AIRephrase?.textToWidget(
|
|
778
|
+
messageText,
|
|
779
|
+
messageEntitiesToIChatMessageCollection(messagesToView),
|
|
780
|
+
{ tone: Tone.Friendly },
|
|
781
|
+
);
|
|
782
|
+
}
|
|
783
|
+
},
|
|
784
|
+
},
|
|
785
|
+
{
|
|
786
|
+
title: 'Encouraging Tone',
|
|
787
|
+
icon: <MuscleIcon />,
|
|
788
|
+
action: () => {
|
|
789
|
+
if (messageText && messageText.length > 0 && !waitAIWidget) {
|
|
790
|
+
setWaitAIWidget(true);
|
|
791
|
+
AIRephrase?.textToWidget(
|
|
792
|
+
messageText,
|
|
793
|
+
messageEntitiesToIChatMessageCollection(messagesToView),
|
|
794
|
+
{ tone: Tone.Encouraging },
|
|
795
|
+
);
|
|
796
|
+
}
|
|
797
|
+
},
|
|
798
|
+
},
|
|
799
|
+
{
|
|
800
|
+
title: 'Empathetic Tone',
|
|
801
|
+
icon: <PalmsUpTogetherIcon />,
|
|
802
|
+
action: () => {
|
|
803
|
+
if (messageText && messageText.length > 0 && !waitAIWidget) {
|
|
804
|
+
setWaitAIWidget(true);
|
|
805
|
+
AIRephrase?.textToWidget(
|
|
806
|
+
messageText,
|
|
807
|
+
messageEntitiesToIChatMessageCollection(messagesToView),
|
|
808
|
+
{ tone: Tone.Empathetic },
|
|
809
|
+
);
|
|
810
|
+
}
|
|
811
|
+
},
|
|
812
|
+
},
|
|
813
|
+
{
|
|
814
|
+
title: 'Neutral Tone',
|
|
815
|
+
icon: <NeutralFaceIcon />,
|
|
816
|
+
action: () => {
|
|
817
|
+
if (messageText && messageText.length > 0 && !waitAIWidget) {
|
|
818
|
+
setWaitAIWidget(true);
|
|
819
|
+
AIRephrase?.textToWidget(
|
|
820
|
+
messageText,
|
|
821
|
+
messageEntitiesToIChatMessageCollection(messagesToView),
|
|
822
|
+
{ tone: Tone.Neutral },
|
|
823
|
+
);
|
|
824
|
+
}
|
|
825
|
+
},
|
|
826
|
+
},
|
|
827
|
+
{
|
|
828
|
+
title: 'Assertive Tone',
|
|
829
|
+
icon: <HammerIcon />,
|
|
830
|
+
action: () => {
|
|
831
|
+
if (messageText && messageText.length > 0 && !waitAIWidget) {
|
|
832
|
+
setWaitAIWidget(true);
|
|
833
|
+
AIRephrase?.textToWidget(
|
|
834
|
+
messageText,
|
|
835
|
+
messageEntitiesToIChatMessageCollection(messagesToView),
|
|
836
|
+
{ tone: Tone.Assertive },
|
|
837
|
+
);
|
|
838
|
+
}
|
|
839
|
+
},
|
|
840
|
+
},
|
|
841
|
+
{
|
|
842
|
+
title: 'Instructive Tone',
|
|
843
|
+
icon: <BookIcon />,
|
|
844
|
+
action: () => {
|
|
845
|
+
if (messageText && messageText.length > 0 && !waitAIWidget) {
|
|
846
|
+
setWaitAIWidget(true);
|
|
847
|
+
AIRephrase?.textToWidget(
|
|
848
|
+
messageText,
|
|
849
|
+
messageEntitiesToIChatMessageCollection(messagesToView),
|
|
850
|
+
{ tone: Tone.Instructive },
|
|
851
|
+
);
|
|
852
|
+
}
|
|
853
|
+
},
|
|
854
|
+
},
|
|
855
|
+
{
|
|
856
|
+
title: 'Persuasive Tone',
|
|
857
|
+
icon: <PointUpIcon />,
|
|
858
|
+
action: () => {
|
|
859
|
+
if (messageText && messageText.length > 0 && !waitAIWidget) {
|
|
860
|
+
setWaitAIWidget(true);
|
|
861
|
+
AIRephrase?.textToWidget(
|
|
862
|
+
messageText,
|
|
863
|
+
messageEntitiesToIChatMessageCollection(messagesToView),
|
|
864
|
+
{ tone: Tone.Persuasive },
|
|
865
|
+
);
|
|
866
|
+
}
|
|
867
|
+
},
|
|
868
|
+
},
|
|
869
|
+
{
|
|
870
|
+
title: 'Sarcastic/Ironic Tone',
|
|
871
|
+
icon: <SmirkIcon />,
|
|
872
|
+
action: () => {
|
|
873
|
+
if (messageText && messageText.length > 0 && !waitAIWidget) {
|
|
874
|
+
setWaitAIWidget(true);
|
|
875
|
+
AIRephrase?.textToWidget(
|
|
876
|
+
messageText,
|
|
877
|
+
messageEntitiesToIChatMessageCollection(messagesToView),
|
|
878
|
+
{ tone: Tone.Sarcastic },
|
|
879
|
+
);
|
|
880
|
+
}
|
|
881
|
+
},
|
|
882
|
+
},
|
|
883
|
+
{
|
|
884
|
+
title: 'Poetic Tone',
|
|
885
|
+
icon: <PerformingArtsIcon />,
|
|
886
|
+
action: () => {
|
|
887
|
+
if (messageText && messageText.length > 0 && !waitAIWidget) {
|
|
888
|
+
setWaitAIWidget(true);
|
|
889
|
+
AIRephrase?.textToWidget(
|
|
890
|
+
messageText,
|
|
891
|
+
messageEntitiesToIChatMessageCollection(messagesToView),
|
|
892
|
+
{ tone: Tone.Poetic },
|
|
893
|
+
);
|
|
894
|
+
}
|
|
895
|
+
},
|
|
896
|
+
},
|
|
897
|
+
{
|
|
898
|
+
title: 'Back to original text',
|
|
899
|
+
icon: <WhiteCheckMarkIcon />,
|
|
900
|
+
action: () => {
|
|
901
|
+
if (messageText && messageText.length > 0 && !waitAIWidget) {
|
|
902
|
+
setWaitAIWidget(true);
|
|
903
|
+
AIRephrase?.textToWidget(
|
|
904
|
+
messageText,
|
|
905
|
+
messageEntitiesToIChatMessageCollection(messagesToView),
|
|
906
|
+
{ tone: Tone.Unchanged },
|
|
907
|
+
);
|
|
908
|
+
}
|
|
909
|
+
},
|
|
910
|
+
},
|
|
911
|
+
];
|
|
912
|
+
}
|
|
913
|
+
|
|
745
914
|
return (
|
|
746
915
|
<div
|
|
747
916
|
style={
|
|
@@ -850,7 +1019,7 @@ const MessagesView: React.FC<HeaderDialogsMessagesProps> = ({
|
|
|
850
1019
|
}
|
|
851
1020
|
className="message-view-container--messages"
|
|
852
1021
|
>
|
|
853
|
-
{messagesViewModel?.error && (
|
|
1022
|
+
{messagesViewModel?.error && !messagesViewModel.loading && (
|
|
854
1023
|
<ErrorComponent
|
|
855
1024
|
title={messagesViewModel?.error}
|
|
856
1025
|
ClickActionHandler={() => {
|
|
@@ -872,28 +1041,54 @@ const MessagesView: React.FC<HeaderDialogsMessagesProps> = ({
|
|
|
872
1041
|
autoScrollToBottom={scrollUpToDown}
|
|
873
1042
|
/>
|
|
874
1043
|
)}
|
|
875
|
-
{messagesViewModel?.loading && (
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
1044
|
+
{/* {(messagesViewModel?.loading || waitAIWidget) && ( */}
|
|
1045
|
+
<div
|
|
1046
|
+
style={{
|
|
1047
|
+
display: 'flex',
|
|
1048
|
+
flexDirection: 'row',
|
|
1049
|
+
alignItems: 'center',
|
|
1050
|
+
justifyContent: 'center',
|
|
1051
|
+
}}
|
|
1052
|
+
>
|
|
1053
|
+
{messagesViewModel?.loading && (
|
|
1054
|
+
<div
|
|
1055
|
+
style={{
|
|
1056
|
+
height: '44px',
|
|
1057
|
+
width: '44px',
|
|
1058
|
+
}}
|
|
1059
|
+
>
|
|
1060
|
+
<LoaderComponent
|
|
1061
|
+
width="44"
|
|
1062
|
+
height="44"
|
|
1063
|
+
color="var(--color-background-info)"
|
|
1064
|
+
/>
|
|
1065
|
+
</div>
|
|
1066
|
+
)}
|
|
1067
|
+
</div>
|
|
1068
|
+
|
|
889
1069
|
<div
|
|
890
1070
|
style={theme ? { color: theme.mainElements() } : {}}
|
|
891
1071
|
className="message-view-container--warning-error"
|
|
892
1072
|
>
|
|
893
1073
|
{warningErrorText}
|
|
894
1074
|
</div>
|
|
1075
|
+
{/* <div> */}
|
|
1076
|
+
{/* <SliderMenu */}
|
|
1077
|
+
{/* width={680} */}
|
|
1078
|
+
{/* arrowColor="var(--chat-input)" */}
|
|
1079
|
+
{/* activeArrowColor="var(--divider)" */}
|
|
1080
|
+
{/* activeItemBorderColor="var(--main-elements)" */}
|
|
1081
|
+
{/* borderColor="var(--divider)" */}
|
|
1082
|
+
{/* backgroundColor="white" */}
|
|
1083
|
+
{/* itemBackgroundColor="var(--divider)" */}
|
|
1084
|
+
{/* itemWidth={130} */}
|
|
1085
|
+
{/* itemHeight={20} */}
|
|
1086
|
+
{/* fontSize={11} // Задаем размер шрифта */}
|
|
1087
|
+
{/* itemBorder="1px solid var(--divider)" */}
|
|
1088
|
+
{/* items={getAIEditingMessagesItems()} */}
|
|
1089
|
+
{/* /> */}
|
|
1090
|
+
{/* </div> */}
|
|
895
1091
|
</div>
|
|
896
|
-
|
|
897
1092
|
<div
|
|
898
1093
|
style={{
|
|
899
1094
|
flex: `flex: 1 1 ${maxWidthToResizing}`,
|
|
@@ -960,31 +1155,52 @@ const MessagesView: React.FC<HeaderDialogsMessagesProps> = ({
|
|
|
960
1155
|
{/* )} */}
|
|
961
1156
|
{/* end InputWidgetToRightPlaceHolder */}
|
|
962
1157
|
{!isRecording && (
|
|
963
|
-
<
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
1158
|
+
<div className="input-text-message">
|
|
1159
|
+
<div className="type-message">
|
|
1160
|
+
<textarea
|
|
1161
|
+
style={theme ? { backgroundColor: theme.chatInput() } : {}}
|
|
1162
|
+
disabled={messagesViewModel?.loading}
|
|
1163
|
+
value={messageText}
|
|
1164
|
+
onFocus={() => {
|
|
1165
|
+
setVoiceMessage(false);
|
|
1166
|
+
}}
|
|
1167
|
+
onChange={(event) => {
|
|
1168
|
+
setMessageText(event.target.value);
|
|
1169
|
+
}}
|
|
1170
|
+
onInput={() => {
|
|
1171
|
+
messagesViewModel.sendTypingTextMessage();
|
|
1172
|
+
}}
|
|
1173
|
+
onKeyDown={(e) => {
|
|
1174
|
+
console.log(
|
|
1175
|
+
`onKeyDown: ${e.key} shift ${
|
|
1176
|
+
e.shiftKey ? 'true' : 'false'
|
|
1177
|
+
} ctrl ${e.ctrlKey ? 'true' : 'false'}`,
|
|
1178
|
+
);
|
|
1179
|
+
if (e.key === 'Enter' && !e.shiftKey && !e.ctrlKey) {
|
|
1180
|
+
sendTextMessageActions();
|
|
1181
|
+
}
|
|
1182
|
+
}}
|
|
1183
|
+
placeholder="enter text to send"
|
|
1184
|
+
/>
|
|
1185
|
+
</div>
|
|
1186
|
+
{/* <div className="right"> */}
|
|
1187
|
+
{/* {AIRephrase && ( */}
|
|
1188
|
+
{/* <div className="icon"> */}
|
|
1189
|
+
{/* <AIWidgetActions */}
|
|
1190
|
+
{/* widgetToRender={ */}
|
|
1191
|
+
{/* <ToneIcon */}
|
|
1192
|
+
{/* width="24" */}
|
|
1193
|
+
{/* height="24" */}
|
|
1194
|
+
{/* applyZoom */}
|
|
1195
|
+
{/* color={theme ? theme.mainText() : 'var(--main-text)'} */}
|
|
1196
|
+
{/* /> */}
|
|
1197
|
+
{/* } */}
|
|
1198
|
+
{/* items={getAIEditingMessagesItems()} */}
|
|
1199
|
+
{/* /> */}
|
|
1200
|
+
{/* </div> */}
|
|
1201
|
+
{/* )} */}
|
|
1202
|
+
{/* </div> */}
|
|
1203
|
+
</div>
|
|
988
1204
|
)}
|
|
989
1205
|
|
|
990
1206
|
{isRecording && (
|
|
@@ -1003,23 +1219,192 @@ const MessagesView: React.FC<HeaderDialogsMessagesProps> = ({
|
|
|
1003
1219
|
}}
|
|
1004
1220
|
/>
|
|
1005
1221
|
)}
|
|
1006
|
-
{/*
|
|
1007
|
-
{/* {InputWidgetToLeftPlaceHolder && ( */}
|
|
1222
|
+
{/* {AIRephrase && ( */}
|
|
1008
1223
|
{/* <div> */}
|
|
1009
|
-
{/* <
|
|
1010
|
-
{/*
|
|
1011
|
-
{/*
|
|
1012
|
-
{/*
|
|
1013
|
-
{/*
|
|
1014
|
-
{/*
|
|
1015
|
-
{/*
|
|
1016
|
-
{/*
|
|
1017
|
-
{/*
|
|
1224
|
+
{/* /!* <ContextMenu *!/ */}
|
|
1225
|
+
{/* /!* widgetToRender={ *!/ */}
|
|
1226
|
+
{/* /!* <AIWidgetIcon *!/ */}
|
|
1227
|
+
{/* /!* applyZoom *!/ */}
|
|
1228
|
+
{/* /!* color="var(--main-elements)" *!/ */}
|
|
1229
|
+
{/* /!* width="24" *!/ */}
|
|
1230
|
+
{/* /!* height="24" *!/ */}
|
|
1231
|
+
{/* /!* /> *!/ */}
|
|
1232
|
+
{/* /!* } *!/ */}
|
|
1233
|
+
{/* /!* items={[ *!/ */}
|
|
1234
|
+
{/* /!* // { *!/ */}
|
|
1235
|
+
{/* /!* // title: 'AI Chat Summary', *!/ */}
|
|
1236
|
+
{/* /!* // // eslint-disable-next-line @typescript-eslint/no-empty-function *!/ */}
|
|
1237
|
+
{/* /!* // action: () => {}, *!/ */}
|
|
1238
|
+
{/* /!* // }, *!/ */}
|
|
1239
|
+
{/* /!* { *!/ */}
|
|
1240
|
+
{/* /!* title: 'AI Translate', *!/ */}
|
|
1241
|
+
{/* /!* action: () => { *!/ */}
|
|
1242
|
+
{/* /!* if ( *!/ */}
|
|
1243
|
+
{/* /!* messageText && *!/ */}
|
|
1244
|
+
{/* /!* messageText.length > 0 && *!/ */}
|
|
1245
|
+
{/* /!* !waitAIWidget *!/ */}
|
|
1246
|
+
{/* /!* ) { *!/ */}
|
|
1247
|
+
{/* /!* setWaitAIWidget(true); *!/ */}
|
|
1248
|
+
{/* /!* AITranslation?.textToWidget( *!/ */}
|
|
1249
|
+
{/* /!* messageText, *!/ */}
|
|
1250
|
+
{/* /!* messageEntitiesToIChatMessageCollection(messagesToView), *!/ */}
|
|
1251
|
+
{/* /!* ); *!/ */}
|
|
1252
|
+
{/* /!* } *!/ */}
|
|
1253
|
+
{/* /!* }, *!/ */}
|
|
1254
|
+
{/* /!* }, *!/ */}
|
|
1255
|
+
{/* /!* ]} *!/ */}
|
|
1256
|
+
{/* /!* /> *!/ */}
|
|
1257
|
+
{/* /!* <AIWidgetActions *!/ */}
|
|
1258
|
+
{/* /!* widgetToRender={ *!/ */}
|
|
1259
|
+
{/* /!* <AIWidgetIcon *!/ */}
|
|
1260
|
+
{/* /!* applyZoom *!/ */}
|
|
1261
|
+
{/* /!* color="var(--main-elements)" *!/ */}
|
|
1262
|
+
{/* /!* width="16" *!/ */}
|
|
1263
|
+
{/* /!* height="16" *!/ */}
|
|
1264
|
+
{/* /!* /> *!/ */}
|
|
1265
|
+
{/* /!* } *!/ */}
|
|
1266
|
+
{/* /!* items={[ *!/ */}
|
|
1267
|
+
{/* /!* { *!/ */}
|
|
1268
|
+
{/* /!* title: 'English', *!/ */}
|
|
1269
|
+
{/* /!* // eslint-disable-next-line @typescript-eslint/no-empty-function,@typescript-eslint/no-misused-promises *!/ */}
|
|
1270
|
+
{/* /!* action: async () => { *!/ */}
|
|
1271
|
+
{/* /!* if ( *!/ */}
|
|
1272
|
+
{/* /!* messageText && *!/ */}
|
|
1273
|
+
{/* /!* messageText.length > 0 && *!/ */}
|
|
1274
|
+
{/* /!* !waitAIWidget *!/ */}
|
|
1275
|
+
{/* /!* ) { *!/ */}
|
|
1276
|
+
{/* /!* setWaitAIWidget(true); *!/ */}
|
|
1277
|
+
{/* /!* const translation = await AITranslation?.textToWidget( *!/ */}
|
|
1278
|
+
{/* /!* messageText, *!/ */}
|
|
1279
|
+
{/* /!* messageEntitiesToIChatMessageCollection(messagesToView), *!/ */}
|
|
1280
|
+
{/* /!* { *!/ */}
|
|
1281
|
+
{/* /!* language: *!/ */}
|
|
1282
|
+
{/* /!* 'English' || *!/ */}
|
|
1283
|
+
{/* /!* QBConfig.configAIApi.AITranslateWidgetConfig *!/ */}
|
|
1284
|
+
{/* /!* .defaultLanguage, *!/ */}
|
|
1285
|
+
{/* /!* }, *!/ */}
|
|
1286
|
+
{/* /!* ); *!/ */}
|
|
1287
|
+
|
|
1288
|
+
{/* /!* setMessageText(translation || ''); *!/ */}
|
|
1289
|
+
{/* /!* } *!/ */}
|
|
1290
|
+
{/* /!* }, *!/ */}
|
|
1291
|
+
{/* /!* }, *!/ */}
|
|
1292
|
+
{/* /!* { *!/ */}
|
|
1293
|
+
{/* /!* title: 'Ukrainian', *!/ */}
|
|
1294
|
+
{/* /!* // eslint-disable-next-line @typescript-eslint/no-misused-promises *!/ */}
|
|
1295
|
+
{/* /!* action: async () => { *!/ */}
|
|
1296
|
+
{/* /!* if ( *!/ */}
|
|
1297
|
+
{/* /!* messageText && *!/ */}
|
|
1298
|
+
{/* /!* messageText.length > 0 && *!/ */}
|
|
1299
|
+
{/* /!* !waitAIWidget *!/ */}
|
|
1300
|
+
{/* /!* ) { *!/ */}
|
|
1301
|
+
{/* /!* setWaitAIWidget(true); *!/ */}
|
|
1302
|
+
{/* /!* const translation = await AITranslation?.textToWidget( *!/ */}
|
|
1303
|
+
{/* /!* messageText, *!/ */}
|
|
1304
|
+
{/* /!* messageEntitiesToIChatMessageCollection(messagesToView), *!/ */}
|
|
1305
|
+
{/* /!* { *!/ */}
|
|
1306
|
+
{/* /!* language: *!/ */}
|
|
1307
|
+
{/* /!* 'Ukrainian' || *!/ */}
|
|
1308
|
+
{/* /!* QBConfig.configAIApi.AITranslateWidgetConfig *!/ */}
|
|
1309
|
+
{/* /!* .defaultLanguage, *!/ */}
|
|
1310
|
+
{/* /!* }, *!/ */}
|
|
1311
|
+
{/* /!* ); *!/ */}
|
|
1312
|
+
|
|
1313
|
+
{/* /!* setMessageText(translation || ''); *!/ */}
|
|
1314
|
+
{/* /!* } *!/ */}
|
|
1315
|
+
{/* /!* }, *!/ */}
|
|
1316
|
+
{/* /!* }, *!/ */}
|
|
1317
|
+
{/* /!* { *!/ */}
|
|
1318
|
+
{/* /!* title: 'Spanish', *!/ */}
|
|
1319
|
+
{/* /!* // eslint-disable-next-line @typescript-eslint/no-misused-promises *!/ */}
|
|
1320
|
+
{/* /!* action: async () => { *!/ */}
|
|
1321
|
+
{/* /!* if ( *!/ */}
|
|
1322
|
+
{/* /!* messageText && *!/ */}
|
|
1323
|
+
{/* /!* messageText.length > 0 && *!/ */}
|
|
1324
|
+
{/* /!* !waitAIWidget *!/ */}
|
|
1325
|
+
{/* /!* ) { *!/ */}
|
|
1326
|
+
{/* /!* setWaitAIWidget(true); *!/ */}
|
|
1327
|
+
{/* /!* const translation = await AITranslation?.textToWidget( *!/ */}
|
|
1328
|
+
{/* /!* messageText, *!/ */}
|
|
1329
|
+
{/* /!* messageEntitiesToIChatMessageCollection(messagesToView), *!/ */}
|
|
1330
|
+
{/* /!* { *!/ */}
|
|
1331
|
+
{/* /!* language: *!/ */}
|
|
1332
|
+
{/* /!* 'Spanish' || *!/ */}
|
|
1333
|
+
{/* /!* QBConfig.configAIApi.AITranslateWidgetConfig *!/ */}
|
|
1334
|
+
{/* /!* .defaultLanguage, *!/ */}
|
|
1335
|
+
{/* /!* }, *!/ */}
|
|
1336
|
+
{/* /!* ); *!/ */}
|
|
1337
|
+
|
|
1338
|
+
{/* /!* setMessageText(translation || ''); *!/ */}
|
|
1339
|
+
{/* /!* } *!/ */}
|
|
1340
|
+
{/* /!* }, *!/ */}
|
|
1341
|
+
{/* /!* }, *!/ */}
|
|
1342
|
+
{/* /!* { *!/ */}
|
|
1343
|
+
{/* /!* title: 'Portuguese', *!/ */}
|
|
1344
|
+
{/* /!* // eslint-disable-next-line @typescript-eslint/no-misused-promises *!/ */}
|
|
1345
|
+
{/* /!* action: async () => { *!/ */}
|
|
1346
|
+
{/* /!* if ( *!/ */}
|
|
1347
|
+
{/* /!* messageText && *!/ */}
|
|
1348
|
+
{/* /!* messageText.length > 0 && *!/ */}
|
|
1349
|
+
{/* /!* !waitAIWidget *!/ */}
|
|
1350
|
+
{/* /!* ) { *!/ */}
|
|
1351
|
+
{/* /!* setWaitAIWidget(true); *!/ */}
|
|
1352
|
+
{/* /!* const translation = await AITranslation?.textToWidget( *!/ */}
|
|
1353
|
+
{/* /!* messageText, *!/ */}
|
|
1354
|
+
{/* /!* messageEntitiesToIChatMessageCollection(messagesToView), *!/ */}
|
|
1355
|
+
{/* /!* { *!/ */}
|
|
1356
|
+
{/* /!* language: *!/ */}
|
|
1357
|
+
{/* /!* 'Portuguese' || *!/ */}
|
|
1358
|
+
{/* /!* QBConfig.configAIApi.AITranslateWidgetConfig *!/ */}
|
|
1359
|
+
{/* /!* .defaultLanguage, *!/ */}
|
|
1360
|
+
{/* /!* }, *!/ */}
|
|
1361
|
+
{/* /!* ); *!/ */}
|
|
1362
|
+
|
|
1363
|
+
{/* /!* setMessageText(translation || ''); *!/ */}
|
|
1364
|
+
{/* /!* } *!/ */}
|
|
1365
|
+
{/* /!* }, *!/ */}
|
|
1366
|
+
{/* /!* }, *!/ */}
|
|
1367
|
+
{/* /!* { *!/ */}
|
|
1368
|
+
{/* /!* title: 'French', *!/ */}
|
|
1369
|
+
{/* /!* // eslint-disable-next-line @typescript-eslint/no-misused-promises *!/ */}
|
|
1370
|
+
{/* /!* action: async () => { *!/ */}
|
|
1371
|
+
{/* /!* if ( *!/ */}
|
|
1372
|
+
{/* /!* messageText && *!/ */}
|
|
1373
|
+
{/* /!* messageText.length > 0 && *!/ */}
|
|
1374
|
+
{/* /!* !waitAIWidget *!/ */}
|
|
1375
|
+
{/* /!* ) { *!/ */}
|
|
1376
|
+
{/* /!* setWaitAIWidget(true); *!/ */}
|
|
1377
|
+
{/* /!* const translation = await AITranslation?.textToWidget( *!/ */}
|
|
1378
|
+
{/* /!* messageText, *!/ */}
|
|
1379
|
+
{/* /!* messageEntitiesToIChatMessageCollection(messagesToView), *!/ */}
|
|
1380
|
+
{/* /!* { *!/ */}
|
|
1381
|
+
{/* /!* language: *!/ */}
|
|
1382
|
+
{/* /!* 'French' || *!/ */}
|
|
1383
|
+
{/* /!* QBConfig.configAIApi.AITranslateWidgetConfig *!/ */}
|
|
1384
|
+
{/* /!* .defaultLanguage, *!/ */}
|
|
1385
|
+
{/* /!* }, *!/ */}
|
|
1386
|
+
{/* /!* ); *!/ */}
|
|
1387
|
+
|
|
1388
|
+
{/* /!* setMessageText(translation || ''); *!/ */}
|
|
1389
|
+
{/* /!* } *!/ */}
|
|
1390
|
+
{/* /!* }, *!/ */}
|
|
1391
|
+
{/* /!* }, *!/ */}
|
|
1392
|
+
{/* /!* // { *!/ */}
|
|
1393
|
+
{/* /!* // title: 'German', *!/ */}
|
|
1394
|
+
{/* /!* // action: () => {}, *!/ */}
|
|
1395
|
+
{/* /!* // }, *!/ */}
|
|
1396
|
+
{/* /!* ]} *!/ */}
|
|
1397
|
+
{/* /!* /> *!/ */}
|
|
1398
|
+
{/* <AIWidgetActions */}
|
|
1399
|
+
{/* title="AI Rephrase Message" */}
|
|
1400
|
+
{/* widgetToRender={ */}
|
|
1401
|
+
{/* <AIWidgetIcon applyZoom color="blue" width="24" height="24" /> */}
|
|
1402
|
+
{/* } */}
|
|
1403
|
+
{/* items={getAIEditingMessagesItems()} */}
|
|
1018
1404
|
{/* /> */}
|
|
1019
1405
|
{/* </div> */}
|
|
1020
1406
|
{/* )} */}
|
|
1021
|
-
{
|
|
1022
|
-
{!isVoiceMessage && (
|
|
1407
|
+
{!isVoiceMessage && !waitAIWidget && (
|
|
1023
1408
|
<div>
|
|
1024
1409
|
<ActiveSvg
|
|
1025
1410
|
content={
|
|
@@ -1040,29 +1425,42 @@ const MessagesView: React.FC<HeaderDialogsMessagesProps> = ({
|
|
|
1040
1425
|
/>
|
|
1041
1426
|
</div>
|
|
1042
1427
|
)}
|
|
1043
|
-
{
|
|
1044
|
-
<div
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
color={isRecording ? 'var(--error)' : 'var(--input-elements)'}
|
|
1052
|
-
/>
|
|
1053
|
-
}
|
|
1054
|
-
clickAction={() => {
|
|
1055
|
-
console.log('click send voice message');
|
|
1056
|
-
if (messagesViewModel?.loading) return;
|
|
1057
|
-
setIsRecording(!isRecording);
|
|
1058
|
-
}}
|
|
1059
|
-
touchAction={() => {
|
|
1060
|
-
console.log('touch send message');
|
|
1061
|
-
if (messagesViewModel?.loading) return;
|
|
1062
|
-
setIsRecording(!isRecording);
|
|
1063
|
-
}}
|
|
1064
|
-
/>
|
|
1428
|
+
{waitAIWidget ? (
|
|
1429
|
+
<div
|
|
1430
|
+
style={{
|
|
1431
|
+
height: '44px',
|
|
1432
|
+
width: '24px',
|
|
1433
|
+
}}
|
|
1434
|
+
>
|
|
1435
|
+
<LoaderComponent width="24" height="24" color="var(--caption)" />
|
|
1065
1436
|
</div>
|
|
1437
|
+
) : (
|
|
1438
|
+
isVoiceMessage && (
|
|
1439
|
+
<div>
|
|
1440
|
+
<ActiveSvg
|
|
1441
|
+
content={
|
|
1442
|
+
<VoiceIcon
|
|
1443
|
+
width="21"
|
|
1444
|
+
height="18"
|
|
1445
|
+
applyZoom
|
|
1446
|
+
color={
|
|
1447
|
+
isRecording ? 'var(--error)' : 'var(--input-elements)'
|
|
1448
|
+
}
|
|
1449
|
+
/>
|
|
1450
|
+
}
|
|
1451
|
+
clickAction={() => {
|
|
1452
|
+
console.log('click send voice message');
|
|
1453
|
+
if (messagesViewModel?.loading) return;
|
|
1454
|
+
setIsRecording(!isRecording);
|
|
1455
|
+
}}
|
|
1456
|
+
touchAction={() => {
|
|
1457
|
+
console.log('touch send message');
|
|
1458
|
+
if (messagesViewModel?.loading) return;
|
|
1459
|
+
setIsRecording(!isRecording);
|
|
1460
|
+
}}
|
|
1461
|
+
/>
|
|
1462
|
+
</div>
|
|
1463
|
+
)
|
|
1066
1464
|
)}
|
|
1067
1465
|
</div>
|
|
1068
1466
|
{/* <div className="message-view-container--warning-error"> */}
|