From d14438bf545607268eb00236a40eae0a8bf2b83a Mon Sep 17 00:00:00 2001 From: TaylorS15 Date: Fri, 3 Mar 2023 16:15:35 -0500 Subject: [PATCH] navigation changes/bugfix fixed chats being visible under text below chat box --- frontend/src/Navigation.tsx | 21 +++++++++++++++++---- frontend/src/conversation/Conversation.tsx | 6 +++--- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/frontend/src/Navigation.tsx b/frontend/src/Navigation.tsx index 4709f4ae..a2cedb03 100644 --- a/frontend/src/Navigation.tsx +++ b/frontend/src/Navigation.tsx @@ -1,4 +1,4 @@ -import { useRef, useState } from 'react'; +import { useEffect, useRef, useState } from 'react'; import { NavLink } from 'react-router-dom'; import Arrow1 from './assets/arrow.svg'; import Arrow2 from './assets/dropdown-arrow.svg'; @@ -58,6 +58,19 @@ export default function Navigation({ [navState, isDocsListOpen, apiKeyModalState], ); + /* + Needed to fix bug where if mobile nav was closed and then window was resized to desktop, nav would still be closed but the button to open would be gone, as per #1 on issue #146 + */ + useEffect(() => { + window.addEventListener('resize', () => { + if (window.matchMedia('(min-width: 768px)').matches) { + setNavState('ACTIVE'); + } else { + setNavState('INACTIVE'); + } + }); + }, []); + return ( <>
-
+