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
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import AIWidgetIcon from '../../../svgs/Icons/AIWidgets/AIWidget';
|
|
3
|
+
import ErrorMessageIcon from './ErrorMessageIcon';
|
|
4
|
+
import { AIMessageWidget } from './AIMessageWidget';
|
|
5
|
+
import { AISource, IChatMessage } from '../../../../../../Data/source/AISource';
|
|
6
|
+
|
|
7
|
+
interface MessageWidgetProps {
|
|
8
|
+
// https://api.openai.com/v1/chat/completions'
|
|
9
|
+
// api: 'v1/chat/completions',
|
|
10
|
+
// servername: 'https://myproxy.com',
|
|
11
|
+
// https://func270519800.azurewebsites.net/api/TranslateTextToEng
|
|
12
|
+
servername: string;
|
|
13
|
+
api: string;
|
|
14
|
+
port: string;
|
|
15
|
+
sessionToken: string;
|
|
16
|
+
apiKey: string;
|
|
17
|
+
}
|
|
18
|
+
export default function UseDefaultAITranslateWidget({
|
|
19
|
+
servername,
|
|
20
|
+
api,
|
|
21
|
+
port,
|
|
22
|
+
sessionToken,
|
|
23
|
+
apiKey,
|
|
24
|
+
}: MessageWidgetProps): AIMessageWidget {
|
|
25
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
26
|
+
const [errorMessage, setErrorMessage] = useState<string>('');
|
|
27
|
+
|
|
28
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars,@typescript-eslint/no-empty-function
|
|
29
|
+
const fileToWidget = (file: File, context: IChatMessage[]): void => {};
|
|
30
|
+
|
|
31
|
+
const renderWidget = (): JSX.Element => {
|
|
32
|
+
if (errorMessage && errorMessage.length > 0) {
|
|
33
|
+
const errorsDescriptions:
|
|
34
|
+
| { title: string; action: () => void }[]
|
|
35
|
+
| undefined = [];
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<ErrorMessageIcon
|
|
39
|
+
errorMessageText={errorMessage}
|
|
40
|
+
errorsDescriptions={errorsDescriptions}
|
|
41
|
+
/>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return <AIWidgetIcon applyZoom color="green" />;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const [textFromWidgetToContent, setTextFromWidgetToContent] = useState('');
|
|
49
|
+
const textToWidget = async (
|
|
50
|
+
textToSend: string,
|
|
51
|
+
context: IChatMessage[],
|
|
52
|
+
additionalSettings?: { [key: string]: any },
|
|
53
|
+
): Promise<string> => {
|
|
54
|
+
if (textToSend && textToSend.length > 0) {
|
|
55
|
+
// eslint-disable-next-line no-return-await
|
|
56
|
+
let prompt = `Please, translate the next text in english and give me just only translated text. Text to translate is: "${textToSend}"`;
|
|
57
|
+
const { language } = additionalSettings || {};
|
|
58
|
+
|
|
59
|
+
if (language) {
|
|
60
|
+
prompt = `Please, translate the next text in ${
|
|
61
|
+
language as string
|
|
62
|
+
} and give me just only translated text. Text to translate is: "${textToSend}"`;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (apiKey.length > 0) {
|
|
66
|
+
// eslint-disable-next-line no-return-await
|
|
67
|
+
return await AISource.getData(
|
|
68
|
+
prompt,
|
|
69
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
70
|
+
context,
|
|
71
|
+
servername,
|
|
72
|
+
api,
|
|
73
|
+
port,
|
|
74
|
+
sessionToken,
|
|
75
|
+
).then((data) => {
|
|
76
|
+
setTextFromWidgetToContent(data);
|
|
77
|
+
|
|
78
|
+
return data;
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// eslint-disable-next-line no-return-await
|
|
83
|
+
return await AISource.getDataWithProxyServer(
|
|
84
|
+
prompt,
|
|
85
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
86
|
+
context,
|
|
87
|
+
servername,
|
|
88
|
+
api,
|
|
89
|
+
port,
|
|
90
|
+
sessionToken,
|
|
91
|
+
).then((data) => {
|
|
92
|
+
setTextFromWidgetToContent(data);
|
|
93
|
+
|
|
94
|
+
return data;
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return '';
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
return {
|
|
102
|
+
textToContent: textFromWidgetToContent,
|
|
103
|
+
renderWidget,
|
|
104
|
+
textToWidget,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { AIAttachmentWidget } from './AIMessageWidget';
|
|
3
3
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
4
4
|
import VoiceIcon from '../../../svgs/Icons/Actions/Voice';
|
|
5
5
|
|
|
6
|
-
export default function useDefaultVoiceInputWidget():
|
|
6
|
+
export default function useDefaultVoiceInputWidget(): AIAttachmentWidget {
|
|
7
7
|
const renderWidget = (): JSX.Element => {
|
|
8
8
|
// return <VoiceIcon width="21" height="18" applyZoom color="red" />;
|
|
9
9
|
return (
|
|
@@ -32,7 +32,7 @@ export default function useDefaultVoiceInputWidget(): InputWidget {
|
|
|
32
32
|
|
|
33
33
|
const [audioFromWidgetToInput, setAudioFromWidgetToInput] = useState<File>();
|
|
34
34
|
|
|
35
|
-
async function sendFile(file: File): Promise<
|
|
35
|
+
async function sendFile(file: File): Promise<string> {
|
|
36
36
|
if (file) {
|
|
37
37
|
// Создание объекта FormData и добавление файла
|
|
38
38
|
const formData = new FormData();
|
|
@@ -57,8 +57,10 @@ export default function useDefaultVoiceInputWidget(): InputWidget {
|
|
|
57
57
|
JSON.stringify(data.replaceAll('\n\n', '')),
|
|
58
58
|
);
|
|
59
59
|
|
|
60
|
-
return data.replaceAll('\n\n', '');
|
|
60
|
+
return data.replaceAll('\n\n', '') || '';
|
|
61
61
|
}
|
|
62
|
+
|
|
63
|
+
return '';
|
|
62
64
|
}
|
|
63
65
|
|
|
64
66
|
const fileToWidget = (file: File): void => {
|
|
@@ -68,6 +70,7 @@ export default function useDefaultVoiceInputWidget(): InputWidget {
|
|
|
68
70
|
console.log(fileInfo);
|
|
69
71
|
if (file) {
|
|
70
72
|
// Отправка файла и получение результата
|
|
73
|
+
// eslint-disable-next-line promise/catch-or-return,promise/always-return
|
|
71
74
|
sendFile(file).then((result) => {
|
|
72
75
|
// Обработка результата
|
|
73
76
|
console.log(result);
|
|
@@ -77,10 +80,8 @@ export default function useDefaultVoiceInputWidget(): InputWidget {
|
|
|
77
80
|
};
|
|
78
81
|
|
|
79
82
|
return {
|
|
80
|
-
|
|
81
|
-
textToInput: textFromWidgetToInput,
|
|
83
|
+
fileToContent: audioFromWidgetToInput,
|
|
82
84
|
fileToWidget,
|
|
83
85
|
renderWidget,
|
|
84
|
-
textToWidget,
|
|
85
86
|
};
|
|
86
87
|
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import React, { useState, CSSProperties, useRef, useEffect } from 'react';
|
|
2
|
+
import EditDots from '../../svgs/Icons/Actions/EditDots';
|
|
3
|
+
|
|
4
|
+
type MenuItem = {
|
|
5
|
+
title: string;
|
|
6
|
+
action: () => void;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
type ContextMenuProps = {
|
|
10
|
+
widgetToRender?: JSX.Element;
|
|
11
|
+
items?: MenuItem[];
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const ContextMenuStyles: { [key: string]: CSSProperties } = {
|
|
15
|
+
contextMenuIcon: {
|
|
16
|
+
display: 'inline-block',
|
|
17
|
+
position: 'relative',
|
|
18
|
+
maxWidth: '42px',
|
|
19
|
+
maxHeight: '42px',
|
|
20
|
+
cursor: 'pointer',
|
|
21
|
+
},
|
|
22
|
+
contextMenuContent: {
|
|
23
|
+
position: 'absolute',
|
|
24
|
+
top: '0',
|
|
25
|
+
left: '50%',
|
|
26
|
+
transform: 'translateX(-50%)',
|
|
27
|
+
backgroundColor: 'white',
|
|
28
|
+
border: '1px solid gray',
|
|
29
|
+
borderRadius: '8px',
|
|
30
|
+
padding: '4px',
|
|
31
|
+
zIndex: 1,
|
|
32
|
+
width: 'max-content',
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
function ContextMenu({ items, widgetToRender }: ContextMenuProps) {
|
|
37
|
+
const [menuVisible, setMenuVisible] = useState(false);
|
|
38
|
+
const contextMenuRef = useRef<HTMLDivElement | null>(null);
|
|
39
|
+
|
|
40
|
+
const handleClick = () => {
|
|
41
|
+
setMenuVisible(!menuVisible);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const handleMenuItemClick = (action: () => void) => {
|
|
45
|
+
action();
|
|
46
|
+
setMenuVisible(false); // Закрыть контекстное меню после клика на пункт меню
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
function handleClickOutside(event: MouseEvent) {
|
|
51
|
+
if (
|
|
52
|
+
contextMenuRef.current &&
|
|
53
|
+
!contextMenuRef.current.contains(event.target as Node)
|
|
54
|
+
) {
|
|
55
|
+
setMenuVisible(false);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
60
|
+
|
|
61
|
+
return () => {
|
|
62
|
+
document.removeEventListener('mousedown', handleClickOutside);
|
|
63
|
+
};
|
|
64
|
+
}, []);
|
|
65
|
+
|
|
66
|
+
return (
|
|
67
|
+
<div
|
|
68
|
+
style={{
|
|
69
|
+
...ContextMenuStyles.contextMenuIcon,
|
|
70
|
+
}}
|
|
71
|
+
>
|
|
72
|
+
<div onClick={handleClick}>{widgetToRender || <EditDots />}</div>
|
|
73
|
+
{menuVisible && (
|
|
74
|
+
<div ref={contextMenuRef} style={ContextMenuStyles.contextMenuContent}>
|
|
75
|
+
{items?.map((item, index) => (
|
|
76
|
+
<div
|
|
77
|
+
key={index}
|
|
78
|
+
style={{
|
|
79
|
+
padding: '4px',
|
|
80
|
+
cursor: 'pointer',
|
|
81
|
+
}}
|
|
82
|
+
onClick={() => {
|
|
83
|
+
handleMenuItemClick(item.action); // Используем новую функцию обработчика
|
|
84
|
+
}}
|
|
85
|
+
>
|
|
86
|
+
{item.title}
|
|
87
|
+
</div>
|
|
88
|
+
))}
|
|
89
|
+
</div>
|
|
90
|
+
)}
|
|
91
|
+
</div>
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export default ContextMenu;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
.popup-container {
|
|
2
|
+
position: inherit;
|
|
3
|
+
width: 100%;
|
|
4
|
+
height: 100%;
|
|
5
|
+
top: 0;
|
|
6
|
+
left: 0;
|
|
7
|
+
right: 0;
|
|
8
|
+
bottom: 0;
|
|
9
|
+
background-color: rgba(0, 0, 0, 0.5);
|
|
10
|
+
}
|
|
11
|
+
.popup-body {
|
|
12
|
+
position: absolute;
|
|
13
|
+
left: 30%;
|
|
14
|
+
right: 30%;
|
|
15
|
+
bottom: 30%;
|
|
16
|
+
top: 30%;
|
|
17
|
+
text-align: center;
|
|
18
|
+
margin: auto;
|
|
19
|
+
border-radius: 15px;
|
|
20
|
+
border-color: black;
|
|
21
|
+
background: white;
|
|
22
|
+
box-shadow: rgba(0, 0, 0, 0.35) 0px 5px 15px;
|
|
23
|
+
color: #FF766E;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.drop-down-menu-container {
|
|
27
|
+
position:relative;
|
|
28
|
+
width:200px;
|
|
29
|
+
|
|
30
|
+
//box-shadow:0px 8px 10px rgba(0, 0, 0, 0.11999999731779099);
|
|
31
|
+
//background-color:rgba(255, 255, 255, 1);
|
|
32
|
+
//width:135px;
|
|
33
|
+
//height:112px;
|
|
34
|
+
//border-radius: 4px;
|
|
35
|
+
////position:absolute;
|
|
36
|
+
//position: relative;
|
|
37
|
+
//border: var(--outgoing-background);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.drop-down-menu2-container {
|
|
41
|
+
width: 135px;
|
|
42
|
+
min-width: 135px;
|
|
43
|
+
max-width: 135px;
|
|
44
|
+
//
|
|
45
|
+
position: fixed;
|
|
46
|
+
z-index: 100;
|
|
47
|
+
//
|
|
48
|
+
//
|
|
49
|
+
//display: flex;
|
|
50
|
+
//flex-direction: column;
|
|
51
|
+
|
|
52
|
+
display: inline-flex;
|
|
53
|
+
padding: 8px 0px;
|
|
54
|
+
flex-direction: column;
|
|
55
|
+
align-items: flex-end;
|
|
56
|
+
//
|
|
57
|
+
//display: flex;
|
|
58
|
+
//flex-direction: column;
|
|
59
|
+
//justify-content: flex-end;
|
|
60
|
+
|
|
61
|
+
border-radius: 4px;
|
|
62
|
+
//background-color: #FF766E;
|
|
63
|
+
//background: #49CF77;
|
|
64
|
+
background: var(--dropdown-background, #FFF);
|
|
65
|
+
box-shadow: 0px 3px 5px 0px rgba(0, 0, 0, 0.04), 0px 3px 14px 0px rgba(0, 0, 0, 0.08), 0px 8px 10px 0px rgba(0, 0, 0, 0.12);
|
|
66
|
+
|
|
67
|
+
//border: 3px solid green;
|
|
68
|
+
|
|
69
|
+
&--divider{
|
|
70
|
+
|
|
71
|
+
display: flex;
|
|
72
|
+
padding: 4px 8px 4px 16px;
|
|
73
|
+
justify-content: flex-end;
|
|
74
|
+
align-items: center;
|
|
75
|
+
align-self: stretch;
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
width: 111px;
|
|
79
|
+
height: 3px;
|
|
80
|
+
|
|
81
|
+
flex-shrink: 0;
|
|
82
|
+
color: var(--divider);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import './DropDownMenu.scss';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { ItemDropDownMenu } from './ItemDropDownMenu/ItemDropDownMenu';
|
|
4
|
+
import { FunctionTypeVoidToVoid } from '../../../../../Views/Base/BaseViewModel';
|
|
5
|
+
import { MessageEntity } from '../../../../../../Domain/entity/MessageEntity';
|
|
6
|
+
import ForwardFilled from '../../../svgs/Icons/Actions/ForwardFilled';
|
|
7
|
+
|
|
8
|
+
export type ContextMessageMenu = {
|
|
9
|
+
title: string;
|
|
10
|
+
message?: MessageEntity;
|
|
11
|
+
icon?: React.ReactNode;
|
|
12
|
+
clickHandler?: FunctionTypeVoidToVoid;
|
|
13
|
+
touchHandler?: FunctionTypeVoidToVoid;
|
|
14
|
+
};
|
|
15
|
+
export type ContextMessageMenuAI = {
|
|
16
|
+
title: string;
|
|
17
|
+
message?: MessageEntity;
|
|
18
|
+
icon?: React.ReactNode;
|
|
19
|
+
clickHandler?: FunctionTypeVoidToVoid;
|
|
20
|
+
touchHandler?: FunctionTypeVoidToVoid;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const contextMessageMenu: ContextMessageMenu[] = [
|
|
24
|
+
{
|
|
25
|
+
title: 'Reply',
|
|
26
|
+
// icon: 'ic1',
|
|
27
|
+
clickHandler: () => {
|
|
28
|
+
console.log('click Reply');
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
title: 'Forward',
|
|
33
|
+
icon: <ForwardFilled />,
|
|
34
|
+
clickHandler: () => {
|
|
35
|
+
console.log('click Forward');
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
title: 'Copy',
|
|
40
|
+
// icon: 'ic2',
|
|
41
|
+
clickHandler: () => {
|
|
42
|
+
console.log('click Copy');
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
];
|
|
46
|
+
|
|
47
|
+
export const contextMessageMenuAI: ContextMessageMenuAI[] = [
|
|
48
|
+
// {
|
|
49
|
+
// title: 'Translate',
|
|
50
|
+
// // icon: ,
|
|
51
|
+
// clickHandler: () => {
|
|
52
|
+
// console.log('click Translate');
|
|
53
|
+
// },
|
|
54
|
+
// },
|
|
55
|
+
// {
|
|
56
|
+
// title: 'Answer',
|
|
57
|
+
// // icon: 'ic2',
|
|
58
|
+
// clickHandler: () => {
|
|
59
|
+
// console.log('click Answer');
|
|
60
|
+
// },
|
|
61
|
+
// },
|
|
62
|
+
];
|
|
63
|
+
|
|
64
|
+
type DropDownMenuProps = {
|
|
65
|
+
items: ContextMessageMenu[];
|
|
66
|
+
itemsAI?: ContextMessageMenuAI[];
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
// eslint-disable-next-line react/function-component-definition
|
|
70
|
+
export const DropDownMenu: React.FC<DropDownMenuProps> = ({
|
|
71
|
+
items,
|
|
72
|
+
itemsAI,
|
|
73
|
+
}: DropDownMenuProps) => {
|
|
74
|
+
console.log(itemsAI);
|
|
75
|
+
|
|
76
|
+
return (
|
|
77
|
+
<div className="drop-down-menu2-container">
|
|
78
|
+
{items.map((item, index) => {
|
|
79
|
+
return (
|
|
80
|
+
<ItemDropDownMenu
|
|
81
|
+
key={index}
|
|
82
|
+
item={item.title}
|
|
83
|
+
icon={item.icon}
|
|
84
|
+
clickAction={item.clickHandler}
|
|
85
|
+
touchAction={item.touchHandler}
|
|
86
|
+
/>
|
|
87
|
+
);
|
|
88
|
+
})}
|
|
89
|
+
<div className="drop-down-menu2-container--divider" />
|
|
90
|
+
{itemsAI && itemsAI?.length > 0
|
|
91
|
+
? itemsAI?.map((itemAI, indexAI) => {
|
|
92
|
+
return (
|
|
93
|
+
<ItemDropDownMenu
|
|
94
|
+
key={indexAI}
|
|
95
|
+
item={itemAI.title}
|
|
96
|
+
icon={itemAI.icon}
|
|
97
|
+
clickAction={itemAI.clickHandler}
|
|
98
|
+
touchAction={itemAI.touchHandler}
|
|
99
|
+
/>
|
|
100
|
+
);
|
|
101
|
+
})
|
|
102
|
+
: null}
|
|
103
|
+
</div>
|
|
104
|
+
);
|
|
105
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
.item-drop-down-menu-container {
|
|
2
|
+
//width:135px;
|
|
3
|
+
//height:32px;
|
|
4
|
+
//position:absolute;
|
|
5
|
+
//left:0px;
|
|
6
|
+
//top:8px;ß
|
|
7
|
+
|
|
8
|
+
//min-height: 36px;
|
|
9
|
+
//display: flex;
|
|
10
|
+
//flex-direction: row;
|
|
11
|
+
//flex-wrap: nowrap;
|
|
12
|
+
//justify-content: flex-start;
|
|
13
|
+
//align-items: center;
|
|
14
|
+
//gap: 16px;
|
|
15
|
+
//color: firebrick;
|
|
16
|
+
|
|
17
|
+
display: flex;
|
|
18
|
+
padding: 4px 8px 4px 16px;
|
|
19
|
+
justify-content: flex-end;
|
|
20
|
+
align-items: center;
|
|
21
|
+
align-self: flex-start;
|
|
22
|
+
|
|
23
|
+
//border: 1px solid blue;
|
|
24
|
+
|
|
25
|
+
&--title {
|
|
26
|
+
color: var(--main-text);
|
|
27
|
+
text-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.25);
|
|
28
|
+
min-width: 80px;
|
|
29
|
+
max-width: 80px;
|
|
30
|
+
width: 80px;
|
|
31
|
+
|
|
32
|
+
/* Body/Body Medium */
|
|
33
|
+
font-family: Roboto;
|
|
34
|
+
text-align: left;
|
|
35
|
+
font-size: 14px;
|
|
36
|
+
font-style: normal;
|
|
37
|
+
font-weight: 400;
|
|
38
|
+
line-height: 20px; /* 142.857% */
|
|
39
|
+
letter-spacing: 0.25px;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
&--icon {
|
|
43
|
+
display: flex;
|
|
44
|
+
width: 24px;
|
|
45
|
+
height: 24px;
|
|
46
|
+
padding: 4px;
|
|
47
|
+
justify-content: center;
|
|
48
|
+
align-items: center;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import './ItemDropDownMenu.scss';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { FunctionTypeVoidToVoid } from '../../../../../../Views/Base/BaseViewModel';
|
|
4
|
+
|
|
5
|
+
type ItemDropDownMenuProps = {
|
|
6
|
+
item: string;
|
|
7
|
+
icon?: React.ReactNode;
|
|
8
|
+
touchAction?: FunctionTypeVoidToVoid;
|
|
9
|
+
clickAction?: FunctionTypeVoidToVoid;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
// eslint-disable-next-line react/function-component-definition
|
|
13
|
+
export const ItemDropDownMenu: React.FC<ItemDropDownMenuProps> = ({
|
|
14
|
+
item,
|
|
15
|
+
icon,
|
|
16
|
+
touchAction,
|
|
17
|
+
clickAction,
|
|
18
|
+
}: ItemDropDownMenuProps) => {
|
|
19
|
+
return (
|
|
20
|
+
<div
|
|
21
|
+
className="item-drop-down-menu-container"
|
|
22
|
+
onTouchStart={() => {
|
|
23
|
+
// eslint-disable-next-line no-unused-expressions
|
|
24
|
+
touchAction && typeof touchAction === 'function'
|
|
25
|
+
? touchAction()
|
|
26
|
+
: () => {
|
|
27
|
+
console.log('item menu touched');
|
|
28
|
+
};
|
|
29
|
+
}}
|
|
30
|
+
onClick={() => {
|
|
31
|
+
// eslint-disable-next-line no-unused-expressions
|
|
32
|
+
clickAction && typeof clickAction === 'function'
|
|
33
|
+
? clickAction()
|
|
34
|
+
: () => {
|
|
35
|
+
console.log('item menu clicked');
|
|
36
|
+
};
|
|
37
|
+
}}
|
|
38
|
+
>
|
|
39
|
+
<span className="item-drop-down-menu-container--title">{item}</span>
|
|
40
|
+
<div className="item-drop-down-menu-container--icon">{icon}</div>
|
|
41
|
+
</div>
|
|
42
|
+
);
|
|
43
|
+
};
|
package/src/Presentation/components/UI/Dialogs/MessagesView/HeaderMessages/HeaderMessages.tsx
CHANGED
|
@@ -3,7 +3,6 @@ import React from 'react';
|
|
|
3
3
|
import { FunctionTypeVoidToVoid } from '../../../../../Views/Base/BaseViewModel';
|
|
4
4
|
import { DialogEntity } from '../../../../../../Domain/entity/DialogEntity';
|
|
5
5
|
import GroupChat from '../../../svgs/Icons/Contents/GroupChat';
|
|
6
|
-
import Phone from '../../../svgs/Icons/Actions/Phone';
|
|
7
6
|
import InformationFill from '../../../svgs/Icons/Status/InformationFill';
|
|
8
7
|
import ActiveSvg from '../../../svgs/ActiveSvg/ActiveSvg';
|
|
9
8
|
import { DialogType } from '../../../../../../Domain/entity/DialogTypes';
|
|
@@ -26,6 +25,7 @@ const HeaderMessages: React.FC<HeaderMessagesProps> = ({
|
|
|
26
25
|
dialog,
|
|
27
26
|
countMembers = 0,
|
|
28
27
|
InformationHandler,
|
|
28
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
29
29
|
CallHandler,
|
|
30
30
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
31
31
|
theme = undefined,
|
|
@@ -101,16 +101,19 @@ const HeaderMessages: React.FC<HeaderMessagesProps> = ({
|
|
|
101
101
|
</div>
|
|
102
102
|
</div>
|
|
103
103
|
<div className="message-header-container--info-wrapper__detail-button">
|
|
104
|
-
<div
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
104
|
+
<div
|
|
105
|
+
className="message-header-container--info-wrapper__detail-button__call"
|
|
106
|
+
style={{ width: '32px' }}
|
|
107
|
+
>
|
|
108
|
+
{/* <ActiveSvg */}
|
|
109
|
+
{/* content={<Phone width="32" height="32" applyZoom />} */}
|
|
110
|
+
{/* clickAction={() => { */}
|
|
111
|
+
{/* if (CallHandler) CallHandler(); */}
|
|
112
|
+
{/* }} */}
|
|
113
|
+
{/* touchAction={() => { */}
|
|
114
|
+
{/* if (CallHandler) CallHandler(); */}
|
|
115
|
+
{/* }} */}
|
|
116
|
+
{/* /> */}
|
|
114
117
|
</div>
|
|
115
118
|
<div className="message-header-container--info-wrapper__detail-button__info">
|
|
116
119
|
<ActiveSvg
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
|
|
2
|
+
.avatar-wrap {
|
|
3
|
+
padding: 0px 0px 16px 0px;
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: row;
|
|
6
|
+
gap: 10px;
|
|
7
|
+
align-items: flex-end;
|
|
8
|
+
justify-content: flex-start;
|
|
9
|
+
flex-shrink: 0;
|
|
10
|
+
position: relative;
|
|
11
|
+
}
|
|
12
|
+
.avatar {
|
|
13
|
+
flex-shrink: 0;
|
|
14
|
+
width: 36px;
|
|
15
|
+
height: 36px;
|
|
16
|
+
position: relative;
|
|
17
|
+
}
|
|
18
|
+
.rectangle {
|
|
19
|
+
width: 36px;
|
|
20
|
+
height: 36px;
|
|
21
|
+
position: absolute;
|
|
22
|
+
left: 0px;
|
|
23
|
+
top: 0px;
|
|
24
|
+
}
|
|
25
|
+
.ellipse {
|
|
26
|
+
background: var(--secondary-secondary-100, #bcc1c5);
|
|
27
|
+
border-radius: 50%;
|
|
28
|
+
width: 36px;
|
|
29
|
+
height: 36px;
|
|
30
|
+
position: absolute;
|
|
31
|
+
left: 0px;
|
|
32
|
+
top: 0px;
|
|
33
|
+
}
|
|
34
|
+
.contents-user {
|
|
35
|
+
position: absolute;
|
|
36
|
+
left: 6.43px;
|
|
37
|
+
top: 6.43px;
|
|
38
|
+
overflow: visible;
|
|
39
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './AvatarContentIncomingUser.scss';
|
|
3
|
+
|
|
4
|
+
export default function AvatarContentIncomingUser() {
|
|
5
|
+
return (
|
|
6
|
+
<div className="avatar-wrap">
|
|
7
|
+
<div className="avatar">
|
|
8
|
+
<div className="rectangle" />
|
|
9
|
+
<div className="ellipse" />
|
|
10
|
+
<svg
|
|
11
|
+
className="contents-user"
|
|
12
|
+
width="24"
|
|
13
|
+
height="24"
|
|
14
|
+
viewBox="0 0 24 24"
|
|
15
|
+
fill="none"
|
|
16
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
17
|
+
>
|
|
18
|
+
<path
|
|
19
|
+
d="M11.9999 6.11828C13.1185 6.11828 14.0249 7.0247 14.0249 8.14328C14.0249 9.26185 13.1185 10.1683 11.9999 10.1683C10.8814 10.1683 9.97493 9.26185 9.97493 8.14328C9.97493 7.0247 10.8814 6.11828 11.9999 6.11828ZM11.9999 14.7968C14.8639 14.7968 17.8821 16.2047 17.8821 16.8218V17.8826H6.11779V16.8218C6.11779 16.2047 9.136 14.7968 11.9999 14.7968ZM11.9999 4.28613C9.86886 4.28613 8.14279 6.0122 8.14279 8.14328C8.14279 10.2743 9.86886 12.0004 11.9999 12.0004C14.131 12.0004 15.8571 10.2743 15.8571 8.14328C15.8571 6.0122 14.131 4.28613 11.9999 4.28613ZM11.9999 12.9647C9.42529 12.9647 4.28564 14.2568 4.28564 16.8218V19.7147H19.7142V16.8218C19.7142 14.2568 14.5746 12.9647 11.9999 12.9647Z"
|
|
20
|
+
fill="#636D78"
|
|
21
|
+
/>
|
|
22
|
+
</svg>
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
);
|
|
26
|
+
}
|