@@ -23,7 +23,6 @@ import {useSelector} from "react-redux";
2323import { RootState } from "../types/data" ;
2424import { AddBox , Create , Explore } from "@material-ui/icons" ;
2525import { EmbeddedSearch } from "./search/EmbeddedSearch" ;
26- import { SearchErrorBoundary } from "./search/SearchErrorBoundary" ;
2726import { searchTheme } from "../theme" ;
2827import { ReactiveBase } from "@appbaseio/reactivesearch" ;
2928import Cookies from "universal-cookie" ;
@@ -53,7 +52,7 @@ const Main = styled('main', {shouldForwardProp: (prop) => prop !== 'open'})<{
5352} ) ) ;
5453
5554
56- const SearchDiv = styled ( "div" ) ( ( { theme } ) => ( {
55+ const SearchDiv = styled ( "div" ) ( ( { theme} ) => ( {
5756 position : "relative" ,
5857 marginLeft : theme . spacing ( 3 ) ,
5958 marginBottom : "-5px" , // to compoensate the tags div
@@ -115,11 +114,10 @@ export default function PersistentDrawerLeft(props) {
115114
116115 const location = useLocation ( ) ;
117116
118- useEffect ( ( ) => {
119- if ( location . pathname . includes ( "search" ) ) {
117+ useEffect ( ( ) => {
118+ if ( location . pathname . includes ( "search" ) ) {
120119 setEmbeddedSearchHidden ( true ) ;
121- }
122- else {
120+ } else {
123121 setEmbeddedSearchHidden ( false ) ;
124122 }
125123 } , [ location ] )
@@ -136,113 +134,99 @@ export default function PersistentDrawerLeft(props) {
136134 headers = { headers }
137135 theme = { searchTheme }
138136 >
139- < SearchErrorBoundary >
140- < Box sx = { { display : 'flex' } } >
141- < CssBaseline />
142- < AppBar position = "fixed" open = { open } >
143- < Toolbar >
144- < IconButton
145- color = "inherit"
146- aria-label = "open drawer"
147- onClick = { handleDrawerOpen }
148- edge = "start"
149- sx = { { mr : 2 , ...( open && { display : 'none' } ) } }
150- >
151- < MenuIcon />
152- </ IconButton >
153- < Link href = "/" >
154- < Box component = "img" src = "../../public/clowder-logo-sm.svg" alt = "clowder-logo-sm"
155- sx = { { verticalAlign : "middle" } } />
156- </ Link >
157-
158- { /*for searching*/ }
159- < SearchDiv hidden = { embeddedSearchHidden } >
160- < EmbeddedSearch />
161- </ SearchDiv >
162- < Box sx = { { flexGrow : 1 } } />
163- < Box sx = { { marginLeft : "auto" } } >
164- {
165- loggedOut ?
166- < >
167- < Link href = "/auth/register" sx = { link } > Register</ Link >
168- < Link href = "/auth/login" sx = { link } > Login</ Link >
169- </ >
170- :
171- < Link href = "/auth/logout" sx = { link } > Logout</ Link >
172- }
173- </ Box >
174- </ Toolbar >
175- </ AppBar >
176- < Drawer
177- sx = { {
137+ < Box sx = { { display : 'flex' } } >
138+ < CssBaseline />
139+ < AppBar position = "fixed" open = { open } >
140+ < Toolbar >
141+ < IconButton
142+ color = "inherit"
143+ aria-label = "open drawer"
144+ onClick = { handleDrawerOpen }
145+ edge = "start"
146+ sx = { { mr : 2 , ...( open && { display : 'none' } ) } }
147+ >
148+ < MenuIcon />
149+ </ IconButton >
150+ < Link href = "/" >
151+ < Box component = "img" src = "../../public/clowder-logo-sm.svg" alt = "clowder-logo-sm"
152+ sx = { { verticalAlign : "middle" } } />
153+ </ Link >
154+
155+ { /*for searching*/ }
156+ < SearchDiv hidden = { embeddedSearchHidden } >
157+ < EmbeddedSearch />
158+ </ SearchDiv >
159+ < Box sx = { { flexGrow : 1 } } />
160+ < Box sx = { { marginLeft : "auto" } } >
161+ {
162+ loggedOut ?
163+ < >
164+ < Link href = "/auth/register" sx = { link } > Register</ Link >
165+ < Link href = "/auth/login" sx = { link } > Login</ Link >
166+ </ >
167+ :
168+ < Link href = "/auth/logout" sx = { link } > Logout</ Link >
169+ }
170+ </ Box >
171+ </ Toolbar >
172+ </ AppBar >
173+ < Drawer
174+ sx = { {
175+ width : drawerWidth ,
176+ flexShrink : 0 ,
177+ '& .MuiDrawer-paper' : {
178178 width : drawerWidth ,
179- flexShrink : 0 ,
180- '& .MuiDrawer-paper' : {
181- width : drawerWidth ,
182- boxSizing : 'border-box' ,
183- } ,
184- } }
185- variant = "persistent"
186- anchor = "left"
187- open = { open }
188- >
189- < DrawerHeader >
190- < IconButton onClick = { handleDrawerClose } >
191- { theme . direction === 'ltr' ? < ChevronLeftIcon /> : < ChevronRightIcon /> }
192- </ IconButton >
193- </ DrawerHeader >
194- < Divider />
195- < List >
196- < ListItem key = { "explore" } disablePadding >
197- < ListItemButton component = { RouterLink } to = "/" >
198- < ListItemIcon >
199- < Explore />
200- </ ListItemIcon >
201- < ListItemText primary = { "Explore" } />
202- </ ListItemButton >
203- </ ListItem >
204- </ List >
205- < Divider />
206- < List >
207- < ListItem key = { "search" } disablePadding >
208- < ListItemButton component = { RouterLink } to = "/search" >
209- < ListItemIcon >
210- < SearchDatasetIcon />
211- </ ListItemIcon >
212- < ListItemText primary = { "Search" } />
213- </ ListItemButton >
214- </ ListItem >
215- </ List >
216- < Divider />
217- < List >
218- < ListItem key = { "newdataset" } disablePadding >
219- < ListItemButton component = { RouterLink } to = "/create-dataset" >
220- < ListItemIcon >
221- < AddBox />
222- </ ListItemIcon >
223- < ListItemText primary = { "New Dataset" } />
224- </ ListItemButton >
225- </ ListItem >
226- </ List >
227- < Divider />
228- < List >
229- < ListItem key = { "newmetadata" } disablePadding >
230- < ListItemButton component = { RouterLink } to = "/new-metadata-definition" >
231- < ListItemIcon >
232- < Create />
233- </ ListItemIcon >
234- < ListItemText primary = { "Create Metadata Definition" } />
235- </ ListItemButton >
236- </ ListItem >
237- </ List >
238- < Divider />
239- </ Drawer >
240- < Main open = { open } >
241- < DrawerHeader />
242- { children }
243- </ Main >
244- </ Box >
245- </ SearchErrorBoundary >
179+ boxSizing : 'border-box' ,
180+ } ,
181+ } }
182+ variant = "persistent"
183+ anchor = "left"
184+ open = { open }
185+ >
186+ < DrawerHeader >
187+ < IconButton onClick = { handleDrawerClose } >
188+ { theme . direction === 'ltr' ? < ChevronLeftIcon /> : < ChevronRightIcon /> }
189+ </ IconButton >
190+ </ DrawerHeader >
191+ < Divider />
192+ < List >
193+ < ListItem key = { "explore" } disablePadding >
194+ < ListItemButton component = { RouterLink } to = "/" >
195+ < ListItemIcon >
196+ < Explore />
197+ </ ListItemIcon >
198+ < ListItemText primary = { "Explore" } />
199+ </ ListItemButton >
200+ </ ListItem >
201+ </ List >
202+ < Divider />
203+ < List >
204+ < ListItem key = { "search" } disablePadding >
205+ < ListItemButton component = { RouterLink } to = "/search" >
206+ < ListItemIcon >
207+ < SearchDatasetIcon />
208+ </ ListItemIcon >
209+ < ListItemText primary = { "Search" } />
210+ </ ListItemButton >
211+ </ ListItem >
212+ </ List >
213+ < Divider />
214+ < List >
215+ < ListItem key = { "newdataset" } disablePadding >
216+ < ListItemButton component = { RouterLink } to = "/create-dataset" >
217+ < ListItemIcon >
218+ < AddBox />
219+ </ ListItemIcon >
220+ < ListItemText primary = { "New Dataset" } />
221+ </ ListItemButton >
222+ </ ListItem >
223+ </ List >
224+ </ Drawer >
225+ < Main open = { open } >
226+ < DrawerHeader />
227+ { children }
228+ </ Main >
229+ </ Box >
246230 </ ReactiveBase >
247231 ) ;
248232}
0 commit comments