fixed chat container not showing in SB + minor changes
This commit is contained in:
@@ -9,11 +9,17 @@
|
|||||||
|
|
||||||
.toBottomWrap {
|
.toBottomWrap {
|
||||||
display: flex;
|
display: flex;
|
||||||
opacity: 0.9;
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
bottom: 75px;
|
bottom: 50px;
|
||||||
|
color: var(--text-color-secondary);
|
||||||
|
& .toBottomWrap {
|
||||||
|
& .toBottomBtn {
|
||||||
|
border: none;
|
||||||
|
background-color: gray;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.nameChangeView {
|
.nameChangeView {
|
||||||
@@ -36,6 +42,7 @@
|
|||||||
.chatContainer {
|
.chatContainer {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-rows: 1fr 65px;
|
grid-template-rows: 1fr 65px;
|
||||||
|
background-color: var(--theme-color-background-chat);
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
.virtuoso {
|
.virtuoso {
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ const AddMessagesChatExample = args => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<RecoilRoot>
|
<RecoilRoot>
|
||||||
|
<div style={{ height: '70vh', position: 'relative' }}>
|
||||||
<button type="button" onClick={() => setChatMessages([...chatMessages, chatMessages[0]])}>
|
<button type="button" onClick={() => setChatMessages([...chatMessages, chatMessages[0]])}>
|
||||||
Add message
|
Add message
|
||||||
</button>
|
</button>
|
||||||
@@ -39,6 +40,7 @@ const AddMessagesChatExample = args => {
|
|||||||
chatUserId="testuser"
|
chatUserId="testuser"
|
||||||
isModerator={false}
|
isModerator={false}
|
||||||
/>
|
/>
|
||||||
|
</div>
|
||||||
</RecoilRoot>
|
</RecoilRoot>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { Button } from 'antd';
|
|
||||||
import { Virtuoso } from 'react-virtuoso';
|
import { Virtuoso } from 'react-virtuoso';
|
||||||
import { useState, useMemo, useRef, CSSProperties, FC } from 'react';
|
import { useState, useMemo, useRef, CSSProperties, FC } from 'react';
|
||||||
import { EditFilled, VerticalAlignBottomOutlined } from '@ant-design/icons';
|
import { EditFilled } from '@ant-design/icons';
|
||||||
import {
|
import {
|
||||||
ConnectedClientInfoEvent,
|
ConnectedClientInfoEvent,
|
||||||
MessageType,
|
MessageType,
|
||||||
@@ -15,6 +14,7 @@ import { ChatModeratorNotification } from '../ChatModeratorNotification/ChatMode
|
|||||||
// import ChatActionMessage from '../ChatAction/ChatActionMessage';
|
// import ChatActionMessage from '../ChatAction/ChatActionMessage';
|
||||||
import { ChatSystemMessage } from '../ChatSystemMessage/ChatSystemMessage';
|
import { ChatSystemMessage } from '../ChatSystemMessage/ChatSystemMessage';
|
||||||
import { ChatJoinMessage } from '../ChatJoinMessage/ChatJoinMessage';
|
import { ChatJoinMessage } from '../ChatJoinMessage/ChatJoinMessage';
|
||||||
|
import { ScrollToBotBtn } from './ScrollToBotBtn';
|
||||||
|
|
||||||
export type ChatContainerProps = {
|
export type ChatContainerProps = {
|
||||||
messages: ChatMessage[];
|
messages: ChatMessage[];
|
||||||
@@ -176,22 +176,7 @@ export const ChatContainer: FC<ChatContainerProps> = ({
|
|||||||
alignToBottom
|
alignToBottom
|
||||||
atBottomStateChange={bottom => setAtBottom(bottom)}
|
atBottomStateChange={bottom => setAtBottom(bottom)}
|
||||||
/>
|
/>
|
||||||
{!atBottom && (
|
{!atBottom && <ScrollToBotBtn chatContainerRef={chatContainerRef} messages={messages} />}
|
||||||
<div className={styles.toBottomWrap}>
|
|
||||||
<Button
|
|
||||||
type="default"
|
|
||||||
icon={<VerticalAlignBottomOutlined />}
|
|
||||||
onClick={() =>
|
|
||||||
chatContainerRef.current.scrollToIndex({
|
|
||||||
index: messages.length - 1,
|
|
||||||
behavior: 'smooth',
|
|
||||||
})
|
|
||||||
}
|
|
||||||
>
|
|
||||||
Go to last message
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</>
|
</>
|
||||||
),
|
),
|
||||||
[messages, usernameToHighlight, chatUserId, isModerator, atBottom],
|
[messages, usernameToHighlight, chatUserId, isModerator, atBottom],
|
||||||
|
|||||||
@@ -5,6 +5,8 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 0.3rem;
|
padding: 0.3rem;
|
||||||
color: var(--theme-color-components-form-field-text);
|
color: var(--theme-color-components-form-field-text);
|
||||||
|
border-radius: var(--theme-rounded-corners);
|
||||||
|
outline: 1px solid gray;
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
|
|
||||||
div[role='textbox'] {
|
div[role='textbox'] {
|
||||||
|
|||||||
@@ -197,7 +197,6 @@ export const ChatTextField: FC<ChatTextFieldProps> = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
|
||||||
<div className={styles.root}>
|
<div className={styles.root}>
|
||||||
<Slate editor={editor} value={defaultEditorValue}>
|
<Slate editor={editor} value={defaultEditorValue}>
|
||||||
<Editable
|
<Editable
|
||||||
@@ -209,10 +208,7 @@ export const ChatTextField: FC<ChatTextFieldProps> = () => {
|
|||||||
/>
|
/>
|
||||||
<Popover
|
<Popover
|
||||||
content={
|
content={
|
||||||
<EmojiPicker
|
<EmojiPicker onEmojiSelect={onEmojiSelect} onCustomEmojiSelect={onCustomEmojiSelect} />
|
||||||
onEmojiSelect={onEmojiSelect}
|
|
||||||
onCustomEmojiSelect={onCustomEmojiSelect}
|
|
||||||
/>
|
|
||||||
}
|
}
|
||||||
trigger="click"
|
trigger="click"
|
||||||
onVisibleChange={visible => setShowEmojis(visible)}
|
onVisibleChange={visible => setShowEmojis(visible)}
|
||||||
@@ -236,6 +232,5 @@ export const ChatTextField: FC<ChatTextFieldProps> = () => {
|
|||||||
onClick={sendMessage}
|
onClick={sendMessage}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user