@messenger-box/platform-browser 10.0.3-alpha.54 → 10.0.3-alpha.61
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/CHANGELOG.md +8 -0
- package/lib/components/InboxMessage/InboxDetails/index.d.ts +6 -1
- package/lib/components/InboxMessage/InboxDetails/index.d.ts.map +1 -1
- package/lib/components/InboxMessage/InboxDetails/index.js +10 -11
- package/lib/components/InboxMessage/InboxDetails/index.js.map +1 -1
- package/lib/components/InboxMessage/InboxSidebar/index.d.ts.map +1 -1
- package/lib/components/InboxMessage/InboxSidebar/index.js +23 -32
- package/lib/components/InboxMessage/InboxSidebar/index.js.map +1 -1
- package/lib/components/InboxMessage/Messages/index.d.ts.map +1 -1
- package/lib/components/InboxMessage/Messages/index.js +42 -81
- package/lib/components/InboxMessage/Messages/index.js.map +1 -1
- package/lib/components/InboxMessage/MessagesList/index.d.ts.map +1 -1
- package/lib/components/InboxMessage/MessagesList/index.js +53 -74
- package/lib/components/InboxMessage/MessagesList/index.js.map +1 -1
- package/lib/components/InboxMessage/Popover/index.d.ts +5 -1
- package/lib/components/InboxMessage/Popover/index.d.ts.map +1 -1
- package/lib/components/InboxMessage/Popover/index.js +8 -35
- package/lib/components/InboxMessage/Popover/index.js.map +1 -1
- package/lib/components/InboxMessage/UserModalContent/index.d.ts.map +1 -1
- package/lib/components/InboxMessage/UserModalContent/index.js +50 -47
- package/lib/components/InboxMessage/UserModalContent/index.js.map +1 -1
- package/lib/components/InboxMessage/index.d.ts.map +1 -1
- package/lib/components/InboxMessage/index.js +38 -70
- package/lib/components/InboxMessage/index.js.map +1 -1
- package/lib/components/dashboard/menu_header.d.ts.map +1 -1
- package/lib/components/dashboard/menu_header.js +38 -24
- package/lib/components/dashboard/menu_header.js.map +1 -1
- package/lib/components/dashboard/modals/direct_modal.d.ts +10 -8
- package/lib/components/dashboard/modals/direct_modal.d.ts.map +1 -1
- package/lib/components/dashboard/modals/direct_modal.js +59 -39
- package/lib/components/dashboard/modals/direct_modal.js.map +1 -1
- package/lib/components/dashboard/modals.d.ts +18 -6
- package/lib/components/dashboard/modals.d.ts.map +1 -1
- package/lib/components/dashboard/modals.js +60 -101
- package/lib/components/dashboard/modals.js.map +1 -1
- package/lib/components/messenger/avatar/index.d.ts.map +1 -1
- package/lib/components/messenger/index.d.ts.map +1 -1
- package/lib/components/messenger/index.js +45 -82
- package/lib/components/messenger/index.js.map +1 -1
- package/lib/components/messenger/messagesList/index.d.ts.map +1 -1
- package/lib/components/messenger/messagesList/index.js +173 -453
- package/lib/components/messenger/messagesList/index.js.map +1 -1
- package/lib/components/messenger/messagesList/messageBox.d.ts +0 -1
- package/lib/components/messenger/messagesList/messageBox.d.ts.map +1 -1
- package/lib/components/messenger/more_action/index.d.ts.map +1 -1
- package/lib/components/messenger/postMessage/postMessage.d.ts +7 -2
- package/lib/components/messenger/postMessage/postMessage.d.ts.map +1 -1
- package/lib/components/messenger/sidebarThreadList/index.d.ts.map +1 -1
- package/lib/components/messenger/threadSidebar/index.d.ts.map +1 -1
- package/lib/components/messenger/types/message.d.ts +11 -11
- package/lib/components/messenger/types/message.d.ts.map +1 -1
- package/lib/components/post/create_post/create_post.d.ts +10 -1
- package/lib/components/post/create_post/create_post.d.ts.map +1 -1
- package/lib/components/post/index.d.ts +5 -3
- package/lib/components/post/index.d.ts.map +1 -1
- package/lib/components/post/index.js +63 -97
- package/lib/components/post/index.js.map +1 -1
- package/lib/components/post/post_header/post_header_custom_status.d.ts.map +1 -1
- package/lib/containers/Dashboard.d.ts.map +1 -1
- package/lib/containers/Dashboard.js +86 -112
- package/lib/containers/Dashboard.js.map +1 -1
- package/lib/containers/DashboardWithLoader.d.ts.map +1 -1
- package/lib/containers/DashboardWithLoader.js +10 -3
- package/lib/containers/DashboardWithLoader.js.map +1 -1
- package/package.json +4 -4
- package/src/components/InboxMessage/InboxDetails/index.tsx +13 -15
- package/src/components/InboxMessage/InboxSidebar/index.tsx +23 -33
- package/src/components/InboxMessage/Messages/index.tsx +54 -93
- package/src/components/InboxMessage/MessagesList/index.tsx +69 -81
- package/src/components/InboxMessage/Popover/index.tsx +14 -38
- package/src/components/InboxMessage/UserModalContent/index.tsx +39 -42
- package/src/components/InboxMessage/index.tsx +50 -65
- package/src/components/dashboard/menu_header.tsx +50 -43
- package/src/components/dashboard/modals/direct_modal.tsx +72 -39
- package/src/components/dashboard/modals.tsx +113 -104
- package/src/components/messenger/avatar/index.tsx +27 -13
- package/src/components/messenger/index.tsx +124 -159
- package/src/components/messenger/messagesList/index.tsx +266 -557
- package/src/components/messenger/messagesList/messageBox.tsx +45 -34
- package/src/components/messenger/more_action/index.tsx +16 -10
- package/src/components/messenger/postMessage/postMessage.tsx +28 -16
- package/src/components/messenger/sidebarThreadList/index.tsx +45 -173
- package/src/components/messenger/threadSidebar/index.tsx +86 -73
- package/src/components/messenger/types/message.ts +12 -11
- package/src/components/post/channel_view/channel_view.tsx +2 -2
- package/src/components/post/create_post/create_post.tsx +103 -195
- package/src/components/post/index.tsx +69 -94
- package/src/components/post/post_header/post_header_custom_status.tsx +7 -6
- package/src/components/post/post_header/style.ts +51 -51
- package/src/containers/Dashboard.tsx +119 -184
- package/src/containers/DashboardWithLoader.tsx +12 -4
- package/lib/components/InboxMessage/InboxDetails/style.d.ts +0 -2
- package/lib/components/InboxMessage/InboxDetails/style.d.ts.map +0 -1
- package/lib/components/InboxMessage/InboxDetails/style.js +0 -27
- package/lib/components/InboxMessage/InboxDetails/style.js.map +0 -1
- package/lib/components/InboxMessage/InboxSidebar/styles.d.ts +0 -2
- package/lib/components/InboxMessage/InboxSidebar/styles.d.ts.map +0 -1
- package/lib/components/InboxMessage/InboxSidebar/styles.js +0 -57
- package/lib/components/InboxMessage/InboxSidebar/styles.js.map +0 -1
- package/lib/components/InboxMessage/Messages/styles.d.ts +0 -81
- package/lib/components/InboxMessage/Messages/styles.d.ts.map +0 -1
- package/lib/components/InboxMessage/Messages/styles.js +0 -85
- package/lib/components/InboxMessage/Messages/styles.js.map +0 -1
- package/lib/components/InboxMessage/Popover/style.d.ts +0 -28
- package/lib/components/InboxMessage/Popover/style.d.ts.map +0 -1
- package/lib/components/InboxMessage/Popover/style.js +0 -27
- package/lib/components/InboxMessage/Popover/style.js.map +0 -1
- package/lib/components/InboxMessage/UserModalContent/style.d.ts +0 -2
- package/lib/components/InboxMessage/UserModalContent/style.d.ts.map +0 -1
- package/lib/components/InboxMessage/UserModalContent/style.js +0 -98
- package/lib/components/InboxMessage/UserModalContent/style.js.map +0 -1
- package/lib/components/InboxMessage/style.js +0 -189
- package/lib/components/InboxMessage/style.js.map +0 -1
- package/lib/components/messenger/avatar/style.d.ts +0 -2
- package/lib/components/messenger/avatar/style.d.ts.map +0 -1
- package/lib/components/messenger/messagesList/style.js +0 -446
- package/lib/components/messenger/messagesList/style.js.map +0 -1
- package/lib/components/messenger/more_action/index.js +0 -48
- package/lib/components/messenger/more_action/index.js.map +0 -1
- package/lib/components/messenger/more_action/style.d.ts +0 -2
- package/lib/components/messenger/more_action/style.d.ts.map +0 -1
- package/lib/components/messenger/more_action/style.js +0 -45
- package/lib/components/messenger/more_action/style.js.map +0 -1
- package/lib/components/post/style.js +0 -20101
- package/lib/components/post/style.js.map +0 -1
- package/lib/style.js +0 -400
- package/lib/style.js.map +0 -1
- package/src/components/InboxMessage/InboxDetails/style.ts +0 -27
- package/src/components/InboxMessage/InboxSidebar/styles.ts +0 -57
- package/src/components/InboxMessage/Messages/styles.ts +0 -85
- package/src/components/InboxMessage/Popover/style.ts +0 -27
- package/src/components/InboxMessage/UserModalContent/style.ts +0 -98
- package/src/components/messenger/avatar/style.ts +0 -86
- package/src/components/messenger/more_action/style.ts +0 -45
|
@@ -2,23 +2,23 @@ import React, { useState, useRef, useEffect } from 'react';
|
|
|
2
2
|
import { MessagesList } from './../messagesList/index';
|
|
3
3
|
import { messagesData } from './../mock';
|
|
4
4
|
import { IMessageList } from './../types/message';
|
|
5
|
-
import { css } from '@emotion/css';
|
|
6
|
-
import { Input, Col, Row } from 'antd';
|
|
7
5
|
import { AiOutlineClose } from '@react-icons/all-files/ai/AiOutlineClose';
|
|
8
6
|
import { HiOutlinePaperClip } from 'react-icons/hi';
|
|
9
7
|
import { MdOutlineEmojiEmotions } from 'react-icons/md';
|
|
10
8
|
import { useTranslation } from 'react-i18next';
|
|
11
9
|
import { Picker } from 'emoji-mart';
|
|
12
|
-
import { styleSheet } from './style';
|
|
13
10
|
import { PostMessage } from './../postMessage/postMessage';
|
|
14
11
|
import { SidebarThreadList } from './../sidebarThreadList';
|
|
15
12
|
|
|
16
13
|
export const ThreadSidebar = (props) => {
|
|
17
|
-
// const { handleEnterButton } = props;
|
|
18
14
|
const [enterValue, setEnterValue] = useState<string>('');
|
|
19
15
|
const { t } = useTranslation();
|
|
20
16
|
const [flag, setFlag] = useState<boolean>(false);
|
|
21
17
|
const [userMessagesReplyList, setUserMessagesReplyList] = useState<IMessageList | any>([]);
|
|
18
|
+
const [displayEmoji, setDisplayEmoji] = useState(false);
|
|
19
|
+
const messagesEndRef = useRef(null);
|
|
20
|
+
const fileUploader = useRef(null);
|
|
21
|
+
|
|
22
22
|
useEffect(() => {
|
|
23
23
|
if (flag === true) {
|
|
24
24
|
setTimeout(() => {
|
|
@@ -36,94 +36,107 @@ export const ThreadSidebar = (props) => {
|
|
|
36
36
|
}
|
|
37
37
|
scrollToBottom();
|
|
38
38
|
}, [flag]);
|
|
39
|
-
|
|
39
|
+
|
|
40
40
|
const scrollToBottom = () => {
|
|
41
41
|
messagesEndRef.current?.scrollIntoView({ behavior: 'smooth' });
|
|
42
42
|
};
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
43
|
+
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
const handleClickOutside = () => {
|
|
46
|
+
setDisplayEmoji(false);
|
|
47
|
+
};
|
|
48
|
+
document.body.addEventListener('click', handleClickOutside);
|
|
49
|
+
return () => {
|
|
50
|
+
document.body.removeEventListener('click', handleClickOutside);
|
|
51
|
+
};
|
|
52
|
+
}, []);
|
|
53
|
+
|
|
54
|
+
const emojiClick = (e: React.MouseEvent) => {
|
|
55
|
+
e.stopPropagation();
|
|
48
56
|
setDisplayEmoji(true);
|
|
49
57
|
};
|
|
50
|
-
|
|
58
|
+
|
|
51
59
|
const fileClick = () => {
|
|
52
60
|
fileUploader.current.click();
|
|
53
61
|
};
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
62
|
+
|
|
63
|
+
const handleEnterButton = (e: React.KeyboardEvent<HTMLInputElement>) => {
|
|
64
|
+
if (e.key === 'Enter' && enterValue.trim()) {
|
|
65
|
+
setUserMessagesReplyList([
|
|
66
|
+
...userMessagesReplyList,
|
|
67
|
+
{
|
|
68
|
+
threadId: Math.random(),
|
|
69
|
+
message: enterValue,
|
|
70
|
+
loginUser: true,
|
|
71
|
+
timeIsToday: true,
|
|
72
|
+
},
|
|
73
|
+
]);
|
|
74
|
+
setEnterValue('');
|
|
75
|
+
setFlag(true);
|
|
76
|
+
}
|
|
67
77
|
};
|
|
68
78
|
|
|
69
79
|
return (
|
|
70
|
-
<div className=
|
|
71
|
-
<
|
|
72
|
-
<
|
|
73
|
-
<AiOutlineClose />
|
|
74
|
-
</
|
|
75
|
-
</
|
|
76
|
-
|
|
80
|
+
<div className="flex flex-col h-full bg-white">
|
|
81
|
+
<div className="flex justify-end p-4">
|
|
82
|
+
<button className="text-gray-500 hover:text-gray-700 transition-colors">
|
|
83
|
+
<AiOutlineClose className="w-5 h-5" />
|
|
84
|
+
</button>
|
|
85
|
+
</div>
|
|
86
|
+
|
|
87
|
+
<div className="flex-1 overflow-y-auto">
|
|
77
88
|
<SidebarThreadList userMessagesList={userMessagesReplyList} />
|
|
78
89
|
<div ref={messagesEndRef} />
|
|
79
|
-
</
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
// skinEmoji=""
|
|
100
|
-
notFoundEmoji="sleuth_or_spy"
|
|
101
|
-
/>
|
|
102
|
-
) : (
|
|
103
|
-
''
|
|
90
|
+
</div>
|
|
91
|
+
|
|
92
|
+
<div className="p-4 border-t border-gray-200">
|
|
93
|
+
<div className="relative">
|
|
94
|
+
{displayEmoji && (
|
|
95
|
+
<div className="absolute bottom-full mb-2">
|
|
96
|
+
<Picker
|
|
97
|
+
native={true}
|
|
98
|
+
set="apple"
|
|
99
|
+
emoji="point_up"
|
|
100
|
+
title={t('messenger_box_browser.pick_your_emoji')}
|
|
101
|
+
emojiSize={24}
|
|
102
|
+
perLine={6}
|
|
103
|
+
color="#ae65c5"
|
|
104
|
+
sheetSize={16}
|
|
105
|
+
showPreview={true}
|
|
106
|
+
showSkinTones={false}
|
|
107
|
+
notFoundEmoji="sleuth_or_spy"
|
|
108
|
+
/>
|
|
109
|
+
</div>
|
|
104
110
|
)}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
111
|
+
|
|
112
|
+
<div className="flex items-center space-x-2 bg-white rounded-lg border border-gray-300 focus-within:border-blue-500 focus-within:ring-1 focus-within:ring-blue-500">
|
|
113
|
+
<input
|
|
114
|
+
type="text"
|
|
115
|
+
value={enterValue}
|
|
116
|
+
onChange={(e) => setEnterValue(e.target.value)}
|
|
117
|
+
onKeyPress={handleEnterButton}
|
|
118
|
+
placeholder={t('messenger_box_browser.please_enter')}
|
|
119
|
+
className="flex-1 px-4 py-2 bg-transparent outline-none placeholder-gray-500"
|
|
120
|
+
/>
|
|
121
|
+
|
|
122
|
+
<div className="flex items-center space-x-2 px-2">
|
|
123
|
+
<input type="file" ref={fileUploader} className="hidden" />
|
|
124
|
+
<button
|
|
125
|
+
onClick={fileClick}
|
|
126
|
+
className="text-gray-500 hover:text-gray-700 p-1 rounded-full hover:bg-gray-100 transition-colors"
|
|
127
|
+
>
|
|
128
|
+
<HiOutlinePaperClip className="w-5 h-5" />
|
|
117
129
|
</button>
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
130
|
+
<button
|
|
131
|
+
onClick={emojiClick}
|
|
132
|
+
className="text-gray-500 hover:text-gray-700 p-1 rounded-full hover:bg-gray-100 transition-colors"
|
|
133
|
+
>
|
|
134
|
+
<MdOutlineEmojiEmotions className="w-5 h-5" />
|
|
122
135
|
</button>
|
|
123
136
|
</div>
|
|
124
137
|
</div>
|
|
125
138
|
</div>
|
|
126
|
-
</
|
|
139
|
+
</div>
|
|
127
140
|
</div>
|
|
128
141
|
);
|
|
129
142
|
};
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
+
export interface IUser {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
avatar?: string;
|
|
5
|
+
}
|
|
6
|
+
|
|
1
7
|
export interface IMessageList {
|
|
2
|
-
id:
|
|
3
|
-
loginUser: boolean;
|
|
8
|
+
id: string;
|
|
4
9
|
message: string;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
isPin?: boolean
|
|
10
|
+
user_id: string;
|
|
11
|
+
create_at: number;
|
|
12
|
+
user?: IUser;
|
|
9
13
|
}
|
|
10
14
|
|
|
11
|
-
export interface IMessageReplyList {
|
|
12
|
-
|
|
13
|
-
message: string
|
|
14
|
-
time: string;
|
|
15
|
-
timeIsToday: boolean;
|
|
15
|
+
export interface IMessageReplyList extends IMessageList {
|
|
16
|
+
isBot?: boolean;
|
|
16
17
|
}
|
|
@@ -44,7 +44,7 @@ export const ChannelView = (props) => {
|
|
|
44
44
|
|
|
45
45
|
let createPost;
|
|
46
46
|
if (deactivatedChannel) {
|
|
47
|
-
console.log(deactivatedChannel,'deactivatedChannel');
|
|
47
|
+
console.log(deactivatedChannel, 'deactivatedChannel');
|
|
48
48
|
createPost = (
|
|
49
49
|
<div className="post-create__container" id="post-create">
|
|
50
50
|
<div className="channel-archived__message">
|
|
@@ -75,7 +75,7 @@ export const ChannelView = (props) => {
|
|
|
75
75
|
} else if (!baseProps.channelRolesLoading) {
|
|
76
76
|
createPost = (
|
|
77
77
|
<div className="post-create__container" id="post-create">
|
|
78
|
-
<CreatePost
|
|
78
|
+
<CreatePost />
|
|
79
79
|
</div>
|
|
80
80
|
);
|
|
81
81
|
}
|
|
@@ -5,18 +5,25 @@ import * as Utils from '../../../utils/utils';
|
|
|
5
5
|
import { t } from '../../../utils/i18n';
|
|
6
6
|
import { FormattedMessage } from 'react-intl';
|
|
7
7
|
import TutorialTip from '../../post/tutorial/tutorial_tip/tutorial_tip';
|
|
8
|
+
import { MdOutlineEmojiEmotions, MdAttachFile } from 'react-icons/md';
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
id: 'owsyt8n43jfxjpzh9np93mx1wa',
|
|
13
|
-
type: 'O',
|
|
14
|
-
display_name: 'default name',
|
|
10
|
+
interface CreatePostProps {
|
|
11
|
+
draft?: {
|
|
12
|
+
message?: string;
|
|
15
13
|
};
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
fullWidthTextBox?: boolean;
|
|
15
|
+
canPost?: boolean;
|
|
16
|
+
readOnlyChannel?: boolean;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const CreatePost: React.FC<CreatePostProps> = ({
|
|
20
|
+
draft,
|
|
21
|
+
fullWidthTextBox,
|
|
22
|
+
canPost = true,
|
|
23
|
+
readOnlyChannel = false,
|
|
24
|
+
}) => {
|
|
25
|
+
const [message, setMessage] = useState(draft?.message || '');
|
|
26
|
+
const [caretPosition, setCaretPosition] = useState(draft?.message?.length || 0);
|
|
20
27
|
const [submitting, setSubmitting] = useState(false);
|
|
21
28
|
const [showPostDeletedModal, setShowPostDeletedModal] = useState(false);
|
|
22
29
|
const [showEmojiPicker, setShowEmojiPicker] = useState(false);
|
|
@@ -25,201 +32,102 @@ export const CreatePost = (props) => {
|
|
|
25
32
|
const [uploadsProgressPercent, setUploadsProgressPercent] = useState({});
|
|
26
33
|
const [renderScrollbar, setRenderScrollbar] = useState(false);
|
|
27
34
|
const [scrollbarWidth, setScrollbarWidth] = useState(0);
|
|
28
|
-
const [
|
|
29
|
-
const [
|
|
30
|
-
const [memberNotifyCount, setMemberNotifyCount] = useState(0);
|
|
31
|
-
const [errorClass, setErrorClass] = useState(null);
|
|
32
|
-
const [serverError, setServerError] = useState(null);
|
|
35
|
+
const [errorClass, setErrorClass] = useState<string | null>(null);
|
|
36
|
+
const [serverError, setServerError] = useState<string | null>(null);
|
|
33
37
|
const [showTutorialTip, setShowTutorialTip] = useState(true);
|
|
34
38
|
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
const topDiv = useRef();
|
|
38
|
-
const textboxRef = useRef();
|
|
39
|
-
const fileUploadRef = useRef();
|
|
40
|
-
const createPostControlsRef = useRef();
|
|
41
|
-
|
|
42
|
-
const ariaLabelMessageInput = Utils.localizeMessage(
|
|
43
|
-
'accessibility.sections.centerFooter',
|
|
44
|
-
'message input complimentary region',
|
|
45
|
-
);
|
|
39
|
+
const textboxRef = useRef<HTMLTextAreaElement>(null);
|
|
40
|
+
const fileUploadRef = useRef<HTMLInputElement>(null);
|
|
46
41
|
|
|
47
|
-
const
|
|
48
|
-
const screens = [];
|
|
42
|
+
const isPostAllowed = !readOnlyChannel && canPost;
|
|
49
43
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
<FormattedMessage id="create_post.tutorialTip.title" defaultMessage="Send a message" />
|
|
54
|
-
</h4>
|
|
55
|
-
{/* <p>
|
|
56
|
-
<FormattedMarkdownMessage
|
|
57
|
-
id='create_post.tutorialTip1'
|
|
58
|
-
defaultMessage='Type your first message and select **Enter** to send it.'
|
|
59
|
-
/>
|
|
60
|
-
</p>
|
|
61
|
-
<p>
|
|
62
|
-
<FormattedMarkdownMessage
|
|
63
|
-
id='create_post.tutorialTip2'
|
|
64
|
-
defaultMessage='Use the **Attachments** and **Emoji** buttons to add files and emojis to your messages.'
|
|
65
|
-
/>
|
|
66
|
-
</p> */}
|
|
67
|
-
</div>,
|
|
68
|
-
);
|
|
44
|
+
const handleSubmit = (e: React.FormEvent) => {
|
|
45
|
+
e.preventDefault();
|
|
46
|
+
if (!message.trim() || !isPostAllowed) return;
|
|
69
47
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
overlayClass="tip-overlay--chat"
|
|
75
|
-
telemetryTag="tutorial_tip_1_sending_messages"
|
|
76
|
-
/>
|
|
77
|
-
);
|
|
48
|
+
setSubmitting(true);
|
|
49
|
+
// Add your submission logic here
|
|
50
|
+
setMessage('');
|
|
51
|
+
setSubmitting(false);
|
|
78
52
|
};
|
|
79
53
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
let centerClass = '';
|
|
86
|
-
if (!fullWidthTextBox) {
|
|
87
|
-
centerClass = 'center';
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
let sendButtonClass = 'send-button theme';
|
|
91
|
-
// if (!shouldEnableSendButton()) {
|
|
92
|
-
// sendButtonClass += ' disabled';
|
|
93
|
-
// }
|
|
94
|
-
|
|
95
|
-
let attachmentsDisabled = '';
|
|
96
|
-
if (!props.canUploadFiles) {
|
|
97
|
-
attachmentsDisabled = ' post-create--attachment-disabled';
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
let scrollbarClass = '';
|
|
101
|
-
if (renderScrollbar) {
|
|
102
|
-
scrollbarClass = ' scroll';
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
let callButton;
|
|
106
|
-
if (!readOnlyChannel && !props.shouldShowPreview) {
|
|
107
|
-
callButton = <h1>call button</h1>;
|
|
108
|
-
// callButton = <CallButton />;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
let fileUpload;
|
|
112
|
-
if (!readOnlyChannel && !props.shouldShowPreview) {
|
|
113
|
-
fileUpload = (
|
|
114
|
-
<h1>text</h1>
|
|
115
|
-
// <FileUpload
|
|
116
|
-
// ref={fileUploadRef}
|
|
117
|
-
// fileCount={getFileCount()}
|
|
118
|
-
// getTarget={getFileUploadTarget}
|
|
119
|
-
// onFileUploadChange={handleFileUploadChange}
|
|
120
|
-
// onUploadStart={handleUploadStart}
|
|
121
|
-
// onFileUpload={handleFileUploadComplete}
|
|
122
|
-
// onUploadError={handleUploadError}
|
|
123
|
-
// onUploadProgress={handleUploadProgress}
|
|
124
|
-
// postType='post'
|
|
125
|
-
// channelId={currentChannel.id}
|
|
126
|
-
// />
|
|
127
|
-
);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
let createMessage;
|
|
131
|
-
if (readOnlyChannel) {
|
|
132
|
-
createMessage = Utils.localizeMessage(
|
|
133
|
-
'create_post.read_only',
|
|
134
|
-
'This channel is read-only. Only members with permission can post here.',
|
|
135
|
-
);
|
|
136
|
-
} else {
|
|
137
|
-
createMessage = <h1>createMessage</h1>;
|
|
138
|
-
// createMessage = formatMessage(
|
|
139
|
-
// { id: 'create_post.write', defaultMessage: 'Write to {channelDisplayName}' },
|
|
140
|
-
// { channelDisplayName: currentChannel.display_name },
|
|
141
|
-
// );
|
|
142
|
-
}
|
|
54
|
+
const handleFileUpload = () => {
|
|
55
|
+
fileUploadRef.current?.click();
|
|
56
|
+
};
|
|
143
57
|
|
|
144
58
|
return (
|
|
145
|
-
<
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
? ({ '--detected-scrollbar-width': `${scrollbarWidth}px` } as any)
|
|
156
|
-
: undefined
|
|
157
|
-
}
|
|
158
|
-
>
|
|
159
|
-
<div className="post-create-body">
|
|
160
|
-
<div
|
|
161
|
-
role="application"
|
|
162
|
-
id="centerChannelFooter"
|
|
163
|
-
aria-label={ariaLabelMessageInput as any}
|
|
164
|
-
tabIndex={-1}
|
|
165
|
-
className="post-body__cell a11y__region"
|
|
166
|
-
data-a11y-sort-order="2"
|
|
59
|
+
<div className="flex flex-col p-4 border-t border-gray-200">
|
|
60
|
+
{showTutorialTip && (
|
|
61
|
+
<div className="mb-4 p-4 bg-blue-50 text-blue-700 rounded-md">
|
|
62
|
+
<FormattedMessage
|
|
63
|
+
id="create_post.tutorialTip"
|
|
64
|
+
defaultMessage="Type here to write a message. Use the buttons on the right for file uploads and emoji."
|
|
65
|
+
/>
|
|
66
|
+
<button
|
|
67
|
+
onClick={() => setShowTutorialTip(false)}
|
|
68
|
+
className="ml-2 text-blue-500 hover:text-blue-700"
|
|
167
69
|
>
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
{/* {callButton} */}
|
|
171
|
-
{/* {fileUpload} */}
|
|
172
|
-
|
|
173
|
-
{/* {emojiPicker} */}
|
|
174
|
-
<a
|
|
175
|
-
role="button"
|
|
176
|
-
tabIndex={0}
|
|
177
|
-
aria-label="Send a message"
|
|
178
|
-
// aria-label={formatMessage({
|
|
179
|
-
// id: 'create_post.send_message',
|
|
180
|
-
// defaultMessage: 'Send a message',
|
|
181
|
-
// })}
|
|
182
|
-
className={sendButtonClass}
|
|
183
|
-
// onClick={handleSubmit}
|
|
184
|
-
>
|
|
185
|
-
{/* <LocalizedIcon
|
|
186
|
-
className="fa fa-paper-plane"
|
|
187
|
-
title={{
|
|
188
|
-
id: t('create_post.icon'),
|
|
189
|
-
defaultMessage: 'Create a post',
|
|
190
|
-
}}
|
|
191
|
-
/> */}
|
|
192
|
-
</a>
|
|
193
|
-
</span>
|
|
194
|
-
</div>
|
|
195
|
-
{tutorialTip}
|
|
70
|
+
Got it
|
|
71
|
+
</button>
|
|
196
72
|
</div>
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
73
|
+
)}
|
|
74
|
+
|
|
75
|
+
<form onSubmit={handleSubmit} className="relative">
|
|
76
|
+
<textarea
|
|
77
|
+
ref={textboxRef}
|
|
78
|
+
value={message}
|
|
79
|
+
onChange={(e) => setMessage(e.target.value)}
|
|
80
|
+
placeholder={t('create_post.write')}
|
|
81
|
+
disabled={!isPostAllowed || submitting}
|
|
82
|
+
className={`w-full px-4 py-2 text-gray-700 border rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-transparent ${
|
|
83
|
+
errorClass ? 'border-red-500' : 'border-gray-300'
|
|
84
|
+
} ${!isPostAllowed || submitting ? 'bg-gray-100' : 'bg-white'}`}
|
|
85
|
+
rows={3}
|
|
86
|
+
/>
|
|
87
|
+
|
|
88
|
+
<div className="absolute right-2 bottom-2 flex items-center space-x-2">
|
|
89
|
+
<button
|
|
90
|
+
type="button"
|
|
91
|
+
onClick={handleFileUpload}
|
|
92
|
+
disabled={!isPostAllowed}
|
|
93
|
+
className="p-2 text-gray-400 hover:text-gray-600 rounded-full hover:bg-gray-100 disabled:opacity-50 disabled:cursor-not-allowed"
|
|
94
|
+
>
|
|
95
|
+
<MdAttachFile className="h-5 w-5" />
|
|
96
|
+
</button>
|
|
97
|
+
<button
|
|
98
|
+
type="button"
|
|
99
|
+
onClick={() => setShowEmojiPicker(!showEmojiPicker)}
|
|
100
|
+
disabled={!isPostAllowed}
|
|
101
|
+
className="p-2 text-gray-400 hover:text-gray-600 rounded-full hover:bg-gray-100 disabled:opacity-50 disabled:cursor-not-allowed"
|
|
102
|
+
>
|
|
103
|
+
<MdOutlineEmojiEmotions className="h-5 w-5" />
|
|
104
|
+
</button>
|
|
105
|
+
<button
|
|
106
|
+
type="submit"
|
|
107
|
+
disabled={!message.trim() || submitting || !isPostAllowed}
|
|
108
|
+
className={`px-4 py-2 rounded-md ${
|
|
109
|
+
!message.trim() || submitting || !isPostAllowed
|
|
110
|
+
? 'bg-gray-300 cursor-not-allowed'
|
|
111
|
+
: 'bg-primary-600 hover:bg-primary-700'
|
|
112
|
+
} text-white font-medium`}
|
|
113
|
+
>
|
|
114
|
+
{submitting ? 'Sending...' : 'Send'}
|
|
115
|
+
</button>
|
|
116
|
+
</div>
|
|
117
|
+
|
|
118
|
+
<input
|
|
119
|
+
type="file"
|
|
120
|
+
ref={fileUploadRef}
|
|
121
|
+
className="hidden"
|
|
122
|
+
multiple
|
|
123
|
+
onChange={(e) => {
|
|
124
|
+
// Handle file upload
|
|
125
|
+
console.log(e.target.files);
|
|
126
|
+
}}
|
|
127
|
+
/>
|
|
128
|
+
</form>
|
|
129
|
+
|
|
130
|
+
{serverError && <div className="mt-2 text-red-500 text-sm">{serverError}</div>}
|
|
131
|
+
</div>
|
|
224
132
|
);
|
|
225
133
|
};
|