Skip to content

Commit

Permalink
fix(labware-library): individual labware page routing (#16366)
Browse files Browse the repository at this point in the history
closes RESC-334
  • Loading branch information
jerader authored Sep 27, 2024
1 parent edb51fd commit d8a5a0e
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions labware-library/src/components/App/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
// main application wrapper component
import { useRef, useEffect } from 'react'
import cx from 'classnames'
import { useLocation } from 'react-router-dom'
import { Navigate, Route, Routes, useLocation } from 'react-router-dom'
import { DefinitionRoute } from '../../definitions'
import { useFilters } from '../../filters'
import { getPublicPath } from '../../public-path'
import { Nav, Breadcrumbs } from '../Nav'
import { Sidebar } from '../Sidebar'
import { Page } from './Page'
Expand Down Expand Up @@ -50,5 +51,16 @@ export function AppComponent(props: DefinitionRouteRenderProps): JSX.Element {
}

export function App(): JSX.Element {
return <DefinitionRoute render={props => <AppComponent {...props} />} />
return (
<Routes>
<Route
path={`${getPublicPath()}:loadName?`}
element={
<DefinitionRoute render={props => <AppComponent {...props} />} />
}
/>
<Route path="/labware" element={<AppComponent definition={null} />} />
<Route path="*" element={<Navigate to="/labware" />} />
</Routes>
)
}

0 comments on commit d8a5a0e

Please sign in to comment.