Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX #356 : Fixed JOIN button behaviour when anonymousMode set to false #357

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
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
7 changes: 7 additions & 0 deletions packages/react/src/components/ChatBody/ChatBody.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import useAttachmentWindowStore from '../../store/attachmentwindow';
import ThreadMessageList from '../Thread/ThreadMessageList';
import ModalBlock from '../uiKit/blocks/ModalBlock';
import useComponentOverrides from '../../theme/useComponentOverrides';
import { Home } from '../Home';

const ChatBody = ({ height, anonymousMode, showRoles, messageListRef }) => {
const { classNames, styleOverrides } = useComponentOverrides('ChatBody');
Expand Down Expand Up @@ -85,6 +86,7 @@ const ChatBody = ({ height, anonymousMode, showRoles, messageListRef }) => {
async (anonymousMode) => {
try {
if (!isUserAuthenticated && !anonymousMode) {
setMessages([]);
return;
}
const { messages } = await RCInstance.getMessages(
Expand Down Expand Up @@ -274,6 +276,8 @@ const ChatBody = ({ height, anonymousMode, showRoles, messageListRef }) => {
className={`ec-chat-body ${classNames}`}
height={height}
>
{!isUserAuthenticated && !anonymousMode && <Home height={height} />}

{onDrag ? (
<Box onDrop={(e) => handleDragDrop(e)} className={DragComponentCss}>
Drop to upload file
Expand All @@ -287,8 +291,11 @@ const ChatBody = ({ height, anonymousMode, showRoles, messageListRef }) => {
) : (
<MessageList messages={messages} handleGoBack={handleGoBack} />
)}

<TotpModal handleLogin={handleLogin} />

<LoginForm />

{isModalOpen && (
<ModalBlock
appId={viewData.appId}
Expand Down
16 changes: 5 additions & 11 deletions packages/react/src/components/EmbeddedChat.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { EmbeddedChatApi } from '@embeddedchat/api';
import { ChatBody } from './ChatBody';
import { ChatHeader } from './ChatHeader';
import { ChatInput } from './ChatInput';
import { Home } from './Home';
import { RCInstanceProvider } from '../context/RCInstance';
import { useToastStore, useUserStore } from '../store';
import AttachmentWindow from './Attachments/AttachmentWindow';
Expand Down Expand Up @@ -216,16 +215,11 @@ const EmbeddedChat = ({
setFullScreen={setFullScreen}
/>
)}
{isUserAuthenticated || anonymousMode ? (
<ChatBody
height={!fullScreen ? height : '88vh'}
anonymousMode={anonymousMode}
showRoles={showRoles}
messageListRef={messageListRef}
/>
) : (
<Home height={!fullScreen ? height : '88vh'} />
)}
<ChatBody
height={!fullScreen ? height : '88vh'}
anonymousMode={anonymousMode}
showRoles={showRoles}
/>
<ChatInput scrollToBottom={scrollToBottom} />
</Box>
</RCInstanceProvider>
Expand Down