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

Messages all the way down in chat #2260 #2290

Merged
merged 2 commits into from
Nov 7, 2023
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
flex-direction: column;
flex: 1;
width: inherit;
height: calc(100% - #{$container-desktop-header-height});
height: calc(100% - var(--chat-header-height, 0rem));
background-color: $white;
box-sizing: border-box;
--chat-input-wrapper-height: 3.125rem;
Expand All @@ -18,15 +18,18 @@
overscroll-behavior: contain;
display: flex;
flex-direction: column-reverse;
padding: 0.5rem 2rem 0;
padding-bottom: calc(var(--chat-input-wrapper-height) + 7rem);
padding: 0.5rem 2rem 0 2rem;
margin-bottom: var(--chat-input-wrapper-height);

@include big-phone {
margin-bottom: 0;
}
}

.emptyChat {
display: flex;
justify-content: center;
padding: 0.5rem 2rem 0;
padding-bottom: calc(var(--chat-input-wrapper-height) + 7rem);
align-self: center;
}

.bottomChatContainer {
Expand Down
8 changes: 4 additions & 4 deletions src/pages/common/components/ChatComponent/ChatComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,13 +183,13 @@ export default function ChatComponent({
const chatWrapperId = useMemo(() => `chat-wrapper-${uuidv4()}`, []);
const chatInputWrapperRef = useRef<HTMLDivElement>(null);
const chatContainerRef = useRef<HTMLDivElement>(null);
const [isScrolling, setScrolling] = useState(false);
const [isScrolling, setIsScrolling] = useState(false);
const chatContentContextValue: ChatContentData = useMemo(
() => ({
isScrolling,
chatContentRect: chatContainerRef.current?.getBoundingClientRect(),
}),
[isScrolling],
[isScrolling, chatContainerRef.current],
);

const [message, setMessage] = useState<TextEditorValue>(
Expand Down Expand Up @@ -603,11 +603,11 @@ export default function ChatComponent({

useEffect(() => {
const deactivateScrollingFlag = debounce(() => {
setScrolling(false);
setIsScrolling(false);
}, 300);

function handleScroll() {
setScrolling(true);
setIsScrolling(true);
deactivateScrollingFlag();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
.noMessagesText {
align-self: flex-start;
max-width: 17.5rem;
margin: 3.375rem 0 0;
padding: 0.5rem 1rem;
font-size: $xsmall;
line-height: 143%;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
@import "../../../../../../constants";

.rightPaneContainerWithHeader {
--chat-header-height: #{$container-desktop-header-height};
}

.titleWrapper {
height: $container-desktop-header-height;
height: var(--chat-header-height);
padding: 0 1.25rem;
display: flex;
align-items: center;
background-color: $c-light-gray-2;
border-bottom: 0.0625rem solid $c-light-gray;
box-sizing: border-box;
}

.title {
margin: 0;
display: -webkit-box;
Expand All @@ -22,6 +27,7 @@
overflow-wrap: break-word;
text-overflow: ellipsis;
}

.titleRTL {
text-align: right;
direction: rtl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,11 @@ const DesktopChat: FC<ChatProps> = (props) => {
}, [dmUserId]);

return (
<DesktopRightPane className={className}>
<DesktopRightPane
className={classNames(className, {
[styles.rightPaneContainerWithHeader]: withTitle,
})}
>
{withTitle && (
<div className={styles.titleWrapper}>
{dmUser?.photoURL && (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
@import "../../../../../../constants";

.modal {
height: 90vh;

.modalHeaderWrapper {
padding: 0;

Expand Down
4 changes: 2 additions & 2 deletions src/shared/components/Chat/ChatMessage/ChatMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ export default function ChatMessage({
},
);

const handleContextMenu: MouseEventHandler<HTMLLIElement> = (event) => {
const handleContextMenu: MouseEventHandler<HTMLDivElement> = (event) => {
if (!isTabletView) {
event.preventDefault();
setIsMenuOpen(true);
Expand Down Expand Up @@ -330,7 +330,6 @@ export default function ChatMessage({
<li
id={discussionMessage.id}
className={classNames(styles.container, className)}
onContextMenu={handleContextMenu}
>
<div
className={classNames(styles.message, {
Expand Down Expand Up @@ -359,6 +358,7 @@ export default function ChatMessage({
) : (
<>
<div
onContextMenu={handleContextMenu}
className={classNames(styles.messageText, {
[styles.messageTextCurrentUser]: !isNotCurrentUserMessage,
[styles.messageTextRtl]: isRtlText(discussionMessage.text),
Expand Down
Loading