diff --git a/src/assets/css/ui.css b/src/assets/css/ui.css index f6d8f32..a8cbf84 100644 --- a/src/assets/css/ui.css +++ b/src/assets/css/ui.css @@ -19,7 +19,6 @@ body { ::-webkit-scrollbar-track { background-color: transparent; - padding-bottom: 20px; margin-bottom: 15px; } diff --git a/src/components/Chatbar.tsx b/src/components/Chatbar.tsx index d105fbb..5e9b8c5 100644 --- a/src/components/Chatbar.tsx +++ b/src/components/Chatbar.tsx @@ -7,7 +7,6 @@ import ColorPicker from './ColorPicker'; import { ConnectionEnum } from '../shared/interfaces'; interface ChatProps { - socket: SocketIOClient.Socket; sendMessage: (event: any) => void; setTextMessage: (text: string) => void; textMessage: string; @@ -97,7 +96,7 @@ const ChatBar: FunctionComponent = (props) => { props.selectionIsChecked ? '(optional)' : '' }`} /> - + = (props) => { more )} - - setContainerIsHidden(!containerIsHidden)} - animationEnabled={animationEnabled} + { - const { current } = state.messagesRef; - - state.disableAutoScroll = - current.scrollHeight - - (current.scrollTop + current.clientHeight) > - 0; - }} + animationEnabled={animationEnabled} > - {chatState.filteredMessages.map((m, i) => ( - - - {(i + 1) % MAX_MESSAGES === 0 && - i + 1 !== chatState.filteredMessages.length ? ( - - ) : ( - '' - )} - - ))} - + setContainerIsHidden(!containerIsHidden)} + animationEnabled={animationEnabled} + isSettings={isSettings} + ref={state.messagesRef} + onWheel={() => { + const { current } = state.messagesRef; + + state.disableAutoScroll = + current.scrollHeight - + (current.scrollTop + current.clientHeight) > + 0; + }} + > + {chatState.filteredMessages.map((m, i) => ( + + + {(i + 1) % MAX_MESSAGES === 0 && + i + 1 !== chatState.filteredMessages.length ? ( + + ) : ( + '' + )} + + ))} + { @@ -231,7 +234,7 @@ const ChatView: FunctionComponent = (props) => { )} - + {(isSettings || (!isSettings && !containerIsHidden)) && ( @@ -239,7 +242,6 @@ const ChatView: FunctionComponent = (props) => { (chatState.textMessage = text)} textMessage={chatState.textMessage} @@ -283,8 +285,7 @@ const FloatingButtonRight = styled.div` `; const SettingsArrow = styled.div` - position: sticky; - left: 0; + position: absolute; bottom: 0; padding-top: 10px; padding-bottom: 10px; @@ -315,7 +316,7 @@ const MessageSeperator = styled.div` border-width: 1px 0 0 0; border-color: #ececec; border-style: dotted; - margin: -5px 0 10px; + margin: 5px 0 10px; `; const Chat = styled.div` @@ -324,12 +325,12 @@ const Chat = styled.div` background-color: ${({ color }) => color}; `; -const Messages = styled.div` +const MessagesContainer = styled.div` + /* display: grid; + grid-template-rows: auto 26px; */ position: relative; z-index: 2; margin: 0; - overflow: ${({ isSettings }) => (isSettings ? 'hidden' : 'auto')}; - padding: 55px 10px 0; background-color: #fff; border-radius: 0 0 15px 15px; transition: transform 0.4s; @@ -341,6 +342,13 @@ const Messages = styled.div` animationEnabled ? 0.2 : 0}s; `; +const Messages = styled.div` + padding: 55px 10px 0; + overflow: ${({ isSettings }) => (isSettings ? 'hidden' : 'auto')}; + align-self: end; + height: 100%; +`; + const Online = styled.div` position: relative; padding: 8px 0 8px 24px; diff --git a/src/views/Settings.tsx b/src/views/Settings.tsx index a14e219..ca361f3 100644 --- a/src/views/Settings.tsx +++ b/src/views/Settings.tsx @@ -53,7 +53,7 @@ const SettingsView: FunctionComponent = (props) => { settings.url = state.settings.url; settings.enableNotificationTooltip = state.settings.enableNotificationTooltip; - }, [settings]); + }, [state.settings]); return ( <>