diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx
index c0a3a9c0..d6467e2f 100644
--- a/frontend/src/App.tsx
+++ b/frontend/src/App.tsx
@@ -1,62 +1,17 @@
-import { useEffect, useState } from 'react';
import { Routes, Route } from 'react-router-dom';
-import Navigation from './components/Navigation/Navigation';
-import DocsGPT from './components/DocsGPT/DocsGPT';
+import Navigation from './components/Navigation';
+import Conversation from './components/Conversation/Conversation';
import APIKeyModal from './components/APIKeyModal';
import About from './components/About';
export default function App() {
- //Currently using primitive state management. Will most likely be replaced with Redux.
- const [isMobile, setIsMobile] = useState(true);
- const [isMenuOpen, setIsMenuOpen] = useState(true);
- const [isApiModalOpen, setIsApiModalOpen] = useState(false);
- const [apiKey, setApiKey] = useState('');
-
- const handleResize = () => {
- if (window.innerWidth > 768 && isMobile) {
- setIsMobile(false);
- } else {
- setIsMobile(true);
- setIsMenuOpen(false);
- }
- };
-
- useEffect(() => {
- window.addEventListener('resize', handleResize);
- handleResize();
-
- return () => {
- window.removeEventListener('resize', handleResize);
- };
- }, []);
-
return (
-
-
-
+
+
+
- }
- />
- }
- />
+ } />
+ } />
);
diff --git a/frontend/src/components/APIKeyModal.tsx b/frontend/src/components/APIKeyModal.tsx
index 505f2494..07a8f061 100644
--- a/frontend/src/components/APIKeyModal.tsx
+++ b/frontend/src/components/APIKeyModal.tsx
@@ -1,30 +1,29 @@
import { useState } from 'react';
-
-export default function APIKeyModal({
- isApiModalOpen,
- setIsApiModalOpen,
- apiKey,
+import { useDispatch, useSelector } from 'react-redux';
+import {
setApiKey,
-}: {
- isApiModalOpen: boolean;
- setIsApiModalOpen: React.Dispatch
>;
- apiKey: string;
- setApiKey: React.Dispatch>;
-}) {
- //TODO - Add form validation
+ toggleApiKeyModal,
+ selectIsApiKeyModalOpen,
+} from '../store';
+
+export default function APIKeyModal({}) {
+ //TODO - Add form validation?
//TODO - Connect to backend
//TODO - Add link to OpenAI API Key page
+ const dispatch = useDispatch();
+ const isApiModalOpen = useSelector(selectIsApiKeyModalOpen);
+ const [key, setKey] = useState('');
const [formError, setFormError] = useState(false);
- const handleResetKey = () => {
- if (!apiKey) {
+ function handleSubmit() {
+ if (key.length < 1) {
setFormError(true);
- } else {
- setFormError(false);
- setIsApiModalOpen(false);
+ return;
}
- };
+ dispatch(setApiKey(key));
+ dispatch(toggleApiKeyModal());
+ }
return (
setApiKey(e.target.value)}
+ onChange={(e) => setKey(e.target.value)}
/>
{formError && (
Please enter a valid API key
)}