From 5341d03749009fe072e959bd9a2d4e8778c27e47 Mon Sep 17 00:00:00 2001 From: ajaythapliyal Date: Sat, 18 Feb 2023 08:20:20 +0530 Subject: [PATCH] moves the apikeymodal mounting one level down to simplify --- frontend/src/App.tsx | 13 ------------- frontend/src/Navigation.tsx | 21 ++++++++++++++++++--- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index a91b5c0..b2f69c5 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -1,31 +1,18 @@ import { Routes, Route } from 'react-router-dom'; import Navigation from './Navigation'; import Conversation from './conversation/Conversation'; -import APIKeyModal from './preferences/APIKeyModal'; import About from './About'; import { useState } from 'react'; import { ActiveState } from './models/misc'; -import { selectApiKeyStatus } from './preferences/preferenceSlice'; -import { useSelector } from 'react-redux'; export default function App() { - const isApiKeySet = useSelector(selectApiKeyStatus); const [navState, setNavState] = useState('ACTIVE'); - const [apiKeyModalState, setApiKeyModalState] = useState( - isApiKeySet ? 'INACTIVE' : 'ACTIVE', - ); return (
- setNavState(val)} - setApiKeyModalState={setApiKeyModalState} />
void; - setApiKeyModalState: (val: ActiveState) => void; }) { + const isApiKeySet = useSelector(selectApiKeyStatus); + const [apiKeyModalState, setApiKeyModalState] = useState( + isApiKeySet ? 'INACTIVE' : 'ACTIVE', + ); const openNav = (
@@ -93,5 +99,14 @@ export default function Navigation({ ); - return navState === 'ACTIVE' ? openNav : closedNav; + return ( + <> + {navState === 'ACTIVE' ? openNav : closedNav} + + + ); }