diff --git a/app/soapbox/features/chats/components/chat-list-item.tsx b/app/soapbox/features/chats/components/chat-list-item.tsx index a9b431c49..e14341d72 100644 --- a/app/soapbox/features/chats/components/chat-list-item.tsx +++ b/app/soapbox/features/chats/components/chat-list-item.tsx @@ -18,7 +18,7 @@ const ChatListItem: React.FC = ({ chat, chatSilence, onC key={chat.id} type='button' onClick={() => onClick(chat)} - className='px-4 py-2 w-full flex flex-col hover:bg-gray-100 dark:hover:bg-gray-800 focus:shadow-inset-ring' + className='p-2 w-full flex flex-col rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 focus:shadow-inset-ring' data-testid='chat' > diff --git a/app/soapbox/features/chats/components/chat-list.tsx b/app/soapbox/features/chats/components/chat-list.tsx index 1b74f583d..0fb6555df 100644 --- a/app/soapbox/features/chats/components/chat-list.tsx +++ b/app/soapbox/features/chats/components/chat-list.tsx @@ -61,7 +61,11 @@ const ChatList: React.FC = ({ onClickChat, useWindowScroll = false, s endReached={handleLoadMore} itemContent={(_index, chat) => { const chatSilence = chatSilences?.find((chatSilence) => String(chatSilence.target_account_id) === chat.account.id); - return ; + return ( +
+ +
+ ); }} components={{ ScrollSeekPlaceholder: () => , diff --git a/app/soapbox/features/chats/components/chat-page/chat-page.tsx b/app/soapbox/features/chats/components/chat-page/chat-page.tsx index 9924b8a5a..74a2e01b4 100644 --- a/app/soapbox/features/chats/components/chat-page/chat-page.tsx +++ b/app/soapbox/features/chats/components/chat-page/chat-page.tsx @@ -1,7 +1,7 @@ import classNames from 'clsx'; -import React from 'react'; +import React, { useEffect, useRef, useState } from 'react'; -import { Card, Stack } from 'soapbox/components/ui'; +import { Stack } from 'soapbox/components/ui'; import { useChatContext } from 'soapbox/contexts/chat-context'; import ChatPageMain from './components/chat-page-main'; @@ -10,11 +10,41 @@ import ChatPageSidebar from './components/chat-page-sidebar'; const ChatPage = () => { const { chat } = useChatContext(); + const containerRef = useRef(null); + const [height, setHeight] = useState('100%'); + + const calculateHeight = () => { + if (!containerRef.current) { + return null; + } + + const { top } = containerRef.current.getBoundingClientRect(); + const fullHeight = document.body.offsetHeight; + + setHeight(fullHeight - top); + }; + + useEffect(() => { + calculateHeight(); + }, [containerRef.current]); + + useEffect(() => { + window.addEventListener('resize', calculateHeight); + + return () => { + window.removeEventListener('resize', calculateHeight); + }; + }, []); + return ( - +
@@ -28,7 +58,7 @@ const ChatPage = () => {
- +
); }; diff --git a/app/soapbox/features/chats/components/chat-page/components/chat-page-main.tsx b/app/soapbox/features/chats/components/chat-page/components/chat-page-main.tsx index 4ce5692fa..c743baa26 100644 --- a/app/soapbox/features/chats/components/chat-page/components/chat-page-main.tsx +++ b/app/soapbox/features/chats/components/chat-page/components/chat-page-main.tsx @@ -72,13 +72,15 @@ const ChatPageMain = () => { - setChat(null)} - /> + + setChat(null)} + /> - + +
diff --git a/app/soapbox/features/chats/components/chat-page/components/chat-page-sidebar.tsx b/app/soapbox/features/chats/components/chat-page/components/chat-page-sidebar.tsx index ec4f9d5b2..a3acb2ceb 100644 --- a/app/soapbox/features/chats/components/chat-page/components/chat-page-sidebar.tsx +++ b/app/soapbox/features/chats/components/chat-page/components/chat-page-sidebar.tsx @@ -45,15 +45,17 @@ const ChatPageSidebar = () => { const handleClickChat = (chat: IChat) => setChat(chat); return ( - - + + + - + + - + diff --git a/app/soapbox/features/chats/components/chat-widget.tsx b/app/soapbox/features/chats/components/chat-widget.tsx index 6d444b07b..c403274ed 100644 --- a/app/soapbox/features/chats/components/chat-widget.tsx +++ b/app/soapbox/features/chats/components/chat-widget.tsx @@ -10,6 +10,9 @@ const ChatWidget = () => { const account = useOwnAccount(); const dispatch = useAppDispatch(); + const path = location.pathname; + const shouldHideWidget = Boolean(path.match(/^\/chats/)); + useEffect(() => { const disconnect = dispatch(connectDirectStream()); @@ -18,7 +21,7 @@ const ChatWidget = () => { }); }, []); - if (!account?.chats_onboarded) { + if (!account?.chats_onboarded || shouldHideWidget) { return null; } diff --git a/app/soapbox/pages/chats-page.tsx b/app/soapbox/pages/chats-page.tsx index ae9f5d6d9..08bdf078f 100644 --- a/app/soapbox/pages/chats-page.tsx +++ b/app/soapbox/pages/chats-page.tsx @@ -3,7 +3,7 @@ import React from 'react'; /** Custom layout for chats on desktop. */ const ChatsPage: React.FC = ({ children }) => { return ( -
+
{children}
);