Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/react/src/views/ChatInput/ChatInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import useSearchMentionUser from '../../hooks/useSearchMentionUser';
import formatSelection from '../../lib/formatSelection';
import { parseEmoji } from '../../lib/emoji';

const ChatInput = ({ scrollToBottom }) => {
const ChatInput = ({ scrollToBottom}) => {
const { styleOverrides, classNames } = useComponentOverrides('ChatInput');
const { RCInstance, ECOptions } = useRCContext();
const { theme } = useTheme();
Expand Down
30 changes: 29 additions & 1 deletion packages/react/src/views/ChatLayout/ChatLayout.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ import UiKitContextualBar from '../ContextualBarBlock/uiKit/UiKitContextualBar';
import useUiKitStore from '../../store/uiKitStore';

const ChatLayout = () => {

const [mode, setMode] = useState('light');
const toggleTheme = () => {
setMode((prev) => (prev === 'light' ? 'dark' : 'light'));
};

const messageListRef = useRef(null);
const { classNames, styleOverrides } = useComponentOverrides('ChatBody');
const { RCInstance, ECOptions } = useRCContext();
Expand Down Expand Up @@ -102,19 +108,41 @@ const ChatLayout = () => {
css={styles.layout}
style={{
...styleOverrides,
position:'relative',
backgroundColor: mode === 'light' ? '#000' : '#fff',
color: mode === 'light' ? '#fff' : '#000',
border: '1px solid black',
}}
className={`ec-chat-layout ${classNames}`}
onDragOver={(e) => handleDrag(e)}
onDrop={(e) => handleDragDrop(e)}
>
<Box
css={{
position: 'absolute',
top: '12px',
right: '12px',
zIndex: 9999,
padding: '6px 12px',
background: mode === 'dark' ? '#fff' : '#000',
color: mode === 'dark' ? '#000' : '#fff',
border: mode==='dark' ? '1px solid black':'1px solid white',
borderRadius: '6px',
fontSize: '14px',
cursor: 'pointer',
}}
onClick={toggleTheme}
>
{mode === 'light' ? '🌙 Dark' : '☀️ Light'}
</Box>
<Box css={styles.chatMain}>
<ChatBody
anonymousMode={anonymousMode}
showRoles={showRoles}
messageListRef={messageListRef}
scrollToBottom={scrollToBottom}
/>
<ChatInput scrollToBottom={scrollToBottom} />
<ChatInput scrollToBottom={scrollToBottom} mode={mode} />
<div id="emoji-popup" />
</Box>

Expand Down
29 changes: 22 additions & 7 deletions packages/react/src/views/MessageList/MessageList.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ const MessageList = ({
const showReportMessage = useMessageStore((state) => state.showReportMessage);
const messageToReport = useMessageStore((state) => state.messageToReport);
const isMessageLoaded = useMessageStore((state) => state.isMessageLoaded);



const { theme } = useTheme();

const isMessageNewDay = (current, previous) =>
Expand All @@ -30,21 +33,33 @@ const MessageList = ({

return (
<>
{filteredMessages.length === 0 ? (
{filteredMessages.length === 0 ? (
<Box
css={css`
text-align: center;
margin: auto;
`}
>
<Icon name="thread" size="2rem" />
<Box>
{isMessageLoaded
? 'No messages'
: 'Ready to chat? Login now to join the fun.'}
</Box>
{!isUserAuthenticated ? (
<>
<Icon name="thread" size="2rem" />
<Box>Sign in to start the conversation.</Box>
</>
) : !isMessageLoaded ? (
<>
<Throbber />
<Box mt="8px">Loading messages...</Box>
</>
) : (
<>
<Icon name="thread" size="2rem" />
<Box>No messages yet</Box>
</>
)}
</Box>
) : (


<>
{!hasMoreMessages && isUserAuthenticated && (
<MessageBody
Expand Down