Skip to content

Commit 9a3b7ac

Browse files
Fixed UI issues for Sidebar (#634)
* Fixed UI issues for Sidebar * Fixed sidebar height issue * Removed unnecessary spacing * Fixed reply in thread issue * Adjusted dynamic header visibility * Revert zIndex changes * Linting fix * Run prettier * Remove zIndex * Adjusted zIndex for ViewComponent * Fix sidebar width * Remove global css for sidebar --------- Co-authored-by: Zishan Ahmad <[email protected]>
1 parent 1058405 commit 9a3b7ac

File tree

7 files changed

+30
-5
lines changed

7 files changed

+30
-5
lines changed

packages/react/src/views/ChatHeader/ChatHeader.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import {
2121
usePinnedMessageStore,
2222
useStarredMessageStore,
2323
useFileStore,
24+
useSidebarStore,
2425
} from '../../store';
2526
import { DynamicHeader } from '../DynamicHeader';
2627
import useFetchChatData from '../../hooks/useFetchChatData';
@@ -84,7 +85,7 @@ const ChatHeader = ({
8485
const setIsUserAuthenticated = useUserStore(
8586
(state) => state.setIsUserAuthenticated
8687
);
87-
88+
const setShowSidebar = useSidebarStore((state) => state.setShowSidebar);
8889
const dispatchToastMessage = useToastBarDispatch();
8990
const { getMessagesAndRoles } = useFetchChatData(showRoles);
9091
const setMessageLimit = useSettingsStore((state) => state.setMessageLimit);
@@ -130,6 +131,7 @@ const ChatHeader = ({
130131
try {
131132
await RCInstance.logout();
132133
setMessages([]);
134+
setShowSidebar(false);
133135
setUserAvatarUrl(null);
134136
useMessageStore.setState({ isMessageLoaded: false });
135137
} catch (e) {

packages/react/src/views/GlobalStyles.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ const getGlobalStyles = (theme) => css`
88
margin: 0;
99
padding: 0;
1010
}
11-
1211
.ec-embedded-chat body {
1312
font-family: ${theme.typography.default.fontFamily};
1413
font-size: ${theme.typography.default.fontSize}px;
@@ -36,6 +35,17 @@ const getGlobalStyles = (theme) => css`
3635
.ec-embedded-chat ::-webkit-scrollbar-button {
3736
display: none;
3837
}
38+
@media (max-width: 780px) {
39+
.ec-sidebar {
40+
position: absolute;
41+
width: 100% !important;
42+
height: calc(100% - 56.39px) !important;
43+
min-width: 250px !important;
44+
left: 0;
45+
bottom: 0;
46+
background: ${theme.colors.background}!important;
47+
}
48+
}
3949
`;
4050

4151
const GlobalStyles = () => {

packages/react/src/views/Message/Message.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
import { Attachments } from '../AttachmentHandler';
1212
import { Markdown } from '../Markdown';
1313
import MessageHeader from './MessageHeader';
14-
import { useMessageStore, useUserStore } from '../../store';
14+
import { useMessageStore, useUserStore, useSidebarStore } from '../../store';
1515
import RCContext from '../../context/RCInstance';
1616
import { MessageBody } from './MessageBody';
1717
import { MessageReactions } from './MessageReactions';
@@ -49,7 +49,7 @@ const Message = ({
4949

5050
const { RCInstance, ECOptions } = useContext(RCContext);
5151
showAvatar = ECOptions?.showAvatar && showAvatar;
52-
52+
const { showSidebar, setShowSidebar } = useSidebarStore();
5353
const authenticatedUserId = useUserStore((state) => state.userId);
5454
const authenticatedUserUsername = useUserStore((state) => state.username);
5555
const userRoles = useUserStore((state) => state.roles);
@@ -137,6 +137,7 @@ const Message = ({
137137

138138
const handleOpenThread = (msg) => async () => {
139139
openThread(msg);
140+
setShowSidebar(false);
140141
};
141142

142143
const isStarred = message.starred?.find((u) => u._id === authenticatedUserId);

packages/react/src/views/Message/Message.styles.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ export const getMessageDividerStyles = (theme) => {
8181
margin-bottom: 0.75rem;
8282
padding-left: 1.25rem;
8383
padding-right: 1.25rem;
84+
@media (max-width: 780px) {
85+
z-index: 1;
86+
}
8487
`,
8588

8689
dividerContent: css`

packages/react/src/views/MessageAggregators/common/MessageAggregator.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,11 @@ export const MessageAggregator = ({
7070
iconName={iconName}
7171
searchProps={searchProps}
7272
onClose={() => setExclusiveState(null)}
73-
style={{ padding: 0 }}
73+
style={{
74+
width: '400px',
75+
padding: 0,
76+
zIndex: window.innerWidth <= 780 ? 1 : null,
77+
}}
7478
{...(viewType === 'Popup'
7579
? {
7680
isPopupHeader: true,
@@ -126,6 +130,9 @@ export const MessageAggregator = ({
126130
isInSidebar
127131
style={{
128132
flex: 1,
133+
paddingLeft: 3,
134+
paddingRight: 2,
135+
minWidth: 0,
129136
}}
130137
/>
131138

packages/react/src/views/RoomInformation/RoomInformation.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ const Roominfo = () => {
3030
title="Room Information"
3131
iconName="info"
3232
onClose={() => setExclusiveState(null)}
33+
style={{ width: '400px', zIndex: window.innerWidth <= 780 ? 1 : null }}
3334
{...(viewType === 'Popup'
3435
? {
3536
isPopupHeader: true,

packages/react/src/views/RoomMembers/RoomMember.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ const RoomMembers = ({ members }) => {
5555
title="Members"
5656
iconName="members"
5757
onClose={() => setExclusiveState(null)}
58+
style={{ width: '400px', zIndex: window.innerWidth <= 780 ? 1 : null }}
5859
{...(viewType === 'Popup'
5960
? {
6061
isPopupHeader: true,

0 commit comments

Comments
 (0)