From 6dd13c68451122258b4cc79650ac3426d1233dc8 Mon Sep 17 00:00:00 2001 From: ajaythapliyal Date: Fri, 17 Mar 2023 13:25:21 +0530 Subject: [PATCH] adds upload modal visibility --- frontend/src/Navigation.tsx | 15 +++++++++++++-- frontend/src/upload/Upload.tsx | 26 +++++++++++++++++++++++--- 2 files changed, 36 insertions(+), 5 deletions(-) diff --git a/frontend/src/Navigation.tsx b/frontend/src/Navigation.tsx index 372f64cb..562be920 100644 --- a/frontend/src/Navigation.tsx +++ b/frontend/src/Navigation.tsx @@ -20,6 +20,7 @@ import { setSelectedDocs, } from './preferences/preferenceSlice'; import { useOutsideAlerter } from './hooks'; +import Upload from './upload/Upload'; export default function Navigation({ navState, @@ -43,6 +44,9 @@ export default function Navigation({ const [selectedDocsModalState, setSelectedDocsModalState] = useState(isSelectedDocsSet ? 'INACTIVE' : 'ACTIVE'); + const [uploadModalState, setUploadModalState] = + useState('INACTIVE'); + const navRef = useRef(null); useOutsideAlerter( navRef, @@ -128,7 +132,11 @@ export default function Navigation({ } mr-3 w-3 transition-all`} /> - + setUploadModalState('ACTIVE')} + > {isDocsListOpen && (
{docs ? ( @@ -224,7 +232,10 @@ export default function Navigation({ setModalState={setApiKeyModalState} isCancellable={isApiKeySet} /> - {/* */} + ); } diff --git a/frontend/src/upload/Upload.tsx b/frontend/src/upload/Upload.tsx index 5fb1a6b2..88afa960 100644 --- a/frontend/src/upload/Upload.tsx +++ b/frontend/src/upload/Upload.tsx @@ -1,7 +1,14 @@ import { useCallback, useState } from 'react'; import { useDropzone } from 'react-dropzone'; +import { ActiveState } from '../models/misc'; -export default function Upload() { +export default function Upload({ + modalState, + setModalState, +}: { + modalState: ActiveState; + setModalState: (state: ActiveState) => void; +}) { const [docName, setDocName] = useState(''); const [files, setfiles] = useState([]); @@ -20,7 +27,11 @@ export default function Upload() { onDragLeave: doNothing, }); return ( -
+

Upload New Documentation

Train - +