@messenger-box/platform-browser 0.0.1-alpha.42 → 0.0.1-alpha.420
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 +540 -27
- package/jest.config.js +23 -7
- package/lib/components/InboxMessage/InboxDetails/index.d.ts +2 -0
- package/lib/components/InboxMessage/InboxDetails/style.d.ts +1 -0
- package/lib/components/InboxMessage/InboxSidebar/index.d.ts +11 -0
- package/lib/components/InboxMessage/InboxSidebar/styles.d.ts +1 -0
- package/lib/components/InboxMessage/Messages/index.d.ts +2 -0
- package/lib/components/InboxMessage/Messages/styles.d.ts +80 -0
- package/lib/components/InboxMessage/MessagesList/index.d.ts +2 -0
- package/lib/components/InboxMessage/Popover/index.d.ts +2 -0
- package/lib/components/InboxMessage/Popover/style.d.ts +27 -0
- package/lib/components/InboxMessage/UserModalContent/index.d.ts +2 -0
- package/lib/components/InboxMessage/UserModalContent/style.d.ts +1 -0
- package/lib/components/InboxMessage/index.d.ts +2 -0
- package/lib/components/InboxMessage/mock.d.ts +19 -0
- package/lib/components/InboxMessage/style.d.ts +1 -0
- package/lib/components/channel_view/DirectChannelView.d.ts +3 -0
- package/lib/components/channel_view/PublicChannelView.d.ts +3 -0
- package/lib/components/dashboard/menu_header.d.ts +5 -0
- package/lib/components/dashboard/modals/direct_modal.d.ts +9 -0
- package/lib/components/dashboard/modals.d.ts +8 -0
- package/lib/components/messenger/index.d.ts +6 -1
- package/lib/components/messenger/messagesList/index.d.ts +6 -4
- package/lib/components/messenger/messagesList/style.d.ts +1 -221
- package/lib/components/messenger/more_action/index.d.ts +11 -0
- package/lib/components/messenger/more_action/style.d.ts +1 -0
- package/lib/components/overlay_trigger.d.ts +3 -3
- package/lib/components/post/channel_intro_message/channel_intro_message.d.ts +2 -1
- package/lib/components/post/channel_layout/channel_identifier_router/channel_identifier_router.d.ts +2 -1
- package/lib/components/post/channel_view/channel_view.d.ts +2 -1
- package/lib/components/post/create_post/create_post.d.ts +2 -1
- package/lib/components/post/failed_post_options/failed_post_options.d.ts +2 -1
- package/lib/components/post/index.d.ts +5 -1
- package/lib/components/post/markdown/markdown.d.ts +2 -1
- package/lib/components/post/post/post.d.ts +2 -1
- package/lib/components/post/post_aria_label_div.d.ts +3 -2
- package/lib/components/post/post_body/post_body.d.ts +2 -1
- package/lib/components/post/post_header/post_header.d.ts +2 -1
- package/lib/components/post/post_header/post_header_custom_status.d.ts +2 -1
- package/lib/components/post/post_header/style.d.ts +1 -40
- package/lib/components/post/post_info/post_info.d.ts +2 -1
- package/lib/components/post/post_list/index.d.ts +2 -1
- package/lib/components/post/post_list/post_list.d.ts +2 -1
- package/lib/components/post/post_list_row/post_list_row.d.ts +2 -1
- package/lib/components/post/post_list_virtualized/latest_post_reader.d.ts +2 -1
- package/lib/components/post/post_list_virtualized/post_list_virtualized.d.ts +2 -1
- package/lib/components/post/post_markdown/post_markdown.d.ts +2 -1
- package/lib/components/post/post_message_view/post_message_view.d.ts +2 -1
- package/lib/components/post/post_pre_header/post_pre_header.d.ts +3 -2
- package/lib/components/post/post_profile_picture/post_profile_picture.d.ts +2 -1
- package/lib/components/post/post_view.d.ts +2 -1
- package/lib/components/post/profile_picture/profile_picture.d.ts +2 -1
- package/lib/components/post/show_more/show_more.d.ts +2 -1
- package/lib/components/post/style.d.ts +1 -93
- package/lib/components/post/threading/channel_threads/thread_footer/thread_footer.d.ts +2 -1
- package/lib/components/post/threading/common/button/button.d.ts +3 -3
- package/lib/components/post/threading/common/follow_button/follow_button.d.ts +2 -2
- package/lib/components/post/tutorial/tutorial_tip/tutorial_tip.d.ts +3 -3
- package/lib/components/post/user_profile/user_profile.d.ts +1 -1
- package/lib/components/status_icon.d.ts +2 -1
- package/lib/components/status_icon_new.d.ts +2 -2
- package/lib/compute.d.ts +8 -2
- package/lib/containers/Inbox.d.ts +3 -0
- package/lib/containers/Messenger.d.ts +5 -1
- package/lib/index.js +3864 -581
- package/lib/index.js.map +1 -1
- package/lib/packages/types/emojis.d.ts +5 -5
- package/lib/packages/types/files.d.ts +5 -5
- package/lib/packages/types/posts.d.ts +13 -13
- package/lib/packages/types/reactions.d.ts +1 -1
- package/lib/packages/types/utilities.d.ts +13 -13
- package/lib/style.d.ts +1 -37
- package/lib/utils/index.d.ts +2 -0
- package/lib/widgets/badges/badge.d.ts +3 -3
- package/lib/widgets/badges/bot_badge.d.ts +1 -1
- package/lib/widgets/badges/guest_badge.d.ts +1 -1
- package/lib/widgets/badges/style.d.ts +1 -23
- package/lib/widgets/icons/emoji_icon.d.ts +1 -1
- package/lib/widgets/icons/flag_icon_filled.d.ts +1 -1
- package/lib/widgets/icons/mattermost_logo.d.ts +1 -1
- package/lib/widgets/icons/status_away_avatar_icon.d.ts +1 -1
- package/lib/widgets/icons/status_away_icon.d.ts +1 -1
- package/lib/widgets/icons/status_dnd_avatar_icon.d.ts +1 -1
- package/lib/widgets/icons/status_dnd_icon.d.ts +1 -1
- package/lib/widgets/icons/status_offline_avatar_icon.d.ts +1 -1
- package/lib/widgets/icons/status_offline_icon.d.ts +1 -1
- package/lib/widgets/icons/status_online_avatar_icon.d.ts +1 -1
- package/lib/widgets/icons/status_online_icon.d.ts +1 -1
- package/lib/widgets/overlay_trigger.d.ts +3 -3
- package/lib/widgets/shared_user_indicator.d.ts +1 -1
- package/lib/widgets/simple_tooltip/simple_tooltip.d.ts +3 -3
- package/lib/widgets/users/avatar/avatar.d.ts +4 -4
- package/lib/widgets/users/avatar/style.d.ts +1 -75
- package/lib/widgets/users/avatars/avatars.d.ts +2 -2
- package/package.json +61 -67
- package/src/components/InboxMessage/InboxDetails/index.tsx +23 -0
- package/src/components/InboxMessage/InboxDetails/style.ts +27 -0
- package/src/components/InboxMessage/InboxSidebar/index.tsx +86 -0
- package/src/components/InboxMessage/InboxSidebar/styles.ts +57 -0
- package/src/components/InboxMessage/Messages/index.tsx +159 -0
- package/src/components/InboxMessage/Messages/styles.ts +85 -0
- package/src/components/InboxMessage/MessagesList/index.tsx +93 -0
- package/src/components/InboxMessage/Popover/index.tsx +57 -0
- package/src/components/InboxMessage/Popover/style.ts +27 -0
- package/src/components/InboxMessage/UserModalContent/index.tsx +60 -0
- package/src/components/InboxMessage/UserModalContent/style.ts +98 -0
- package/src/components/InboxMessage/index.tsx +286 -0
- package/src/components/InboxMessage/mock.ts +53 -0
- package/src/components/InboxMessage/style.ts +189 -0
- package/src/components/channel_view/DirectChannelView.tsx +25 -0
- package/src/components/channel_view/PublicChannelView.tsx +24 -0
- package/src/components/dashboard/menu_header.tsx +49 -0
- package/src/components/dashboard/modals/direct_modal.tsx +46 -0
- package/src/components/dashboard/modals.tsx +93 -0
- package/src/components/messenger/avatar/index.tsx +2 -4
- package/src/components/messenger/avatar/style.ts +3 -3
- package/src/components/messenger/index.tsx +258 -94
- package/src/components/messenger/messagesList/index.tsx +673 -249
- package/src/components/messenger/messagesList/messageBox.tsx +2 -1
- package/src/components/messenger/messagesList/style.ts +240 -14
- package/src/components/messenger/more_action/index.tsx +68 -0
- package/src/components/messenger/more_action/style.ts +45 -0
- package/src/components/messenger/postMessage/postMessage.tsx +2 -3
- package/src/components/messenger/postMessage/style.ts +3 -3
- package/src/components/messenger/sidebarThreadList/index.tsx +11 -10
- package/src/components/messenger/style.ts +16 -16
- package/src/components/messenger/threadSidebar/index.tsx +5 -5
- package/src/components/messenger/threadSidebar/style.ts +7 -7
- package/src/components/messenger/types/message.ts +1 -0
- package/src/components/post/channel_intro_message/channel_intro_message.tsx +0 -1
- package/src/components/post/index.tsx +102 -25
- package/src/components/post/post/post.tsx +8 -1
- package/src/components/post/post_header/post_header_custom_status.tsx +1 -2
- package/src/components/post/post_header/style.ts +3 -6
- package/src/components/post/style.ts +22 -8
- package/src/components/post/tutorial/tutorial_tip/tutorial_tip.tsx +1 -0
- package/src/components/post/user_profile/user_profile.tsx +1 -0
- package/src/compute.tsx +58 -37
- package/src/containers/Dashboard.tsx +488 -1
- package/src/containers/Inbox.tsx +13 -0
- package/src/containers/Loading.tsx +1 -1
- package/src/containers/Messenger.tsx +9 -4
- package/src/module.ts +10 -7
- package/src/style.ts +382 -19
- package/src/utils/index.ts +22 -0
- package/src/widgets/badges/badge.tsx +1 -2
- package/src/widgets/badges/style.ts +3 -3
- package/src/widgets/icons/accordion_toggle_icon.tsx +1 -1
- package/src/widgets/icons/add_reaction_icon.tsx +1 -1
- package/src/widgets/icons/admin_eye_icon.tsx +1 -1
- package/src/widgets/icons/alert_icon.tsx +1 -1
- package/src/widgets/icons/archive_icon.tsx +1 -1
- package/src/widgets/icons/arrow_right_icon.tsx +1 -1
- package/src/widgets/icons/at_icon.tsx +1 -1
- package/src/widgets/icons/attachment_icon.tsx +1 -1
- package/src/widgets/icons/back_icon.tsx +1 -1
- package/src/widgets/icons/bot_icon.tsx +1 -1
- package/src/widgets/icons/camera_icon.tsx +1 -1
- package/src/widgets/icons/checkbox_checked_icon.tsx +1 -1
- package/src/widgets/icons/checkbox_partial_icon.tsx +1 -1
- package/src/widgets/icons/close_circle_icon.tsx +1 -1
- package/src/widgets/icons/close_circle_solid_icon.tsx +1 -1
- package/src/widgets/icons/close_icon.tsx +1 -1
- package/src/widgets/icons/dots_horizontal.tsx +1 -1
- package/src/widgets/icons/download_icon.tsx +1 -1
- package/src/widgets/icons/draft_icon.tsx +1 -1
- package/src/widgets/icons/ellipsis_h_icon.tsx +1 -1
- package/src/widgets/icons/email_icon.tsx +1 -1
- package/src/widgets/icons/fa_add_icon.tsx +1 -1
- package/src/widgets/icons/fa_back_icon.tsx +1 -1
- package/src/widgets/icons/fa_dropdown_icon.tsx +1 -1
- package/src/widgets/icons/fa_edit_icon.tsx +1 -1
- package/src/widgets/icons/fa_logout_icon.tsx +1 -1
- package/src/widgets/icons/fa_next_icon.tsx +1 -1
- package/src/widgets/icons/fa_previous_icon.tsx +1 -1
- package/src/widgets/icons/fa_reload_icon.tsx +1 -1
- package/src/widgets/icons/fa_remove_icon.tsx +1 -1
- package/src/widgets/icons/fa_search_icon.tsx +1 -1
- package/src/widgets/icons/fa_select_icon.tsx +1 -1
- package/src/widgets/icons/fa_success_icon.tsx +1 -1
- package/src/widgets/icons/fa_warning_icon.tsx +1 -1
- package/src/widgets/icons/flag_icon.tsx +1 -1
- package/src/widgets/icons/gfycat_icon.tsx +1 -1
- package/src/widgets/icons/gif_reactions_icon.tsx +1 -1
- package/src/widgets/icons/gif_search_clear_icon.tsx +1 -1
- package/src/widgets/icons/gif_search_icon.tsx +1 -1
- package/src/widgets/icons/gif_trending_icon.tsx +1 -1
- package/src/widgets/icons/globe_icon.tsx +1 -1
- package/src/widgets/icons/icons.stories.js +1 -1
- package/src/widgets/icons/info_icon.tsx +1 -1
- package/src/widgets/icons/info_small_icon.tsx +1 -1
- package/src/widgets/icons/invite_icon.tsx +1 -1
- package/src/widgets/icons/invite_members_icon.tsx +1 -1
- package/src/widgets/icons/link_icon.tsx +1 -1
- package/src/widgets/icons/lock_icon.tsx +1 -1
- package/src/widgets/icons/mail_icon.tsx +1 -1
- package/src/widgets/icons/mail_plus_icon.tsx +1 -1
- package/src/widgets/icons/member_icon.tsx +1 -1
- package/src/widgets/icons/mentions_icon.tsx +1 -1
- package/src/widgets/icons/menu_icon.tsx +1 -1
- package/src/widgets/icons/message_icon.tsx +1 -1
- package/src/widgets/icons/pin_icon.tsx +1 -1
- package/src/widgets/icons/plugin_channel_header_icon.tsx +1 -1
- package/src/widgets/icons/plugin_icon.tsx +1 -1
- package/src/widgets/icons/reply_icon.tsx +1 -1
- package/src/widgets/icons/scroll_to_bottom_icon.tsx +1 -1
- package/src/widgets/icons/search_icon.tsx +1 -1
- package/src/widgets/icons/shield_outline_icon.tsx +1 -1
- package/src/widgets/icons/unarchive_icon.tsx +1 -1
- package/src/widgets/icons/unread_below_icon.tsx +1 -1
- package/src/widgets/icons/user_guide_icon.tsx +1 -1
- package/src/widgets/shared_user_indicator.tsx +1 -0
- package/src/widgets/simple_tooltip/simple_tooltip.tsx +1 -0
- package/src/widgets/users/avatar/avatar.tsx +1 -2
- package/src/widgets/users/avatar/style.ts +3 -3
- package/src/widgets/users/avatars/avatars.tsx +1 -0
- package/tsconfig.json +2 -1
- package/webpack.config.js +1 -1
- package/lib/components/messenger/mock.d.ts +0 -50
- package/lib/components/messenger/postMessage/postMessage.d.ts +0 -1
- package/lib/components/messenger/postMessage/style.d.ts +0 -22
- package/lib/components/messenger/sidebarThreadList/index.d.ts +0 -7
- package/lib/components/messenger/threadSidebar/index.d.ts +0 -1
- package/lib/components/messenger/threadSidebar/style.d.ts +0 -62
- package/lib/components/messenger/types/message.d.ts +0 -14
- package/src/api.ts +0 -35
- package/src/components/Counter.tsx +0 -52
- package/src/containers/Clock.tsx +0 -0
- package/src/containers/Counter.tsx +0 -42
- package/src/containers/PersonList.tsx +0 -20
- package/src/containers/ServerCounter.tsx +0 -140
- package/src/graphql/index.ts +0 -3
- package/src/graphql/mutations/addCount.graphql +0 -5
- package/src/graphql/mutations/addPerson.graphql +0 -6
- package/src/graphql/mutations/index.ts +0 -2
- package/src/graphql/queries/count.graphql +0 -5
- package/src/graphql/queries/index.ts +0 -3
- package/src/graphql/queries/person.graphql +0 -22
- package/src/graphql/queries/persons.graphql +0 -6
- package/src/graphql/subscriptions/count.graphql +0 -5
- package/src/graphql/subscriptions/index.ts +0 -1
- package/src/redux/__mocks__/api.ts +0 -4
- package/src/redux/actions/__tests__/sampleActions.test.ts +0 -159
- package/src/redux/actions/index.ts +0 -1
- package/src/redux/actions/sampleActions.ts +0 -91
- package/src/redux/index.ts +0 -2
- package/src/redux/reducers/Store.ts +0 -10
- package/src/redux/reducers/__tests__/sampleReducers.test.ts +0 -39
- package/src/redux/reducers/index.ts +0 -7
- package/src/redux/reducers/sampleReducers.ts +0 -71
- /package/src/components/post/channel_layout/{channel_controller.test.jsx → channel_controller.test.tsx} +0 -0
- /package/src/components/post/channel_layout/{channel_controller.jsx → channel_controller.tsx} +0 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Button, Box } from '@chakra-ui/react';
|
|
3
|
+
import { css } from '@emotion/css';
|
|
4
|
+
import { styleSheet } from './style';
|
|
5
|
+
|
|
6
|
+
export default function Popover({ toggleDrawer }: any) {
|
|
7
|
+
const content = [
|
|
8
|
+
{
|
|
9
|
+
name: 'All Conversations',
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
name: 'Archived Conversations',
|
|
13
|
+
total: '0',
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
name: 'Unread Conversations',
|
|
17
|
+
total: '0',
|
|
18
|
+
},
|
|
19
|
+
];
|
|
20
|
+
return (
|
|
21
|
+
<div className={css(styleSheet.customPopoverStyles(toggleDrawer) as any)}>
|
|
22
|
+
{content?.map((item, index) => {
|
|
23
|
+
if (!item.total) {
|
|
24
|
+
return (
|
|
25
|
+
<Box _hover={{ bg: '#edecec' }} className="popover-style" key={index}>
|
|
26
|
+
<Button
|
|
27
|
+
border="none"
|
|
28
|
+
fontSize="15px"
|
|
29
|
+
color="#282121"
|
|
30
|
+
variant="link"
|
|
31
|
+
bg='none'
|
|
32
|
+
height= '30px'
|
|
33
|
+
>
|
|
34
|
+
{item.name}
|
|
35
|
+
</Button>
|
|
36
|
+
</Box>
|
|
37
|
+
);
|
|
38
|
+
} else {
|
|
39
|
+
return (
|
|
40
|
+
<Box _hover={{ bg: '#edecec' }} className="popover-style" key={index}>
|
|
41
|
+
<Button
|
|
42
|
+
border="none"
|
|
43
|
+
fontSize="15px"
|
|
44
|
+
color="#282121"
|
|
45
|
+
variant="link"
|
|
46
|
+
bg='none'
|
|
47
|
+
height= '30px'
|
|
48
|
+
>
|
|
49
|
+
{item.name + `(${item.total})`}
|
|
50
|
+
</Button>
|
|
51
|
+
</Box>
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
})}
|
|
55
|
+
</div>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export const styleSheet = {
|
|
2
|
+
customPopoverStyles: (toggleDrawer) => ({
|
|
3
|
+
position: 'absolute',
|
|
4
|
+
height: '120px',
|
|
5
|
+
width: '200px',
|
|
6
|
+
zIndex: '1',
|
|
7
|
+
background: 'white',
|
|
8
|
+
boxShadow: '0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23)',
|
|
9
|
+
left: `${toggleDrawer ? '145px' : '189px'}`,
|
|
10
|
+
top: '145px',
|
|
11
|
+
borderRadius: '10px',
|
|
12
|
+
'& .popover-style': {
|
|
13
|
+
width: '100%',
|
|
14
|
+
marginTop: '7px',
|
|
15
|
+
transition: '1s ease-out',
|
|
16
|
+
cursor: 'pointer',
|
|
17
|
+
'& :hover': {
|
|
18
|
+
backgroundColor: '#edecec',
|
|
19
|
+
},
|
|
20
|
+
'& .ant-btn': {
|
|
21
|
+
textDecoration: 'none',
|
|
22
|
+
width: '100%',
|
|
23
|
+
textAlign: 'start',
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
}),
|
|
27
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { AiOutlineSecurityScan, AiOutlineUser } from 'react-icons/ai';
|
|
3
|
+
import { FiCheck } from 'react-icons/fi';
|
|
4
|
+
import { BsFillStarFill } from 'react-icons/bs';
|
|
5
|
+
import { Avatar, Button, Text } from '@chakra-ui/react';
|
|
6
|
+
import { css } from "@emotion/css";
|
|
7
|
+
import { styleSheet } from './style';
|
|
8
|
+
|
|
9
|
+
export default function UserModalContent({ username, imageUrl }: any) {
|
|
10
|
+
return (
|
|
11
|
+
<div className={css(styleSheet.UserContentStyles)}>
|
|
12
|
+
<div className="user-info">
|
|
13
|
+
<div className="avatar">
|
|
14
|
+
<Avatar
|
|
15
|
+
size="large"
|
|
16
|
+
src={imageUrl !== '' ? imageUrl : ''}
|
|
17
|
+
backgroundColor="grey"
|
|
18
|
+
width="200px"
|
|
19
|
+
height="200px"
|
|
20
|
+
borderRadius="50%"
|
|
21
|
+
marginBottom="10px"
|
|
22
|
+
/>
|
|
23
|
+
<a href="#">Update photo</a>
|
|
24
|
+
</div>
|
|
25
|
+
<AiOutlineSecurityScan style={{ width: '24px', height: '24px', color: 'black' }} />
|
|
26
|
+
<div className="identify">
|
|
27
|
+
<h3>Identity verification</h3>
|
|
28
|
+
<Text as="p" color="black">
|
|
29
|
+
Show others you’re really you with the identity verification badge.
|
|
30
|
+
</Text>
|
|
31
|
+
<Button className="get-badge-btn" color="black" bg="transparent">
|
|
32
|
+
Get the badge
|
|
33
|
+
</Button>
|
|
34
|
+
</div>
|
|
35
|
+
<div className="user-conformation">
|
|
36
|
+
<h3>{username} confirmed </h3>
|
|
37
|
+
<div className="email-address">
|
|
38
|
+
<FiCheck color="black" />
|
|
39
|
+
<Text as="p" color="black">
|
|
40
|
+
Email address
|
|
41
|
+
</Text>
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
<div className="user-details">
|
|
46
|
+
<div className="user">
|
|
47
|
+
<h2>Hi, I'm {username}</h2>
|
|
48
|
+
<Text as="p">Joined in 2021</Text>
|
|
49
|
+
<a>Edit profile</a>
|
|
50
|
+
<h3>
|
|
51
|
+
<BsFillStarFill color="black" /> Reviews
|
|
52
|
+
</h3>
|
|
53
|
+
</div>
|
|
54
|
+
<div className="reviews">
|
|
55
|
+
<a>Reviews by you</a>
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
export const styleSheet = {
|
|
2
|
+
UserContentStyles: {
|
|
3
|
+
display: 'flex',
|
|
4
|
+
justifyContent: 'space-between',
|
|
5
|
+
padding : '20px',
|
|
6
|
+
'& .user-info': {
|
|
7
|
+
border: '1px solid rgb(221, 221, 221)',
|
|
8
|
+
padding: '15px',
|
|
9
|
+
width: '40%',
|
|
10
|
+
borderRadius: '10px',
|
|
11
|
+
'& .avatar': {
|
|
12
|
+
textAlign: 'center',
|
|
13
|
+
marginBottom: '20px',
|
|
14
|
+
display: 'flex',
|
|
15
|
+
flexDirection: 'column',
|
|
16
|
+
alignItems: 'center',
|
|
17
|
+
'& .ant-avatar-lg': {
|
|
18
|
+
height: '150px',
|
|
19
|
+
width: '150px',
|
|
20
|
+
'& svg': {
|
|
21
|
+
fontSize: '130px',
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
'& a': {
|
|
25
|
+
color: 'black',
|
|
26
|
+
textDecoration: 'underline',
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
'& .identify': {
|
|
30
|
+
paddingBottom: '30px',
|
|
31
|
+
borderBottom: '1px solid rgb(221, 221, 221)',
|
|
32
|
+
'& h3': {
|
|
33
|
+
color: '#484848',
|
|
34
|
+
},
|
|
35
|
+
'& .get-badge-btn': {
|
|
36
|
+
height: '45px',
|
|
37
|
+
width: '170px',
|
|
38
|
+
borderRadius: '8px',
|
|
39
|
+
borderColor: 'rgb(34, 34, 34)',
|
|
40
|
+
},
|
|
41
|
+
'& .get-badge-btn:hover ': {
|
|
42
|
+
color: 'rgb(34, 34, 34)',
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
'& .user-conformation': {
|
|
46
|
+
marginBottom: '30px',
|
|
47
|
+
'& h3': {
|
|
48
|
+
color: '#484848',
|
|
49
|
+
},
|
|
50
|
+
'& .email-address': {
|
|
51
|
+
display: 'flex',
|
|
52
|
+
'& p': {
|
|
53
|
+
fontSize: '16px',
|
|
54
|
+
marginLeft: '7px',
|
|
55
|
+
},
|
|
56
|
+
'& svg': {
|
|
57
|
+
fontSize: '23px',
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
'& .user-details': {
|
|
63
|
+
width: '60%',
|
|
64
|
+
marginLeft: '25px',
|
|
65
|
+
'& .user': {
|
|
66
|
+
borderBottom: '1px solid rgb(221, 221, 221)',
|
|
67
|
+
paddingBottm: '30px',
|
|
68
|
+
'& h2': {
|
|
69
|
+
color: '#484848',
|
|
70
|
+
},
|
|
71
|
+
'& p': {
|
|
72
|
+
marginBottom: '20px',
|
|
73
|
+
color: 'rgb(113, 113, 113)',
|
|
74
|
+
},
|
|
75
|
+
'& a': {
|
|
76
|
+
color: 'black',
|
|
77
|
+
textDecoration: 'underline',
|
|
78
|
+
},
|
|
79
|
+
'& h3': {
|
|
80
|
+
color: '#484848',
|
|
81
|
+
fontSize: '20px',
|
|
82
|
+
'& svg': {
|
|
83
|
+
width: '16px',
|
|
84
|
+
height: '16px',
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
'& .reviews': {
|
|
90
|
+
borderBottom: '1px solid rgb(221, 221, 221)',
|
|
91
|
+
padding: '30px 0 30px 0',
|
|
92
|
+
'& a': {
|
|
93
|
+
color: 'black',
|
|
94
|
+
textDecoration: 'underline',
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
} as any;
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import { useSelector } from 'react-redux';
|
|
3
|
+
import { Modal } from 'react-bootstrap';
|
|
4
|
+
import Select from 'react-select';
|
|
5
|
+
import { VscChromeClose } from 'react-icons/vsc';
|
|
6
|
+
import { AiOutlineMenu } from 'react-icons/ai';
|
|
7
|
+
import { indexOf } from 'lodash-es';
|
|
8
|
+
import { Button, Avatar, Text } from '@chakra-ui/react';
|
|
9
|
+
import { css } from "@emotion/css"
|
|
10
|
+
import {
|
|
11
|
+
useGetAllUsersQuery,
|
|
12
|
+
useGetMessagesQuery,
|
|
13
|
+
useAddDirectChannelMutation,
|
|
14
|
+
useGetChannelsByUserQuery,
|
|
15
|
+
useGetAllChannelQuery,
|
|
16
|
+
} from '@messenger-box/platform-client';
|
|
17
|
+
import Messages from './Messages';
|
|
18
|
+
import PopoverComponent from './Popover';
|
|
19
|
+
import InboxDetails from './InboxDetails';
|
|
20
|
+
import InboxSidebar from './InboxSidebar';
|
|
21
|
+
import { stylesheet } from './style';
|
|
22
|
+
|
|
23
|
+
export default function InboxMessage() {
|
|
24
|
+
const [id, setId] = useState<number>();
|
|
25
|
+
const [showMessageSide, setShowMessageSide] = useState<boolean>(false);
|
|
26
|
+
const [showPopover, setShowPopover] = useState<boolean>(false);
|
|
27
|
+
const [toggleDrawer, setToggleDrawer] = useState<boolean>(true);
|
|
28
|
+
const [messageList, setMessageList] = useState([]);
|
|
29
|
+
const [channel, setChannel] = useState<any>([]);
|
|
30
|
+
const [user, setUser] = useState<any>();
|
|
31
|
+
const [showModal, setShowModal] = useState<boolean>(false);
|
|
32
|
+
const [currentUserId, setCurrentUserId] = useState<any>();
|
|
33
|
+
const [currentUser, setCurrentUser] = useState<string>('');
|
|
34
|
+
const [options, setOptions] = useState<any>([]);
|
|
35
|
+
const [userId, setUserId] = useState<any>();
|
|
36
|
+
const [selectedValues, setSelectedValues] = useState<any>();
|
|
37
|
+
const [channels, setChannels] = useState([]);
|
|
38
|
+
const [selectedChannel, setSelectedChannel] = useState<any>();
|
|
39
|
+
const { data, loading, error, refetch } = useGetMessagesQuery({
|
|
40
|
+
variables: {
|
|
41
|
+
channelId: '61a009978512232154f65a0c',
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
const currentUserAuth0Id = useSelector((state: any) => state.user.auth0UserId);
|
|
46
|
+
|
|
47
|
+
const channelData = useGetChannelsByUserQuery();
|
|
48
|
+
const allChannels = useGetAllChannelQuery();
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
if (!channelData.loading) {
|
|
51
|
+
let fChannel = [];
|
|
52
|
+
let diChal = [];
|
|
53
|
+
if (currentUserId !== '' && !allChannels.loading) {
|
|
54
|
+
let uc = [];
|
|
55
|
+
channelData.data.channelsByUser.forEach((u) => uc.push(u.id));
|
|
56
|
+
let ac = [];
|
|
57
|
+
allChannels.data.channels.forEach((a) => ac.push(a.id));
|
|
58
|
+
diChal = ac.filter((t) => !uc.includes(t));
|
|
59
|
+
allChannels.data.channels.filter((dc) => {
|
|
60
|
+
if (diChal.includes(dc.id)) {
|
|
61
|
+
dc.members.forEach((m) => {
|
|
62
|
+
if (m.user === currentUserId) {
|
|
63
|
+
fChannel.push(dc);
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
setChannel([
|
|
70
|
+
...channelData?.data.channelsByUser.filter(
|
|
71
|
+
(chl) =>
|
|
72
|
+
chl.type === 'DIRECT' && chl?.displayName !== 'admin (you)' && chl?.displayName !== 'surveybot',
|
|
73
|
+
),
|
|
74
|
+
...fChannel.filter((chl) => chl.type === 'DIRECT'),
|
|
75
|
+
]);
|
|
76
|
+
}
|
|
77
|
+
}, [loading, channelData, currentUserId]);
|
|
78
|
+
// console.log(allChannels)
|
|
79
|
+
console.log(channel)
|
|
80
|
+
|
|
81
|
+
const handleSelectMessgae = (item: any) => {
|
|
82
|
+
setShowMessageSide(true);
|
|
83
|
+
setId(item?.id);
|
|
84
|
+
item.members.map((e) => {
|
|
85
|
+
return setUserId(e.user);
|
|
86
|
+
});
|
|
87
|
+
setSelectedChannel(item);
|
|
88
|
+
setToggleDrawer(false);
|
|
89
|
+
};
|
|
90
|
+
const usersRes = useGetAllUsersQuery();
|
|
91
|
+
useEffect(() => {
|
|
92
|
+
if (!usersRes.loading) {
|
|
93
|
+
setUser(usersRes.data.getUsers);
|
|
94
|
+
let tempOpt = [];
|
|
95
|
+
usersRes.data.getUsers?.map((i) => {
|
|
96
|
+
if (i.alias[0] !== currentUserAuth0Id) {
|
|
97
|
+
tempOpt.push({
|
|
98
|
+
value: { username: `${i.username}`, uid: `${i.id}` },
|
|
99
|
+
label: (
|
|
100
|
+
<div style={{ cursor: 'pointer' }}>
|
|
101
|
+
<Avatar width="40px" backgroundColor="grey" size="42" borderRadius="50%"></Avatar>
|
|
102
|
+
<Text color="black">{i.username}</Text>
|
|
103
|
+
</div>
|
|
104
|
+
),
|
|
105
|
+
});
|
|
106
|
+
} else {
|
|
107
|
+
setCurrentUserId(i.id);
|
|
108
|
+
setCurrentUser(i.username);
|
|
109
|
+
}
|
|
110
|
+
setOptions(tempOpt);
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
}, [usersRes.loading, usersRes.data]);
|
|
114
|
+
console.log(user)
|
|
115
|
+
useEffect(() => {
|
|
116
|
+
if (!loading) {
|
|
117
|
+
setMessageList(data.messages.data);
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
const handleToggle = () => {
|
|
121
|
+
setToggleDrawer(false);
|
|
122
|
+
};
|
|
123
|
+
const handleClose = () => {
|
|
124
|
+
setShowModal(false);
|
|
125
|
+
};
|
|
126
|
+
const handleSelect = (selectedOption) => {
|
|
127
|
+
setSelectedValues(selectedOption);
|
|
128
|
+
};
|
|
129
|
+
const [createDirectChannel, addedDirectChannel] = useAddDirectChannelMutation({
|
|
130
|
+
context: { headers: {} },
|
|
131
|
+
});
|
|
132
|
+
useEffect(() => {
|
|
133
|
+
if (!addedDirectChannel.loading && addedDirectChannel.data) {
|
|
134
|
+
setSelectedChannel(addedDirectChannel.data.createDirectChannel);
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
const handleGo = () => {
|
|
138
|
+
if (selectedValues) {
|
|
139
|
+
let uids = [];
|
|
140
|
+
let dName = '';
|
|
141
|
+
console.log(selectedChannel?.value);
|
|
142
|
+
if (selectedValues.length > 1) {
|
|
143
|
+
selectedValues.forEach((i) => {
|
|
144
|
+
uids.push(i.value.uid);
|
|
145
|
+
dName += i.value.username;
|
|
146
|
+
if (indexOf(selectedValues, i) + 1 !== selectedValues.length) {
|
|
147
|
+
dName += ',';
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
} else {
|
|
151
|
+
uids.push(selectedValues[0].value.uid);
|
|
152
|
+
dName = selectedValues[0].value.username;
|
|
153
|
+
}
|
|
154
|
+
let channl;
|
|
155
|
+
channel.forEach((i) => {
|
|
156
|
+
if (i?.displayName == dName) {
|
|
157
|
+
channl = i.members.find((e) => {
|
|
158
|
+
return e.user == uids;
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
if (channl?.user !== uids[0]) {
|
|
163
|
+
createDirectChannel({
|
|
164
|
+
variables: {
|
|
165
|
+
receiver: uids,
|
|
166
|
+
displayName: dName,
|
|
167
|
+
},
|
|
168
|
+
}).then((res) => {
|
|
169
|
+
setSelectedChannel(res.data.createDirectChannel);
|
|
170
|
+
channelData.refetch().then((value) => {
|
|
171
|
+
setChannels(value.data.channelsByUser);
|
|
172
|
+
setSelectedValues([]);
|
|
173
|
+
});
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
handleClose();
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
return (
|
|
180
|
+
<div className={css(stylesheet.inboxStyles)}>
|
|
181
|
+
<div className={toggleDrawer ? 'inbox-sidebar-active' : 'inbox-sidebar'}>
|
|
182
|
+
<div className="conversations">
|
|
183
|
+
<div className="header-section">
|
|
184
|
+
<div className="allmessage-header">
|
|
185
|
+
<h3>Messages</h3>
|
|
186
|
+
<Button
|
|
187
|
+
as="a"
|
|
188
|
+
borderRadius="50%"
|
|
189
|
+
width="30px"
|
|
190
|
+
height="30px"
|
|
191
|
+
_hover={{ backgroundColor: 'rgb(221, 221, 221)' }}
|
|
192
|
+
onClick={() => {
|
|
193
|
+
setShowPopover(!showPopover);
|
|
194
|
+
}}
|
|
195
|
+
>
|
|
196
|
+
<AiOutlineMenu style={{ fontSize: '20px', color: 'black' }} />
|
|
197
|
+
</Button>
|
|
198
|
+
{showPopover ? <PopoverComponent toggleDrawer={toggleDrawer} /> : ''}
|
|
199
|
+
</div>
|
|
200
|
+
</div>
|
|
201
|
+
<InboxSidebar
|
|
202
|
+
userId={currentUserId}
|
|
203
|
+
user={channel}
|
|
204
|
+
handleSelectMessgae={handleSelectMessgae}
|
|
205
|
+
currentUser={currentUser}
|
|
206
|
+
messageList={messageList}
|
|
207
|
+
users={user}
|
|
208
|
+
/>
|
|
209
|
+
</div>
|
|
210
|
+
<div className="add-conversations">
|
|
211
|
+
<Modal show={showModal} onHide={handleClose}>
|
|
212
|
+
<Modal.Header
|
|
213
|
+
style={{
|
|
214
|
+
backgroundColor: '#2b5ebf',
|
|
215
|
+
color: 'white',
|
|
216
|
+
display: 'flex',
|
|
217
|
+
alignItems: 'center',
|
|
218
|
+
}}
|
|
219
|
+
>
|
|
220
|
+
<Modal.Title>Add Conversations</Modal.Title>
|
|
221
|
+
<VscChromeClose
|
|
222
|
+
onClick={() => handleClose()}
|
|
223
|
+
fontSize="16px"
|
|
224
|
+
style={{ marginLeft: 'auto', cursor: 'pointer' }}
|
|
225
|
+
/>
|
|
226
|
+
</Modal.Header>
|
|
227
|
+
<Modal.Body>
|
|
228
|
+
<div className={css(stylesheet.modelStyle as any)}>
|
|
229
|
+
<div className="root_modal">
|
|
230
|
+
<div className="root_first">
|
|
231
|
+
<div className="search_box">
|
|
232
|
+
<Select
|
|
233
|
+
className="temp"
|
|
234
|
+
value={selectedValues?.value}
|
|
235
|
+
onChange={handleSelect}
|
|
236
|
+
components={{
|
|
237
|
+
DropdownIndicator: () => null,
|
|
238
|
+
IndicatorSeparator: () => null,
|
|
239
|
+
}}
|
|
240
|
+
autoFocus={true}
|
|
241
|
+
options={options}
|
|
242
|
+
isMulti={true}
|
|
243
|
+
menuIsOpen={true}
|
|
244
|
+
/>
|
|
245
|
+
<button onClick={handleGo}>Go</button>
|
|
246
|
+
</div>
|
|
247
|
+
<div className="mid_line">
|
|
248
|
+
<p>
|
|
249
|
+
Use ↑↓ to browse, ↵ to select.<span> </span>
|
|
250
|
+
</p>
|
|
251
|
+
</div>
|
|
252
|
+
</div>
|
|
253
|
+
</div>
|
|
254
|
+
</div>
|
|
255
|
+
</Modal.Body>
|
|
256
|
+
</Modal>
|
|
257
|
+
<Button
|
|
258
|
+
size="large"
|
|
259
|
+
className="conversation-btn"
|
|
260
|
+
backgroundColor="#1890ff"
|
|
261
|
+
height="40px"
|
|
262
|
+
borderRadius="3px"
|
|
263
|
+
border="none"
|
|
264
|
+
color="white"
|
|
265
|
+
variant="outline"
|
|
266
|
+
fontSize="20px"
|
|
267
|
+
onClick={() => setShowModal(true)}
|
|
268
|
+
>
|
|
269
|
+
Add Conversations
|
|
270
|
+
</Button>
|
|
271
|
+
</div>
|
|
272
|
+
</div>
|
|
273
|
+
<div className={`msg-container${toggleDrawer ? '-active' : ''}`}>
|
|
274
|
+
<div className="border"></div>
|
|
275
|
+
{showMessageSide == true ? (
|
|
276
|
+
<Messages id={id} user={user} userId={userId} currentUser={currentUser} />
|
|
277
|
+
) : (
|
|
278
|
+
''
|
|
279
|
+
)}
|
|
280
|
+
</div>
|
|
281
|
+
<div className={toggleDrawer ? 'inbox-details' : 'inbox-details-active'}>
|
|
282
|
+
<InboxDetails handleToggle={handleToggle} toggleDrawer={toggleDrawer} />
|
|
283
|
+
</div>
|
|
284
|
+
</div>
|
|
285
|
+
);
|
|
286
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export const inboxData = [
|
|
2
|
+
{
|
|
3
|
+
username: 'Alex',
|
|
4
|
+
id: Math.random(),
|
|
5
|
+
isLoggedIn: true,
|
|
6
|
+
messages: [
|
|
7
|
+
{
|
|
8
|
+
message: 'hello',
|
|
9
|
+
id: Math.random(),
|
|
10
|
+
isLoggedIn: true,
|
|
11
|
+
},
|
|
12
|
+
]
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
username: 'Tim',
|
|
16
|
+
id: Math.random(),
|
|
17
|
+
isLoggedIn: false,
|
|
18
|
+
messages: [
|
|
19
|
+
{
|
|
20
|
+
message: 'hello',
|
|
21
|
+
id: Math.random(),
|
|
22
|
+
isLoggedIn: false,
|
|
23
|
+
|
|
24
|
+
},
|
|
25
|
+
]
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
username: 'Jack',
|
|
29
|
+
id: Math.random(),
|
|
30
|
+
isLoggedIn: false,
|
|
31
|
+
messages: [
|
|
32
|
+
{
|
|
33
|
+
message: 'hello',
|
|
34
|
+
id: Math.random(),
|
|
35
|
+
isLoggedIn: false,
|
|
36
|
+
|
|
37
|
+
},
|
|
38
|
+
]
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
username: 'Conner',
|
|
42
|
+
id: Math.random(),
|
|
43
|
+
isLoggedIn: false,
|
|
44
|
+
messages: [
|
|
45
|
+
{
|
|
46
|
+
message: 'hi',
|
|
47
|
+
id: Math.random(),
|
|
48
|
+
isLogged: false,
|
|
49
|
+
|
|
50
|
+
},
|
|
51
|
+
]
|
|
52
|
+
},
|
|
53
|
+
]
|