agx-chat-web 1.1.0 → 1.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/README.md +49 -49
- package/dist/agx-chat.esm.js +1 -1
- package/dist/agx-chat.esm.js.map +1 -1
- package/dist/{agx-chat.min.js → agx-chat.umd.js} +2 -2
- package/dist/agx-chat.umd.js.map +1 -0
- package/dist/esm/app/Messenger/components/IncomingMessage/IncomingMessage.js +7 -3
- package/dist/esm/app/Messenger/components/IncomingMessage/IncomingMessage.js.map +1 -1
- package/dist/esm/app/Messenger/components/InputFile/InputFile.js +3 -1
- package/dist/esm/app/Messenger/components/InputFile/InputFile.js.map +1 -1
- package/dist/esm/app/Messenger/components/RenderFileIcon/RenderFileIcon.js +8 -0
- package/dist/esm/app/Messenger/components/RenderFileIcon/RenderFileIcon.js.map +1 -1
- package/dist/esm/app/Messenger/components/SendMessageForm/SendMessageForm.js +30 -8
- package/dist/esm/app/Messenger/components/SendMessageForm/SendMessageForm.js.map +1 -1
- package/dist/esm/app/Messenger/components/SenderMessages/SenderMessages.js +11 -8
- package/dist/esm/app/Messenger/components/SenderMessages/SenderMessages.js.map +1 -1
- package/dist/esm/app/Messenger/icons/CSVFileIcon.d.ts +4 -0
- package/dist/esm/app/Messenger/icons/CSVFileIcon.js +7 -0
- package/dist/esm/app/Messenger/icons/CSVFileIcon.js.map +1 -0
- package/dist/esm/app/Messenger/icons/MP4FileIcon.d.ts +4 -0
- package/dist/esm/app/Messenger/icons/MP4FileIcon.js +7 -0
- package/dist/esm/app/Messenger/icons/MP4FileIcon.js.map +1 -0
- package/package.json +91 -91
- package/src/__tests__/app/Messenger/classes/slaCalculations.spec.ts +122 -122
- package/src/app/ChatProvider/ChatProvider.tsx +20 -20
- package/src/app/Messenger/classes/slaCalculations.ts +197 -197
- package/src/app/Messenger/components/ChatButton/ChatButton.tsx +64 -64
- package/src/app/Messenger/components/ChatTabs/ChatTabs.less +18 -18
- package/src/app/Messenger/components/ChatTabs/ChatTabs.tsx +32 -32
- package/src/app/Messenger/components/DocMessage/DocMessage.less +71 -71
- package/src/app/Messenger/components/DocMessage/DocMessage.tsx +50 -50
- package/src/app/Messenger/components/ImagesContainer/ImagesContainer.less +79 -79
- package/src/app/Messenger/components/ImagesContainer/ImagesContainer.tsx +51 -51
- package/src/app/Messenger/components/IncomingMessage/IncomingMessage.tsx +170 -166
- package/src/app/Messenger/components/InfiniteScroll/InfiniteScroll.tsx +80 -80
- package/src/app/Messenger/components/InputFile/InputFile.tsx +147 -145
- package/src/app/Messenger/components/InputFile/inputFile.less +59 -59
- package/src/app/Messenger/components/MessageBallon/MessageBalloon.tsx +100 -100
- package/src/app/Messenger/components/MessengerAvatar/MessengerAvatar.tsx +29 -29
- package/src/app/Messenger/components/MessengerThemeWrapper/MessengerThemeWrapper.tsx +62 -62
- package/src/app/Messenger/components/RenderFileIcon/RenderFileIcon.tsx +40 -34
- package/src/app/Messenger/components/SearchInput/SearchInput.less +45 -45
- package/src/app/Messenger/components/SearchInput/SearchInput.tsx +77 -77
- package/src/app/Messenger/components/Select/Select.less +22 -22
- package/src/app/Messenger/components/Select/Select.tsx +56 -56
- package/src/app/Messenger/components/SendMessageForm/SendMessageForm.tsx +254 -234
- package/src/app/Messenger/components/SenderMessages/SenderMessages.tsx +91 -89
- package/src/app/Messenger/components/SystemMessage/SystemMessage.tsx +25 -25
- package/src/app/Messenger/components/TextArea/TextArea.tsx +35 -35
- package/src/app/Messenger/components/TextArea/Textarea.less +22 -22
- package/src/app/Messenger/components/Tooltip/Tooltip.less +27 -27
- package/src/app/Messenger/components/Tooltip/Tooltip.tsx +17 -17
- package/src/app/Messenger/hooks/useConversations.tsx +143 -143
- package/src/app/Messenger/hooks/useMessages.tsx +49 -49
- package/src/app/Messenger/hooks/useThemes.tsx +14 -14
- package/src/app/Messenger/icons/AttachFileIcon.tsx +20 -20
- package/src/app/Messenger/icons/CSVFileIcon.tsx +26 -0
- package/src/app/Messenger/icons/CloseIcon.tsx +20 -20
- package/src/app/Messenger/icons/DOCFileIcon.tsx +54 -54
- package/src/app/Messenger/icons/DownloadMinimalistIcon.tsx +37 -37
- package/src/app/Messenger/icons/EmptyIcon.tsx +20 -20
- package/src/app/Messenger/icons/MP4FileIcon.tsx +26 -0
- package/src/app/Messenger/icons/MessageIcon.tsx +27 -27
- package/src/app/Messenger/icons/PDFFileIcon.tsx +54 -54
- package/src/app/Messenger/icons/ReadIcon.tsx +18 -18
- package/src/app/Messenger/icons/SearchIcon.tsx +20 -20
- package/src/app/Messenger/icons/TimerIcon.tsx +18 -18
- package/src/app/Messenger/icons/TrashIcon.tsx +21 -21
- package/src/app/Messenger/views/Messenger.less +623 -623
- package/src/app/Messenger/views/MessengerList.tsx +170 -170
- package/src/app/Messenger/views/MessengerListItem.tsx +178 -178
- package/src/app/Messenger/views/MessengerMessages.tsx +414 -414
- package/src/app/Messenger/views/NewFormChat.tsx +145 -145
- package/src/app/i18n/index.ts +36 -36
- package/src/app/i18n/locales/en.json +64 -64
- package/src/app/i18n/locales/pt.json +64 -64
- package/src/assets/right-arrow.svg +9 -9
- package/src/index.ts +23 -23
- package/src/react-app-env.d.ts +19 -19
- package/src/setupTests.ts +5 -5
- package/src/styles/abstracts/animations.less +8 -8
- package/src/styles/abstracts/mixins.less +5 -5
- package/src/styles/abstracts/variables.less +31 -31
- package/src/styles/base/base.less +6 -6
- package/src/styles/index.less +5 -5
- package/src/types.ts +174 -174
- package/dist/agx-chat.min.js.map +0 -1
|
@@ -1,64 +1,64 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import useTheme from '../../hooks/useThemes'
|
|
3
|
-
|
|
4
|
-
interface INewChatButton {
|
|
5
|
-
removeActiveItem: (e: React.MouseEvent<HTMLElement, MouseEvent>) => void
|
|
6
|
-
messegerView: 'empty' | 'messages' | 'newChat'
|
|
7
|
-
chatButtons: {
|
|
8
|
-
label: string
|
|
9
|
-
onClick: () => void
|
|
10
|
-
type: string
|
|
11
|
-
canSee: boolean
|
|
12
|
-
disabled?: boolean
|
|
13
|
-
}[]
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
function ChatButtons ({ chatButtons, removeActiveItem }: INewChatButton) {
|
|
17
|
-
const { theme } = useTheme()
|
|
18
|
-
|
|
19
|
-
const getButtonType = (type: string, disabled?: boolean) => {
|
|
20
|
-
if (type === 'primary')
|
|
21
|
-
return {
|
|
22
|
-
background: disabled ? theme?.buttonsDisabled : theme?.buttonPrimary,
|
|
23
|
-
color: theme?.buttonPrimaryText,
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
if (type === 'outlined')
|
|
27
|
-
return {
|
|
28
|
-
background: 'transparent',
|
|
29
|
-
color: theme?.asideFontColor,
|
|
30
|
-
border: `${theme?.asideFontColor} 1px solid`,
|
|
31
|
-
}
|
|
32
|
-
return
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return (
|
|
36
|
-
<>
|
|
37
|
-
{chatButtons.map((button) => {
|
|
38
|
-
return (
|
|
39
|
-
button.canSee && (
|
|
40
|
-
<>
|
|
41
|
-
<button
|
|
42
|
-
key={`button-${button.label}`}
|
|
43
|
-
className={
|
|
44
|
-
button.disabled
|
|
45
|
-
? 'messenger__chat-button messenger__chat-button--disabled'
|
|
46
|
-
: 'messenger__chat-button'
|
|
47
|
-
}
|
|
48
|
-
onClick={(event) => {
|
|
49
|
-
button.onClick()
|
|
50
|
-
removeActiveItem(event)
|
|
51
|
-
}}
|
|
52
|
-
style={getButtonType(button.type, button.disabled)}
|
|
53
|
-
>
|
|
54
|
-
{button.label}
|
|
55
|
-
</button>
|
|
56
|
-
</>
|
|
57
|
-
)
|
|
58
|
-
)
|
|
59
|
-
})}
|
|
60
|
-
</>
|
|
61
|
-
)
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export default ChatButtons
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import useTheme from '../../hooks/useThemes'
|
|
3
|
+
|
|
4
|
+
interface INewChatButton {
|
|
5
|
+
removeActiveItem: (e: React.MouseEvent<HTMLElement, MouseEvent>) => void
|
|
6
|
+
messegerView: 'empty' | 'messages' | 'newChat'
|
|
7
|
+
chatButtons: {
|
|
8
|
+
label: string
|
|
9
|
+
onClick: () => void
|
|
10
|
+
type: string
|
|
11
|
+
canSee: boolean
|
|
12
|
+
disabled?: boolean
|
|
13
|
+
}[]
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function ChatButtons ({ chatButtons, removeActiveItem }: INewChatButton) {
|
|
17
|
+
const { theme } = useTheme()
|
|
18
|
+
|
|
19
|
+
const getButtonType = (type: string, disabled?: boolean) => {
|
|
20
|
+
if (type === 'primary')
|
|
21
|
+
return {
|
|
22
|
+
background: disabled ? theme?.buttonsDisabled : theme?.buttonPrimary,
|
|
23
|
+
color: theme?.buttonPrimaryText,
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (type === 'outlined')
|
|
27
|
+
return {
|
|
28
|
+
background: 'transparent',
|
|
29
|
+
color: theme?.asideFontColor,
|
|
30
|
+
border: `${theme?.asideFontColor} 1px solid`,
|
|
31
|
+
}
|
|
32
|
+
return
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<>
|
|
37
|
+
{chatButtons.map((button) => {
|
|
38
|
+
return (
|
|
39
|
+
button.canSee && (
|
|
40
|
+
<>
|
|
41
|
+
<button
|
|
42
|
+
key={`button-${button.label}`}
|
|
43
|
+
className={
|
|
44
|
+
button.disabled
|
|
45
|
+
? 'messenger__chat-button messenger__chat-button--disabled'
|
|
46
|
+
: 'messenger__chat-button'
|
|
47
|
+
}
|
|
48
|
+
onClick={(event) => {
|
|
49
|
+
button.onClick()
|
|
50
|
+
removeActiveItem(event)
|
|
51
|
+
}}
|
|
52
|
+
style={getButtonType(button.type, button.disabled)}
|
|
53
|
+
>
|
|
54
|
+
{button.label}
|
|
55
|
+
</button>
|
|
56
|
+
</>
|
|
57
|
+
)
|
|
58
|
+
)
|
|
59
|
+
})}
|
|
60
|
+
</>
|
|
61
|
+
)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export default ChatButtons
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
.chat-tabs {
|
|
2
|
-
display: flex;
|
|
3
|
-
justify-content: center;
|
|
4
|
-
align-items: center;
|
|
5
|
-
&__button {
|
|
6
|
-
background: transparent;
|
|
7
|
-
border: none;
|
|
8
|
-
border-bottom: 1px solid transparent;
|
|
9
|
-
cursor: pointer;
|
|
10
|
-
padding: 0.5rem 1rem;
|
|
11
|
-
margin-bottom: 0.5rem;
|
|
12
|
-
|
|
13
|
-
&--active {
|
|
14
|
-
border-bottom: 1px solid var(--secondary-color);
|
|
15
|
-
transition: 0.5s;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
1
|
+
.chat-tabs {
|
|
2
|
+
display: flex;
|
|
3
|
+
justify-content: center;
|
|
4
|
+
align-items: center;
|
|
5
|
+
&__button {
|
|
6
|
+
background: transparent;
|
|
7
|
+
border: none;
|
|
8
|
+
border-bottom: 1px solid transparent;
|
|
9
|
+
cursor: pointer;
|
|
10
|
+
padding: 0.5rem 1rem;
|
|
11
|
+
margin-bottom: 0.5rem;
|
|
12
|
+
|
|
13
|
+
&--active {
|
|
14
|
+
border-bottom: 1px solid var(--secondary-color);
|
|
15
|
+
transition: 0.5s;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import useTheme from '../../hooks/useThemes'
|
|
2
|
-
import { activeItem } from '../../views/MessengerListItem'
|
|
3
|
-
import React from 'react'
|
|
4
|
-
|
|
5
|
-
interface IProps {
|
|
6
|
-
handleChangeTickets: (tab: string) => void
|
|
7
|
-
chatListTabs: { value: string; label: string }[]
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
function ChatTabs ({ handleChangeTickets, chatListTabs }: IProps) {
|
|
11
|
-
const { theme } = useTheme()
|
|
12
|
-
return (
|
|
13
|
-
<div className='chat-tabs' style={{ color: theme.asideFontColor }}>
|
|
14
|
-
{chatListTabs.map((tab, index) => {
|
|
15
|
-
return (
|
|
16
|
-
<button
|
|
17
|
-
key={`chatListTab-${index}`}
|
|
18
|
-
className={`chat-tabs__button ${index === 0 && 'chat-tabs__button--active'}`}
|
|
19
|
-
onClick={(e) => {
|
|
20
|
-
handleChangeTickets(tab.value)
|
|
21
|
-
activeItem(e, 'chat-tabs__button', 'chat-tabs__button--active')
|
|
22
|
-
}}
|
|
23
|
-
>
|
|
24
|
-
{tab.label}
|
|
25
|
-
</button>
|
|
26
|
-
)
|
|
27
|
-
})}
|
|
28
|
-
</div>
|
|
29
|
-
)
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export default ChatTabs
|
|
1
|
+
import useTheme from '../../hooks/useThemes'
|
|
2
|
+
import { activeItem } from '../../views/MessengerListItem'
|
|
3
|
+
import React from 'react'
|
|
4
|
+
|
|
5
|
+
interface IProps {
|
|
6
|
+
handleChangeTickets: (tab: string) => void
|
|
7
|
+
chatListTabs: { value: string; label: string }[]
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function ChatTabs ({ handleChangeTickets, chatListTabs }: IProps) {
|
|
11
|
+
const { theme } = useTheme()
|
|
12
|
+
return (
|
|
13
|
+
<div className='chat-tabs' style={{ color: theme.asideFontColor }}>
|
|
14
|
+
{chatListTabs.map((tab, index) => {
|
|
15
|
+
return (
|
|
16
|
+
<button
|
|
17
|
+
key={`chatListTab-${index}`}
|
|
18
|
+
className={`chat-tabs__button ${index === 0 && 'chat-tabs__button--active'}`}
|
|
19
|
+
onClick={(e) => {
|
|
20
|
+
handleChangeTickets(tab.value)
|
|
21
|
+
activeItem(e, 'chat-tabs__button', 'chat-tabs__button--active')
|
|
22
|
+
}}
|
|
23
|
+
>
|
|
24
|
+
{tab.label}
|
|
25
|
+
</button>
|
|
26
|
+
)
|
|
27
|
+
})}
|
|
28
|
+
</div>
|
|
29
|
+
)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export default ChatTabs
|
|
@@ -1,71 +1,71 @@
|
|
|
1
|
-
.messenger {
|
|
2
|
-
&__messages-row--sender {
|
|
3
|
-
display: flex;
|
|
4
|
-
justify-content: flex-end;
|
|
5
|
-
margin: 10px 0;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
&__messages-sender {
|
|
9
|
-
max-width: 80%;
|
|
10
|
-
padding: 10px;
|
|
11
|
-
border-radius: 8px;
|
|
12
|
-
font-family: 'Arial', sans-serif;
|
|
13
|
-
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
&__file-card {
|
|
17
|
-
display: flex;
|
|
18
|
-
align-items: center;
|
|
19
|
-
background: rgba(0, 0, 0, 0.1);
|
|
20
|
-
border-radius: 8px;
|
|
21
|
-
padding: 10px;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
&__file-icon {
|
|
25
|
-
flex-shrink: 0;
|
|
26
|
-
width: 40px;
|
|
27
|
-
height: 40px;
|
|
28
|
-
display: flex;
|
|
29
|
-
align-items: center;
|
|
30
|
-
justify-content: center;
|
|
31
|
-
border-radius: 4px;
|
|
32
|
-
margin-right: 10px;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
&__file-details {
|
|
36
|
-
flex-grow: 1;
|
|
37
|
-
margin-right: 10px;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
&__file-name {
|
|
41
|
-
font-weight: bold;
|
|
42
|
-
font-size: 14px;
|
|
43
|
-
margin: 0;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
&__file-info {
|
|
47
|
-
font-size: 12px;
|
|
48
|
-
color: rgba(255, 255, 255, 0.8);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
&__file-download {
|
|
52
|
-
font-size: 12px;
|
|
53
|
-
text-decoration: none;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
&__file-download:hover {
|
|
57
|
-
text-decoration: underline;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
&__message--bottom {
|
|
61
|
-
display: flex;
|
|
62
|
-
justify-content: space-between;
|
|
63
|
-
align-items: center;
|
|
64
|
-
margin-top: 5px;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
&__message--date {
|
|
68
|
-
font-size: 12px;
|
|
69
|
-
color: rgba(255, 255, 255, 0.8);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
1
|
+
.messenger {
|
|
2
|
+
&__messages-row--sender {
|
|
3
|
+
display: flex;
|
|
4
|
+
justify-content: flex-end;
|
|
5
|
+
margin: 10px 0;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
&__messages-sender {
|
|
9
|
+
max-width: 80%;
|
|
10
|
+
padding: 10px;
|
|
11
|
+
border-radius: 8px;
|
|
12
|
+
font-family: 'Arial', sans-serif;
|
|
13
|
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
&__file-card {
|
|
17
|
+
display: flex;
|
|
18
|
+
align-items: center;
|
|
19
|
+
background: rgba(0, 0, 0, 0.1);
|
|
20
|
+
border-radius: 8px;
|
|
21
|
+
padding: 10px;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
&__file-icon {
|
|
25
|
+
flex-shrink: 0;
|
|
26
|
+
width: 40px;
|
|
27
|
+
height: 40px;
|
|
28
|
+
display: flex;
|
|
29
|
+
align-items: center;
|
|
30
|
+
justify-content: center;
|
|
31
|
+
border-radius: 4px;
|
|
32
|
+
margin-right: 10px;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
&__file-details {
|
|
36
|
+
flex-grow: 1;
|
|
37
|
+
margin-right: 10px;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&__file-name {
|
|
41
|
+
font-weight: bold;
|
|
42
|
+
font-size: 14px;
|
|
43
|
+
margin: 0;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
&__file-info {
|
|
47
|
+
font-size: 12px;
|
|
48
|
+
color: rgba(255, 255, 255, 0.8);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
&__file-download {
|
|
52
|
+
font-size: 12px;
|
|
53
|
+
text-decoration: none;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
&__file-download:hover {
|
|
57
|
+
text-decoration: underline;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
&__message--bottom {
|
|
61
|
+
display: flex;
|
|
62
|
+
justify-content: space-between;
|
|
63
|
+
align-items: center;
|
|
64
|
+
margin-top: 5px;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
&__message--date {
|
|
68
|
+
font-size: 12px;
|
|
69
|
+
color: rgba(255, 255, 255, 0.8);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import DownloadMinimalistIcon from '../../icons/DownloadMinimalistIcon'
|
|
3
|
-
import { IMessagesBalloon } from 'types'
|
|
4
|
-
import RenderFileIcon from '../RenderFileIcon/RenderFileIcon'
|
|
5
|
-
|
|
6
|
-
export function formatFileSize (size = 0) {
|
|
7
|
-
if (size % 1 === 0) {
|
|
8
|
-
return `${size.toFixed(0)} MB`
|
|
9
|
-
}
|
|
10
|
-
return `${size.toFixed(2)} MB`
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
function DocMessage ({ file }: IMessagesBalloon) {
|
|
14
|
-
const fileType = file?.location?.split('.').pop()?.toUpperCase()
|
|
15
|
-
const fileName = file && file.originalname
|
|
16
|
-
const filePages = file && file.pages
|
|
17
|
-
const fileSize = file && formatFileSize(file?.size)
|
|
18
|
-
|
|
19
|
-
return (
|
|
20
|
-
<div className='messenger__messages-row--sender'>
|
|
21
|
-
<span>
|
|
22
|
-
{
|
|
23
|
-
<div className='messenger__file-card'>
|
|
24
|
-
<div className='messenger__file-icon'>
|
|
25
|
-
<RenderFileIcon fileType={file?.mimetype} />
|
|
26
|
-
</div>
|
|
27
|
-
<div className='messenger__file-details'>
|
|
28
|
-
<p className='messenger__file-name'>{fileName}</p>
|
|
29
|
-
<p className='messenger__file-info'>
|
|
30
|
-
{filePages && filePages + ' página(s) •'} {fileSize} •{' '}
|
|
31
|
-
{fileType}
|
|
32
|
-
</p>
|
|
33
|
-
</div>
|
|
34
|
-
<a
|
|
35
|
-
href={file?.location}
|
|
36
|
-
target='_blank'
|
|
37
|
-
rel='noopener noreferrer'
|
|
38
|
-
className='messenger__file-download'
|
|
39
|
-
style={{ color: 'blue' }}
|
|
40
|
-
>
|
|
41
|
-
<DownloadMinimalistIcon width='24' height='24' color='white' />
|
|
42
|
-
</a>
|
|
43
|
-
</div>
|
|
44
|
-
}
|
|
45
|
-
</span>
|
|
46
|
-
</div>
|
|
47
|
-
)
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export default DocMessage
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import DownloadMinimalistIcon from '../../icons/DownloadMinimalistIcon'
|
|
3
|
+
import { IMessagesBalloon } from 'types'
|
|
4
|
+
import RenderFileIcon from '../RenderFileIcon/RenderFileIcon'
|
|
5
|
+
|
|
6
|
+
export function formatFileSize (size = 0) {
|
|
7
|
+
if (size % 1 === 0) {
|
|
8
|
+
return `${size.toFixed(0)} MB`
|
|
9
|
+
}
|
|
10
|
+
return `${size.toFixed(2)} MB`
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function DocMessage ({ file }: IMessagesBalloon) {
|
|
14
|
+
const fileType = file?.location?.split('.').pop()?.toUpperCase()
|
|
15
|
+
const fileName = file && file.originalname
|
|
16
|
+
const filePages = file && file.pages
|
|
17
|
+
const fileSize = file && formatFileSize(file?.size)
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<div className='messenger__messages-row--sender'>
|
|
21
|
+
<span>
|
|
22
|
+
{
|
|
23
|
+
<div className='messenger__file-card'>
|
|
24
|
+
<div className='messenger__file-icon'>
|
|
25
|
+
<RenderFileIcon fileType={file?.mimetype} />
|
|
26
|
+
</div>
|
|
27
|
+
<div className='messenger__file-details'>
|
|
28
|
+
<p className='messenger__file-name'>{fileName}</p>
|
|
29
|
+
<p className='messenger__file-info'>
|
|
30
|
+
{filePages && filePages + ' página(s) •'} {fileSize} •{' '}
|
|
31
|
+
{fileType}
|
|
32
|
+
</p>
|
|
33
|
+
</div>
|
|
34
|
+
<a
|
|
35
|
+
href={file?.location}
|
|
36
|
+
target='_blank'
|
|
37
|
+
rel='noopener noreferrer'
|
|
38
|
+
className='messenger__file-download'
|
|
39
|
+
style={{ color: 'blue' }}
|
|
40
|
+
>
|
|
41
|
+
<DownloadMinimalistIcon width='24' height='24' color='white' />
|
|
42
|
+
</a>
|
|
43
|
+
</div>
|
|
44
|
+
}
|
|
45
|
+
</span>
|
|
46
|
+
</div>
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export default DocMessage
|
|
@@ -1,79 +1,79 @@
|
|
|
1
|
-
.images-container {
|
|
2
|
-
width: 100%;
|
|
3
|
-
height: 90%;
|
|
4
|
-
border: 2px solid @secondary-bg-color-chat;
|
|
5
|
-
background-color: @component-background;
|
|
6
|
-
border-bottom: none;
|
|
7
|
-
border-radius: 0 @border-radius 0 0;
|
|
8
|
-
@media @tab-md {
|
|
9
|
-
border-radius: @border-radius @border-radius 0 0 !important;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
&__close {
|
|
13
|
-
width: 100%;
|
|
14
|
-
position: relative;
|
|
15
|
-
margin-top: 15px;
|
|
16
|
-
display: flex;
|
|
17
|
-
justify-content: flex-end;
|
|
18
|
-
align-items: center;
|
|
19
|
-
|
|
20
|
-
&--icon {
|
|
21
|
-
width: 32px;
|
|
22
|
-
height: 32px;
|
|
23
|
-
cursor: pointer;
|
|
24
|
-
background-color: transparent;
|
|
25
|
-
outline: none;
|
|
26
|
-
border: none;
|
|
27
|
-
|
|
28
|
-
&:hover {
|
|
29
|
-
opacity: 75%;
|
|
30
|
-
transition: 200ms;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
&::before,
|
|
34
|
-
&::after {
|
|
35
|
-
position: absolute;
|
|
36
|
-
right: 25px;
|
|
37
|
-
top: 0;
|
|
38
|
-
content: ' ';
|
|
39
|
-
height: 33px;
|
|
40
|
-
width: 2px;
|
|
41
|
-
background-color: red;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
&:after {
|
|
45
|
-
transform: rotate(45deg);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
&:before {
|
|
49
|
-
transform: rotate(-45deg);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
&__container {
|
|
55
|
-
width: 100%;
|
|
56
|
-
height: 100%;
|
|
57
|
-
|
|
58
|
-
display: flex;
|
|
59
|
-
align-items: center;
|
|
60
|
-
justify-content: center;
|
|
61
|
-
color: @title-form-color;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
&__image {
|
|
65
|
-
display: flex;
|
|
66
|
-
flex-direction: column;
|
|
67
|
-
align-items: center;
|
|
68
|
-
width: 100%;
|
|
69
|
-
padding: 0 10px;
|
|
70
|
-
max-width: 700px;
|
|
71
|
-
max-height: 300px;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
&__title-img {
|
|
75
|
-
width: 100%;
|
|
76
|
-
text-align: center;
|
|
77
|
-
word-wrap: break-word;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
1
|
+
.images-container {
|
|
2
|
+
width: 100%;
|
|
3
|
+
height: 90%;
|
|
4
|
+
border: 2px solid @secondary-bg-color-chat;
|
|
5
|
+
background-color: @component-background;
|
|
6
|
+
border-bottom: none;
|
|
7
|
+
border-radius: 0 @border-radius 0 0;
|
|
8
|
+
@media @tab-md {
|
|
9
|
+
border-radius: @border-radius @border-radius 0 0 !important;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
&__close {
|
|
13
|
+
width: 100%;
|
|
14
|
+
position: relative;
|
|
15
|
+
margin-top: 15px;
|
|
16
|
+
display: flex;
|
|
17
|
+
justify-content: flex-end;
|
|
18
|
+
align-items: center;
|
|
19
|
+
|
|
20
|
+
&--icon {
|
|
21
|
+
width: 32px;
|
|
22
|
+
height: 32px;
|
|
23
|
+
cursor: pointer;
|
|
24
|
+
background-color: transparent;
|
|
25
|
+
outline: none;
|
|
26
|
+
border: none;
|
|
27
|
+
|
|
28
|
+
&:hover {
|
|
29
|
+
opacity: 75%;
|
|
30
|
+
transition: 200ms;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&::before,
|
|
34
|
+
&::after {
|
|
35
|
+
position: absolute;
|
|
36
|
+
right: 25px;
|
|
37
|
+
top: 0;
|
|
38
|
+
content: ' ';
|
|
39
|
+
height: 33px;
|
|
40
|
+
width: 2px;
|
|
41
|
+
background-color: red;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
&:after {
|
|
45
|
+
transform: rotate(45deg);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
&:before {
|
|
49
|
+
transform: rotate(-45deg);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
&__container {
|
|
55
|
+
width: 100%;
|
|
56
|
+
height: 100%;
|
|
57
|
+
|
|
58
|
+
display: flex;
|
|
59
|
+
align-items: center;
|
|
60
|
+
justify-content: center;
|
|
61
|
+
color: @title-form-color;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
&__image {
|
|
65
|
+
display: flex;
|
|
66
|
+
flex-direction: column;
|
|
67
|
+
align-items: center;
|
|
68
|
+
width: 100%;
|
|
69
|
+
padding: 0 10px;
|
|
70
|
+
max-width: 700px;
|
|
71
|
+
max-height: 300px;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
&__title-img {
|
|
75
|
+
width: 100%;
|
|
76
|
+
text-align: center;
|
|
77
|
+
word-wrap: break-word;
|
|
78
|
+
}
|
|
79
|
+
}
|