diff --git a/packages/react/src/components/AllThreads/AllThreads.js b/packages/react/src/components/AllThreads/AllThreads.js index 389b5034b..9255231df 100644 --- a/packages/react/src/components/AllThreads/AllThreads.js +++ b/packages/react/src/components/AllThreads/AllThreads.js @@ -3,7 +3,6 @@ import { css } from '@emotion/react'; import classes from './AllThreads.module.css'; import { Icon } from '../Icon'; import { Box } from '../Box'; -import { ActionButton } from '../ActionButton'; import { useMessageStore, useUserStore, @@ -14,6 +13,7 @@ import { MessageMetrics } from '../Message/MessageMetrics'; import MessageAvatarContainer from '../Message/MessageAvatarContainer'; import MessageBodyContainer from '../Message/MessageBodyContainer'; import MessageHeader from '../Message/MessageHeader'; +import Sidebar from '../Sidebar/Sidebar'; const MessageCss = css` display: flex; @@ -65,115 +65,86 @@ const AllThreads = () => { ); return ( - - - - -

- - - Threads - - - - -

-
+ + + + + + + + {filteredThreads.length === 0 ? ( - - - + + + No threads found + - - - - {filteredThreads.length === 0 ? ( - - - - No threads found - - - ) : ( - filteredThreads.map( - (message) => - !message.t && - message.tcount && ( - - {showAvatar && ( - - )} - - + ) : ( + filteredThreads.map( + (message) => + !message.t && + message.tcount && ( + + {showAvatar && ( + + )} + + - - {message.attachments && message.attachments.length > 0 - ? message.file.name - : message.msg} - + + {message.attachments && message.attachments.length > 0 + ? message.file.name + : message.msg} + - - - - ) - ) - )} - + + + + ) + ) + )}
-
+ ); }; diff --git a/packages/react/src/components/RoomInformation/RoomInformation.js b/packages/react/src/components/RoomInformation/RoomInformation.js index 059403dfd..dd3146f36 100644 --- a/packages/react/src/components/RoomInformation/RoomInformation.js +++ b/packages/react/src/components/RoomInformation/RoomInformation.js @@ -2,11 +2,9 @@ import React, { useContext } from 'react'; import { css } from '@emotion/react'; import { Avatar } from '../Avatar/Avatar'; import RCContext from '../../context/RCInstance'; -import classes from './RoomInformation.module.css'; import { useChannelStore } from '../../store'; -import { Icon } from '../Icon'; import { Box } from '../Box'; -import { ActionButton } from '../ActionButton'; +import Sidebar from '../Sidebar/Sidebar'; const Roominfo = () => { const { RCInstance } = useContext(RCContext); @@ -17,41 +15,17 @@ const Roominfo = () => { (state) => state.setShowChannelinfo ); - const toggleshowRoominfo = () => { - setShowChannelinfo(false); - }; - const getChannelAvatarURL = (channelname) => { const host = RCInstance.getHost(); return `${host}/avatar/${channelname}`; }; - return ( - - -

- - - Room Information - - - - -

-
+ return ( + { {channelInfo.description}
-
+ ); }; export default Roominfo; diff --git a/packages/react/src/components/RoomMembers/RoomMember.js b/packages/react/src/components/RoomMembers/RoomMember.js index ae0d9440b..6dcce6b28 100644 --- a/packages/react/src/components/RoomMembers/RoomMember.js +++ b/packages/react/src/components/RoomMembers/RoomMember.js @@ -10,6 +10,7 @@ import { Button } from '../Button'; import { Box } from '../Box'; import { Icon } from '../Icon'; import { ActionButton } from '../ActionButton'; +import Sidebar from '../Sidebar/Sidebar'; const RoomMembers = ({ members }) => { const { RCInstance } = useContext(RCContext); @@ -43,20 +44,11 @@ const RoomMembers = ({ members }) => { if (showInvite) return ; return ( - - -

- - Members - - - -

-
+ {members.map((member) => ( @@ -74,7 +66,7 @@ const RoomMembers = ({ members }) => { Invite Link )} - + ); }; export default RoomMembers; diff --git a/packages/react/src/components/SearchMessage/SearchMessage.js b/packages/react/src/components/SearchMessage/SearchMessage.js index 06d289734..bfb2af30e 100644 --- a/packages/react/src/components/SearchMessage/SearchMessage.js +++ b/packages/react/src/components/SearchMessage/SearchMessage.js @@ -6,18 +6,14 @@ import classes from './SearchMessage.module.css'; import { useSearchMessageStore } from '../../store'; import { Box } from '../Box'; import { Icon } from '../Icon'; -import { ActionButton } from '../ActionButton'; import { MessageDivider } from '../Message/MessageDivider'; import { Message } from '../Message'; +import Sidebar from '../Sidebar/Sidebar'; const Search = () => { const { RCInstance } = useContext(RCContext); const setShowSearch = useSearchMessageStore((state) => state.setShowSearch); - const toggleShowSearch = () => { - setShowSearch(false); - }; - const [text, setText] = useState(''); const [messageList, setMessageList] = useState([]); @@ -53,104 +49,83 @@ const Search = () => { !previous || !isSameDay(new Date(current.ts), new Date(previous.ts)); return ( - - - -

- - - Search Messages - - - - -

-
- - + + + - - - - {messageList.length === 0 ? ( - - - - No results found - - - ) : ( - messageList.map((msg, index, arr) => { - const prev = arr[index + 1]; - const newDay = isMessageNewDay(msg, prev); - return ( - - {newDay && ( - - - {format(new Date(msg.ts), 'MMMM d, yyyy')} - - - )} - - - ); - }) - )} - + + + + {messageList.length === 0 ? ( + + + + No results found + + + ) : ( + messageList.map((msg, index, arr) => { + const prev = arr[index + 1]; + const newDay = isMessageNewDay(msg, prev); + return ( + + {newDay && ( + + + {format(new Date(msg.ts), 'MMMM d, yyyy')} + + + )} + + + ); + }) + )} -
+ ); }; export default Search; diff --git a/packages/react/src/components/SearchMessage/SearchMessage.module.css b/packages/react/src/components/SearchMessage/SearchMessage.module.css index a90e7f4c6..cb98500b9 100644 --- a/packages/react/src/components/SearchMessage/SearchMessage.module.css +++ b/packages/react/src/components/SearchMessage/SearchMessage.module.css @@ -1,22 +1,3 @@ -.searchBar { - position: fixed; - right: 0; - top: 0; - width: 350px; - height: 100%; - overflow-x: scroll; - overflow-y: scroll; - background-color: white; - box-shadow: -1px 0px 5px rgb(0 0 0 / 25%); - z-index: 100; -} - -.wrapContainer { - height: 100%; - display: flex; - flex-direction: column; -} - .container { display: flex; align-items: center; diff --git a/packages/react/src/components/Sidebar/Sidebar.js b/packages/react/src/components/Sidebar/Sidebar.js new file mode 100644 index 000000000..59851417f --- /dev/null +++ b/packages/react/src/components/Sidebar/Sidebar.js @@ -0,0 +1,33 @@ +import React from 'react'; +import classes from './Sidebar.module.css'; +import { Box } from '../Box'; +import { Icon } from '../Icon'; +import { ActionButton } from '../ActionButton'; + +const Sidebar = ({ title, iconName, setShowWindow, children }) => { + return ( + + + +

+ + {title} + setShowWindow(false)} + ghost + size="small" + > + + +

+
+
+ {children} +
+ ); +}; +export default Sidebar; diff --git a/packages/react/src/components/Sidebar/Sidebar.module.css b/packages/react/src/components/Sidebar/Sidebar.module.css new file mode 100644 index 000000000..2c03abfeb --- /dev/null +++ b/packages/react/src/components/Sidebar/Sidebar.module.css @@ -0,0 +1,44 @@ +.sidebar { + position: fixed; + right: 0; + top: 0; + width: 350px; + height: 100%; + overflow-x: scroll; + overflow-y: scroll; + background-color: white; + box-shadow: -1px 0px 5px rgb(0 0 0 / 25%); + z-index: 100; + padding: 1rem; +} + +.sidebarContainer { + display: flex; + flex-direction: column; +} + +.sidebarHeader { + display: flex; + flex-direction: row; + align-items: center; + gap: 0.5rem; + padding: 1rem; + margin-bottom: 1rem +} + +.sidebarTitle { + color: #4a4a4a; + width: 80%; +} + +.sidebarIcon { + size: 1.25rem; + padding: 0 0.5 0.5 0rem; +} + +@media (max-width: 550px) { + .sidebar { + width: 100vw; + } +} + diff --git a/packages/react/src/components/UserMentions/UserMentions.js b/packages/react/src/components/UserMentions/UserMentions.js index 1bd655aa6..304803387 100644 --- a/packages/react/src/components/UserMentions/UserMentions.js +++ b/packages/react/src/components/UserMentions/UserMentions.js @@ -1,11 +1,9 @@ import React, { useState, useEffect } from 'react'; import { css } from '@emotion/react'; import { isSameDay, format } from 'date-fns'; -import classes from './UserMentions.module.css'; import { Icon } from '../Icon'; import { Box } from '../Box'; import { Attachments } from '../Attachments'; -import { ActionButton } from '../ActionButton'; import { useMessageStore, useUserStore, useMentionsStore } from '../../store'; import { MessageBody } from '../Message/MessageBody'; import { MessageMetrics } from '../Message/MessageMetrics'; @@ -15,6 +13,7 @@ import { MessageDivider } from '../Message/MessageDivider'; import MessageAvatarContainer from '../Message/MessageAvatarContainer'; import MessageBodyContainer from '../Message/MessageBodyContainer'; import MessageHeader from '../Message/MessageHeader'; +import Sidebar from '../Sidebar/Sidebar'; const MessageCss = css` display: flex; @@ -65,115 +64,86 @@ const UserMentions = () => { }, [RCInstance, setMentionedMessages]); return ( - - - - -

+ + {isLoaded && ( + + {mentionedMessages.length === 0 ? ( + - - Mentions - - - - -

-
-
+ + No mentions found + +
+ ) : ( + mentionedMessages.map((message, index, arr) => { + const newDay = + index === 0 || isMessageNewDay(message, arr[index - 1]); + return ( + + {newDay ? ( + + {format(new Date(message.ts), 'MMMM d, yyyy')} + + ) : null} + + {showAvatar && ( + + )} + + - {isLoaded && ( - - {mentionedMessages.length === 0 ? ( - - - - No mentions found - - - ) : ( - mentionedMessages.map((message, index, arr) => { - const newDay = - index === 0 || isMessageNewDay(message, arr[index - 1]); - return ( - - {newDay ? ( - - {format(new Date(message.ts), 'MMMM d, yyyy')} - - ) : null} - - {showAvatar && ( - + {message.attachments && + message.attachments.length > 0 ? ( + <> + + + + ) : ( + + )} + + + {!message.t && message.tcount && ( + )} - - - - - {message.attachments && - message.attachments.length > 0 ? ( - <> - - - - ) : ( - - )} - - - {!message.t && message.tcount && ( - - )} - - - - ); - }) - )} - - )} - -
+ +
+ + ); + }) + )} +
+ )} + ); }; diff --git a/packages/react/src/components/UserMentions/UserMentions.module.css b/packages/react/src/components/UserMentions/UserMentions.module.css deleted file mode 100644 index cca051f27..000000000 --- a/packages/react/src/components/UserMentions/UserMentions.module.css +++ /dev/null @@ -1,22 +0,0 @@ -.component { - position: fixed; - right: 0; - top: 0; - width: 350px; - height: 100%; - overflow: hidden; - background-color: white; - box-shadow: -1px 0px 5px rgb(0 0 0 / 25%); - z-index: 100; -} -.wrapContainer { - height: 100%; - display: flex; - flex-direction: column; -} - -@media (max-width: 550px) { - .component { - width: 100vw; - } -}