From 2536d9cc10a4ebf859167a5b56e0728a33623ccb Mon Sep 17 00:00:00 2001 From: Dan Ditomaso Date: Mon, 28 Apr 2025 15:48:10 -0400 Subject: [PATCH] fixed several styling issues --- .../PageComponents/Messages/ChannelChat.tsx | 25 ++++++++++--------- src/components/PageLayout.tsx | 4 +-- src/components/Sidebar.tsx | 8 +++--- src/components/UI/Sidebar/SidebarSection.tsx | 2 +- src/pages/Messages.tsx | 12 ++++++--- src/pages/Nodes.tsx | 13 ---------- 6 files changed, 28 insertions(+), 36 deletions(-) diff --git a/src/components/PageComponents/Messages/ChannelChat.tsx b/src/components/PageComponents/Messages/ChannelChat.tsx index 97f2973a..78f0b42b 100644 --- a/src/components/PageComponents/Messages/ChannelChat.tsx +++ b/src/components/PageComponents/Messages/ChannelChat.tsx @@ -9,7 +9,7 @@ export interface ChannelChatProps { const EmptyState = () => (
- + No Messages
); @@ -24,10 +24,7 @@ export const ChannelChat = ({ const scrollContainer = scrollContainerRef.current; if (!scrollContainer) return; - const isNearBottom = - scrollContainer.scrollHeight - - scrollContainer.scrollTop - - scrollContainer.clientHeight < 100; // Threshold in pixels + const isNearBottom = scrollContainer.scrollTop < 100; if (isNearBottom || behavior === 'instant') { messagesEndRef.current?.scrollIntoView({ behavior }); @@ -35,17 +32,21 @@ export const ChannelChat = ({ }, []); useEffect(() => { - scrollToBottom('smooth'); + if (messages.length > 0) { + scrollToBottom('smooth'); + } }, [messages, scrollToBottom]); useEffect(() => { - scrollToBottom('instant'); - }, [scrollToBottom]); + if (messages.length > 0) { + scrollToBottom('instant'); + } + }, [scrollToBottom, messages.length]); + if (!messages?.length) { return ( -