1- import React from ' react'
2- import { useLocation } from ' react-router-dom' ;
1+ import React , { useEffect } from " react" ;
2+ import { useLocation } from " react-router-dom" ;
33
44// eslint-disable-next-line import/namespace
5- import { Allotment } from ' allotment' ;
5+ import { Allotment } from " allotment" ;
66
7- import Navbar from ' ../Navbar/Navbar' ;
8- import FileTree from ' ../FileTree/FileTree'
9- import ImportFallback from ' ../ImportFallback/ImportFallback' ;
7+ import Navbar from " ../Navbar/Navbar" ;
8+ import FileTree from " ../FileTree/FileTree" ;
9+ import ImportFallback from " ../ImportFallback/ImportFallback" ;
1010
11- import { useWorkbenchDB } from '../../contexts/dbContext' ;
12- import { FILE_TREE_ROUTES , IMPORT_FALLBACK_ROUTES } from '../../constants/routes' ;
13- import ProgressLoader from '../ProgressLoader/ProgressLoader' ;
11+ import { useWorkbenchDB } from "../../contexts/dbContext" ;
12+ import {
13+ FILE_TREE_ROUTES ,
14+ IMPORT_FALLBACK_ROUTES ,
15+ } from "../../constants/routes" ;
16+ import ProgressLoader from "../ProgressLoader/ProgressLoader" ;
17+ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome" ;
18+ import { faGear } from "@fortawesome/free-solid-svg-icons" ;
1419
1520import "allotment/dist/style.css" ;
16- import ' ./layout.css' ;
21+ import " ./layout.css" ;
1722
1823const Layout = ( props : React . PropsWithChildren ) => {
1924 const { pathname } = useLocation ( ) ;
20- const { initialized, loadingStatus } = useWorkbenchDB ( ) ;
21-
22- const isImportFallbackRoute = IMPORT_FALLBACK_ROUTES . find ( route => pathname . includes ( route ) ) !== undefined ;
23- const showFileTree = FILE_TREE_ROUTES . find ( route => pathname . includes ( route ) ) !== undefined ;
24-
25+ const { initialized, loadingStatus, processingQuery } = useWorkbenchDB ( ) ;
26+
27+ const isImportFallbackRoute =
28+ IMPORT_FALLBACK_ROUTES . find ( ( route ) => pathname . includes ( route ) ) !==
29+ undefined ;
30+ const showFileTree =
31+ FILE_TREE_ROUTES . find ( ( route ) => pathname . includes ( route ) ) !== undefined ;
32+
33+ // useEffect(() => {
34+ // console.log("Loader status", processingQuery ? "Showing" : "Hiding");
35+ // }, [processingQuery]);
36+
2537 return (
26- < div className = ' d-flex flex-row' >
38+ < div className = " d-flex flex-row" >
2739 < Navbar />
28- < Allotment className = ' pane-container' >
40+ < Allotment className = " pane-container" >
2941 < Allotment . Pane
3042 visible = { showFileTree && initialized }
3143 minSize = { 10 }
@@ -35,21 +47,27 @@ const Layout = (props: React.PropsWithChildren) => {
3547 >
3648 < FileTree style = { { minHeight : "100vh" } } />
3749 </ Allotment . Pane >
38- < Allotment . Pane className = 'content-pane' >
39- < div className = 'content-container' >
40- {
41- isImportFallbackRoute && ! initialized ? (
42- loadingStatus !== null ?
43- < ProgressLoader progress = { loadingStatus } />
44- :
45- < ImportFallback />
46- ) : props . children
47- }
50+ < Allotment . Pane className = "content-pane" >
51+ < div className = "content-container" >
52+ { isImportFallbackRoute && ! initialized ? (
53+ loadingStatus !== null ? (
54+ < ProgressLoader progress = { loadingStatus } />
55+ ) : (
56+ < ImportFallback />
57+ )
58+ ) : (
59+ props . children
60+ ) }
61+ { processingQuery && (
62+ < div className = "query-processing-indicator" >
63+ Processing < FontAwesomeIcon icon = { faGear } spin />
64+ </ div >
65+ ) }
4866 </ div >
4967 </ Allotment . Pane >
5068 </ Allotment >
5169 </ div >
52- )
53- }
70+ ) ;
71+ } ;
5472
55- export default Layout
73+ export default Layout ;
0 commit comments