2022-05-01 20:56:11 -07:00
|
|
|
import { Virtuoso } from 'react-virtuoso';
|
2023-01-05 02:16:37 -08:00
|
|
|
import { useState, useMemo, useRef, CSSProperties, FC, useEffect } from 'react';
|
2023-03-12 21:53:02 -07:00
|
|
|
import { ErrorBoundary } from 'react-error-boundary';
|
2024-04-15 06:06:29 +05:00
|
|
|
import { Interweave } from 'interweave';
|
2022-07-14 20:36:47 -07:00
|
|
|
import {
|
|
|
|
ConnectedClientInfoEvent,
|
2023-02-05 19:58:24 -08:00
|
|
|
FediverseEvent,
|
2022-07-14 20:36:47 -07:00
|
|
|
MessageType,
|
|
|
|
NameChangeEvent,
|
|
|
|
} from '../../../interfaces/socket-events';
|
2022-09-07 09:00:28 +02:00
|
|
|
import styles from './ChatContainer.module.scss';
|
2022-05-25 20:38:40 -07:00
|
|
|
import { ChatMessage } from '../../../interfaces/chat-message.model';
|
2022-09-07 09:00:28 +02:00
|
|
|
import { ChatUserMessage } from '../ChatUserMessage/ChatUserMessage';
|
|
|
|
import { ChatTextField } from '../ChatTextField/ChatTextField';
|
|
|
|
import { ChatModeratorNotification } from '../ChatModeratorNotification/ChatModeratorNotification';
|
|
|
|
import { ChatSystemMessage } from '../ChatSystemMessage/ChatSystemMessage';
|
|
|
|
import { ChatJoinMessage } from '../ChatJoinMessage/ChatJoinMessage';
|
2023-09-10 10:58:11 -07:00
|
|
|
import { ChatPartMessage } from '../ChatPartMessage/ChatPartMessage';
|
2022-09-30 13:17:22 +02:00
|
|
|
import { ScrollToBotBtn } from './ScrollToBotBtn';
|
2022-10-18 19:44:42 -07:00
|
|
|
import { ChatActionMessage } from '../ChatActionMessage/ChatActionMessage';
|
2023-02-05 19:58:24 -08:00
|
|
|
import { ChatSocialMessage } from '../ChatSocialMessage/ChatSocialMessage';
|
2023-02-19 16:20:07 -08:00
|
|
|
import { ChatNameChangeMessage } from '../ChatNameChangeMessage/ChatNameChangeMessage';
|
2023-03-03 21:54:01 -08:00
|
|
|
import { User } from '../../../interfaces/user.model';
|
2023-03-12 21:53:02 -07:00
|
|
|
import { ComponentError } from '../../ui/ComponentError/ComponentError';
|
2023-02-18 11:58:46 -08:00
|
|
|
|
2022-09-07 09:00:28 +02:00
|
|
|
export type ChatContainerProps = {
|
2022-04-27 23:19:20 -07:00
|
|
|
messages: ChatMessage[];
|
2022-06-24 21:30:54 -07:00
|
|
|
usernameToHighlight: string;
|
|
|
|
chatUserId: string;
|
|
|
|
isModerator: boolean;
|
2022-09-04 21:46:54 -07:00
|
|
|
showInput?: boolean;
|
|
|
|
height?: string;
|
2023-03-01 16:19:02 -08:00
|
|
|
chatAvailable: boolean;
|
2023-05-22 18:56:44 -07:00
|
|
|
focusInput?: boolean;
|
2023-07-11 06:00:28 +00:00
|
|
|
desktop?: boolean;
|
2022-09-07 09:00:28 +02:00
|
|
|
};
|
|
|
|
|
2023-07-13 19:36:21 +00:00
|
|
|
let resizeWindowCallback: () => void;
|
|
|
|
|
2023-07-05 18:51:16 +00:00
|
|
|
function shouldCollapseMessages(message: ChatMessage, previous: ChatMessage): boolean {
|
|
|
|
if (!message || !message.user) {
|
2022-09-07 09:00:28 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2023-07-05 18:51:16 +00:00
|
|
|
if (previous.type !== MessageType.CHAT) {
|
2022-11-13 14:49:49 -08:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2022-09-07 09:00:28 +02:00
|
|
|
const {
|
|
|
|
user: { id },
|
|
|
|
} = message;
|
2023-07-05 18:51:16 +00:00
|
|
|
if (id !== previous.user.id) {
|
2022-09-07 09:00:28 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2023-07-05 18:51:16 +00:00
|
|
|
if (!previous.timestamp || !message.timestamp) {
|
2022-09-07 09:00:28 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2023-06-02 19:48:07 -07:00
|
|
|
const maxTimestampDelta = 1000 * 40; // 40 seconds
|
2023-07-05 18:51:16 +00:00
|
|
|
const lastTimestamp = new Date(previous.timestamp).getTime();
|
2022-09-07 09:00:28 +02:00
|
|
|
const thisTimestamp = new Date(message.timestamp).getTime();
|
|
|
|
if (thisTimestamp - lastTimestamp > maxTimestampDelta) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2023-02-20 12:00:49 -08:00
|
|
|
return true;
|
2022-04-27 23:19:20 -07:00
|
|
|
}
|
|
|
|
|
2022-09-30 09:57:12 +02:00
|
|
|
function checkIsModerator(message: ChatMessage | ConnectedClientInfoEvent) {
|
2023-03-03 21:54:01 -08:00
|
|
|
const { user } = message;
|
2022-09-07 09:00:28 +02:00
|
|
|
|
2023-03-03 21:54:01 -08:00
|
|
|
const u = new User(user);
|
2023-05-31 13:28:06 -07:00
|
|
|
return u.isModerator;
|
2022-09-07 09:00:28 +02:00
|
|
|
}
|
2022-04-29 15:09:53 -07:00
|
|
|
|
2022-09-07 09:00:28 +02:00
|
|
|
export const ChatContainer: FC<ChatContainerProps> = ({
|
|
|
|
messages,
|
|
|
|
usernameToHighlight,
|
|
|
|
chatUserId,
|
|
|
|
isModerator,
|
|
|
|
showInput,
|
|
|
|
height,
|
2023-03-01 16:19:02 -08:00
|
|
|
chatAvailable: chatEnabled,
|
2023-07-11 06:00:28 +00:00
|
|
|
desktop,
|
2023-05-22 18:56:44 -07:00
|
|
|
focusInput = true,
|
2022-09-07 09:00:28 +02:00
|
|
|
}) => {
|
2023-02-18 11:58:46 -08:00
|
|
|
const [showScrollToBottomButton, setShowScrollToBottomButton] = useState(false);
|
|
|
|
const [isAtBottom, setIsAtBottom] = useState(false);
|
|
|
|
|
2022-05-01 20:56:11 -07:00
|
|
|
const chatContainerRef = useRef(null);
|
2023-02-18 11:58:46 -08:00
|
|
|
const scrollToBottomDelay = useRef(null);
|
|
|
|
|
2023-07-05 18:51:16 +00:00
|
|
|
const collapsedIndexes: boolean[] = [];
|
|
|
|
let consecutiveTally: number = 1;
|
|
|
|
|
|
|
|
function calculateCollapsedMessages() {
|
|
|
|
// Limits the number of messages that can be collapsed in a row.
|
|
|
|
const maxCollapsedMessageCount = 5;
|
|
|
|
for (let i = collapsedIndexes.length; i < messages.length; i += 1) {
|
|
|
|
const collapse: boolean =
|
|
|
|
i > 0 &&
|
|
|
|
consecutiveTally < maxCollapsedMessageCount &&
|
|
|
|
shouldCollapseMessages(messages[i], messages[i - 1]);
|
|
|
|
collapsedIndexes.push(collapse);
|
|
|
|
consecutiveTally = 1 + (collapse ? consecutiveTally : 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function shouldCollapse(index: number): boolean {
|
|
|
|
if (collapsedIndexes.length <= index) {
|
|
|
|
calculateCollapsedMessages();
|
|
|
|
}
|
|
|
|
return collapsedIndexes[index];
|
|
|
|
}
|
2023-02-20 12:00:49 -08:00
|
|
|
|
2023-02-18 11:58:46 -08:00
|
|
|
useEffect(
|
|
|
|
() =>
|
|
|
|
// Clear the timer when the component unmounts
|
|
|
|
() => {
|
|
|
|
clearTimeout(scrollToBottomDelay.current);
|
|
|
|
},
|
|
|
|
[],
|
|
|
|
);
|
2022-05-03 14:17:05 -07:00
|
|
|
|
2023-02-05 19:58:24 -08:00
|
|
|
const getFediverseMessage = (message: FediverseEvent) => <ChatSocialMessage message={message} />;
|
|
|
|
|
2022-07-14 21:05:34 -07:00
|
|
|
const getUserJoinedMessage = (message: ChatMessage) => {
|
2022-09-30 09:57:12 +02:00
|
|
|
const {
|
|
|
|
user: { displayName, displayColor },
|
|
|
|
} = message;
|
2022-08-21 15:50:22 -07:00
|
|
|
const isAuthorModerator = checkIsModerator(message);
|
2022-07-14 21:05:34 -07:00
|
|
|
return (
|
2022-08-21 15:50:22 -07:00
|
|
|
<ChatJoinMessage
|
|
|
|
displayName={displayName}
|
|
|
|
userColor={displayColor}
|
|
|
|
isAuthorModerator={isAuthorModerator}
|
2022-07-14 21:05:34 -07:00
|
|
|
/>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2023-09-10 10:58:11 -07:00
|
|
|
const getUserPartMessage = (message: ChatMessage) => {
|
|
|
|
const {
|
|
|
|
user: { displayName, displayColor },
|
|
|
|
} = message;
|
|
|
|
const isAuthorModerator = checkIsModerator(message);
|
|
|
|
return (
|
|
|
|
<ChatPartMessage
|
|
|
|
displayName={displayName}
|
|
|
|
userColor={displayColor}
|
|
|
|
isAuthorModerator={isAuthorModerator}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2022-10-18 19:44:42 -07:00
|
|
|
const getActionMessage = (message: ChatMessage) => {
|
|
|
|
const { body } = message;
|
|
|
|
return <ChatActionMessage body={body} />;
|
|
|
|
};
|
2023-02-18 11:58:46 -08:00
|
|
|
|
2022-07-14 20:36:47 -07:00
|
|
|
const getConnectedInfoMessage = (message: ConnectedClientInfoEvent) => {
|
|
|
|
const modStatusUpdate = checkIsModerator(message);
|
|
|
|
if (!modStatusUpdate) {
|
2022-08-09 20:58:10 -07:00
|
|
|
// Important note: We can't return null or an element with zero width
|
|
|
|
// or zero height. So to work around this we return a very small 1x1 div.
|
|
|
|
const st: CSSProperties = { width: '1px', height: '1px' };
|
|
|
|
return <div style={st} />;
|
2022-07-14 20:36:47 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
// Alert the user that they are a moderator.
|
|
|
|
return <ChatModeratorNotification />;
|
|
|
|
};
|
|
|
|
|
2023-02-20 12:00:49 -08:00
|
|
|
const getUserChatMessageView = (index: number, message: ChatMessage) => {
|
2023-05-31 16:54:30 -07:00
|
|
|
const isAuthorModerator = checkIsModerator(message);
|
|
|
|
|
2023-02-20 12:00:49 -08:00
|
|
|
return (
|
|
|
|
<ChatUserMessage
|
|
|
|
message={message}
|
|
|
|
showModeratorMenu={isModerator} // Moderators have access to an additional menu
|
|
|
|
highlightString={usernameToHighlight} // What to highlight in the message
|
|
|
|
sentBySelf={message.user?.id === chatUserId} // The local user sent this message
|
2023-07-05 18:51:16 +00:00
|
|
|
sameUserAsLast={shouldCollapse(index)}
|
2023-05-31 16:54:30 -07:00
|
|
|
isAuthorModerator={isAuthorModerator}
|
2023-05-31 13:28:06 -07:00
|
|
|
isAuthorBot={message.user?.isBot}
|
2023-02-20 12:00:49 -08:00
|
|
|
isAuthorAuthenticated={message.user?.authenticated}
|
|
|
|
key={message.id}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
};
|
2022-07-14 20:36:47 -07:00
|
|
|
const getViewForMessage = (
|
|
|
|
index: number,
|
2023-02-05 19:58:24 -08:00
|
|
|
message: ChatMessage | NameChangeEvent | ConnectedClientInfoEvent | FediverseEvent,
|
2022-07-14 20:36:47 -07:00
|
|
|
) => {
|
2022-05-03 14:17:05 -07:00
|
|
|
switch (message.type) {
|
|
|
|
case MessageType.CHAT:
|
2023-02-20 12:00:49 -08:00
|
|
|
return getUserChatMessageView(index, message as ChatMessage);
|
2022-05-26 13:52:04 -07:00
|
|
|
case MessageType.NAME_CHANGE:
|
2023-02-19 16:20:07 -08:00
|
|
|
return <ChatNameChangeMessage message={message as NameChangeEvent} />;
|
2022-07-14 20:36:47 -07:00
|
|
|
case MessageType.CONNECTED_USER_INFO:
|
2023-02-05 19:58:24 -08:00
|
|
|
return getConnectedInfoMessage(message as ConnectedClientInfoEvent);
|
2022-07-14 21:05:34 -07:00
|
|
|
case MessageType.USER_JOINED:
|
|
|
|
return getUserJoinedMessage(message as ChatMessage);
|
2023-09-10 10:58:11 -07:00
|
|
|
case MessageType.USER_PARTED:
|
|
|
|
return getUserPartMessage(message as ChatMessage);
|
2022-10-18 19:44:42 -07:00
|
|
|
case MessageType.CHAT_ACTION:
|
|
|
|
return getActionMessage(message as ChatMessage);
|
2022-08-10 20:22:00 -07:00
|
|
|
case MessageType.SYSTEM:
|
|
|
|
return (
|
|
|
|
<ChatSystemMessage
|
|
|
|
message={message as ChatMessage}
|
|
|
|
highlightString={usernameToHighlight} // What to highlight in the message
|
|
|
|
key={message.id}
|
|
|
|
/>
|
|
|
|
);
|
2023-02-05 19:58:24 -08:00
|
|
|
case MessageType.FEDIVERSE_ENGAGEMENT_FOLLOW:
|
|
|
|
return getFediverseMessage(message as FediverseEvent);
|
|
|
|
case MessageType.FEDIVERSE_ENGAGEMENT_LIKE:
|
|
|
|
return getFediverseMessage(message as FediverseEvent);
|
|
|
|
case MessageType.FEDIVERSE_ENGAGEMENT_REPOST:
|
|
|
|
return getFediverseMessage(message as FediverseEvent);
|
2022-07-14 20:36:47 -07:00
|
|
|
|
2022-05-03 14:17:05 -07:00
|
|
|
default:
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
};
|
2022-05-01 20:56:11 -07:00
|
|
|
|
2023-06-12 15:44:11 -07:00
|
|
|
const scrollChatToBottom = ref => {
|
2023-02-18 11:58:46 -08:00
|
|
|
clearTimeout(scrollToBottomDelay.current);
|
|
|
|
scrollToBottomDelay.current = setTimeout(() => {
|
2023-06-12 15:44:11 -07:00
|
|
|
ref.current?.scrollTo({ top: Infinity, left: 0, behavior: 'auto' });
|
|
|
|
|
2023-02-18 11:58:46 -08:00
|
|
|
setIsAtBottom(true);
|
2023-05-07 20:29:29 -07:00
|
|
|
}, 150);
|
2023-06-12 15:44:11 -07:00
|
|
|
setShowScrollToBottomButton(false);
|
2023-01-05 02:16:37 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
// This is a hack to force a scroll to the very bottom of the chat messages
|
|
|
|
// on initial mount of the component.
|
|
|
|
// For https://github.com/owncast/owncast/issues/2500
|
|
|
|
useEffect(() => {
|
|
|
|
setTimeout(() => {
|
2023-06-12 15:44:11 -07:00
|
|
|
scrollChatToBottom(chatContainerRef);
|
2023-01-05 02:16:37 -08:00
|
|
|
}, 500);
|
|
|
|
}, []);
|
|
|
|
|
2022-06-24 21:30:54 -07:00
|
|
|
const MessagesTable = useMemo(
|
|
|
|
() => (
|
2022-07-10 08:56:31 +02:00
|
|
|
<>
|
2022-07-01 19:35:14 +02:00
|
|
|
<Virtuoso
|
2023-01-11 00:53:18 -08:00
|
|
|
id="virtuoso"
|
2022-09-13 08:43:59 +02:00
|
|
|
style={{ height }}
|
|
|
|
className={styles.virtuoso}
|
2022-07-01 19:35:14 +02:00
|
|
|
ref={chatContainerRef}
|
|
|
|
data={messages}
|
2022-07-02 09:08:36 +02:00
|
|
|
itemContent={(index, message) => getViewForMessage(index, message)}
|
2023-02-18 11:58:46 -08:00
|
|
|
initialTopMostItemIndex={messages.length - 1}
|
2023-02-19 18:43:17 -08:00
|
|
|
followOutput={() => {
|
2022-12-20 00:37:17 -08:00
|
|
|
if (isAtBottom) {
|
2023-02-18 11:58:46 -08:00
|
|
|
setShowScrollToBottomButton(false);
|
2023-06-12 15:44:11 -07:00
|
|
|
scrollChatToBottom(chatContainerRef);
|
2023-02-18 11:58:46 -08:00
|
|
|
return 'smooth';
|
2022-12-20 00:37:17 -08:00
|
|
|
}
|
2023-02-18 11:58:46 -08:00
|
|
|
|
2022-12-20 00:37:17 -08:00
|
|
|
return false;
|
|
|
|
}}
|
2022-07-01 19:35:14 +02:00
|
|
|
alignToBottom
|
2023-01-11 00:53:18 -08:00
|
|
|
atBottomThreshold={70}
|
2022-12-20 00:37:17 -08:00
|
|
|
atBottomStateChange={bottom => {
|
2023-02-18 11:58:46 -08:00
|
|
|
setIsAtBottom(bottom);
|
|
|
|
|
|
|
|
if (bottom) {
|
|
|
|
setShowScrollToBottomButton(false);
|
|
|
|
} else {
|
2023-03-04 00:25:22 +01:00
|
|
|
setShowScrollToBottomButton(true);
|
2023-02-18 11:58:46 -08:00
|
|
|
}
|
2022-12-20 00:37:17 -08:00
|
|
|
}}
|
2022-07-01 19:35:14 +02:00
|
|
|
/>
|
2023-02-18 11:58:46 -08:00
|
|
|
{showScrollToBottomButton && (
|
|
|
|
<ScrollToBotBtn
|
|
|
|
onClick={() => {
|
2023-06-12 15:44:11 -07:00
|
|
|
scrollChatToBottom(chatContainerRef);
|
2023-02-18 11:58:46 -08:00
|
|
|
}}
|
|
|
|
/>
|
|
|
|
)}
|
2022-07-10 08:56:31 +02:00
|
|
|
</>
|
2022-06-24 21:30:54 -07:00
|
|
|
),
|
2023-02-18 11:58:46 -08:00
|
|
|
[messages, usernameToHighlight, chatUserId, isModerator, showScrollToBottomButton, isAtBottom],
|
2022-06-24 21:30:54 -07:00
|
|
|
);
|
|
|
|
|
2023-07-11 06:00:28 +00:00
|
|
|
const defaultChatWidth: number = 320;
|
|
|
|
function clampChatWidth(desired) {
|
|
|
|
return Math.max(200, Math.min(window.innerWidth * 0.666, desired));
|
|
|
|
}
|
|
|
|
|
|
|
|
function startDrag(dragEvent) {
|
|
|
|
const container = document.getElementById('chat-container');
|
|
|
|
function move(event) {
|
|
|
|
container.style.width = `${clampChatWidth(window.innerWidth - event.x)}px`;
|
|
|
|
}
|
|
|
|
function endDrag() {
|
|
|
|
window.document.removeEventListener('mousemove', move);
|
|
|
|
window.document.removeEventListener('mouseup', endDrag);
|
|
|
|
window.document.removeEventListener('focusout', endDrag);
|
|
|
|
}
|
|
|
|
window.document.addEventListener('mousemove', move);
|
|
|
|
window.document.addEventListener('mouseup', endDrag);
|
|
|
|
window.document.addEventListener('focusout', endDrag);
|
|
|
|
dragEvent.preventDefault(); // Prevent selecting the page as you resize it
|
|
|
|
}
|
|
|
|
|
|
|
|
// Re-clamp the chat size whenever the window resizes
|
2023-07-13 19:36:21 +00:00
|
|
|
function resize() {
|
2023-07-11 06:00:28 +00:00
|
|
|
const container = desktop && document.getElementById('chat-container');
|
|
|
|
if (container) {
|
|
|
|
const currentWidth = parseFloat(container.style.width) || defaultChatWidth;
|
|
|
|
container.style.width = `${clampChatWidth(currentWidth)}px`;
|
|
|
|
}
|
2023-07-13 19:36:21 +00:00
|
|
|
}
|
|
|
|
|
2024-03-06 01:02:58 -05:00
|
|
|
// Retrieve, clean, and attach username to newest chat message to be read out by screenreader
|
|
|
|
function getLastMessage() {
|
|
|
|
if (messages.length > 0 && typeof messages[messages.length - 1].body !== 'undefined') {
|
2024-04-15 06:06:29 +05:00
|
|
|
const lastMessage = messages[messages.length - 1];
|
|
|
|
const message = lastMessage.body.replace(/(<([^>]+)>)/gi, '');
|
|
|
|
let stringToRead = '';
|
|
|
|
if (typeof lastMessage.user !== 'undefined') {
|
|
|
|
const username = lastMessage.user.displayName;
|
|
|
|
stringToRead = `${username} said ${message}`;
|
|
|
|
} else {
|
|
|
|
stringToRead = `System message: ${message}`;
|
|
|
|
}
|
2024-03-06 01:02:58 -05:00
|
|
|
return stringToRead;
|
|
|
|
}
|
|
|
|
return '';
|
|
|
|
}
|
|
|
|
const lastMessage = getLastMessage();
|
|
|
|
|
2023-07-13 19:36:21 +00:00
|
|
|
if (resizeWindowCallback) window.removeEventListener('resize', resizeWindowCallback);
|
|
|
|
if (desktop) {
|
|
|
|
window.addEventListener('resize', resize);
|
|
|
|
resizeWindowCallback = resize;
|
|
|
|
} else {
|
|
|
|
resizeWindowCallback = null;
|
|
|
|
}
|
2023-07-11 06:00:28 +00:00
|
|
|
|
2022-06-24 21:30:54 -07:00
|
|
|
return (
|
2023-03-12 21:53:02 -07:00
|
|
|
<ErrorBoundary
|
|
|
|
// eslint-disable-next-line react/no-unstable-nested-components
|
|
|
|
fallbackRender={({ error, resetErrorBoundary }) => (
|
|
|
|
<ComponentError
|
|
|
|
componentName="ChatContainer"
|
|
|
|
message={error.message}
|
|
|
|
retryFunction={resetErrorBoundary}
|
|
|
|
/>
|
2022-11-13 12:37:31 -08:00
|
|
|
)}
|
2023-03-12 21:53:02 -07:00
|
|
|
>
|
2023-07-11 06:00:28 +00:00
|
|
|
<div
|
2024-03-06 01:02:58 -05:00
|
|
|
aria-live="off"
|
2023-07-11 06:00:28 +00:00
|
|
|
id="chat-container"
|
|
|
|
className={styles.chatContainer}
|
|
|
|
style={desktop && { width: `${defaultChatWidth}px` }}
|
|
|
|
>
|
2023-03-12 21:53:02 -07:00
|
|
|
{MessagesTable}
|
|
|
|
{showInput && (
|
|
|
|
<div className={styles.chatTextField}>
|
2023-05-22 18:56:44 -07:00
|
|
|
<ChatTextField enabled={chatEnabled} focusInput={focusInput} />
|
2023-03-12 21:53:02 -07:00
|
|
|
</div>
|
|
|
|
)}
|
2023-07-11 06:00:28 +00:00
|
|
|
{desktop && (
|
|
|
|
<div className={styles.resizeHandle} onMouseDown={startDrag} role="presentation" />
|
|
|
|
)}
|
2023-03-12 21:53:02 -07:00
|
|
|
</div>
|
2024-03-06 01:02:58 -05:00
|
|
|
<span className={styles.chatAccessibilityHidden} aria-live="polite">
|
2024-04-15 06:06:29 +05:00
|
|
|
<Interweave content={lastMessage} />
|
2024-03-06 01:02:58 -05:00
|
|
|
</span>
|
2023-03-12 21:53:02 -07:00
|
|
|
</ErrorBoundary>
|
2022-04-29 15:09:53 -07:00
|
|
|
);
|
2022-09-07 09:00:28 +02:00
|
|
|
};
|
2022-09-04 21:46:54 -07:00
|
|
|
|
|
|
|
ChatContainer.defaultProps = {
|
|
|
|
showInput: true,
|
2022-09-13 08:43:59 +02:00
|
|
|
height: 'auto',
|
2022-09-04 21:46:54 -07:00
|
|
|
};
|