Skip to content

Commit

Permalink
Merge pull request #2290 from daostack/feature/CW-2260-chat-style-imp…
Browse files Browse the repository at this point in the history
…rovements

Messages all the way down in chat #2260
  • Loading branch information
andreymikhadyuk authored Nov 7, 2023
2 parents 4a38a0e + 429f840 commit f4c45d7
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 14 deletions.
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 @@ -224,7 +224,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 @@ -341,7 +341,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 @@ -370,6 +369,7 @@ export default function ChatMessage({
) : (
<>
<div
onContextMenu={handleContextMenu}
className={classNames(styles.messageText, {
[styles.messageTextCurrentUser]: !isNotCurrentUserMessage,
[styles.messageTextRtl]: isRtlText(discussionMessage.text),
Expand Down

0 comments on commit f4c45d7

Please sign in to comment.