Skip to content

Commit

Permalink
Reverts routing related changes (#684)
Browse files Browse the repository at this point in the history
  • Loading branch information
nerik authored Sep 28, 2023
2 parents df3367d + 45e6fce commit aedbf51
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 24 deletions.
1 change: 0 additions & 1 deletion app/scripts/components/analysis/define/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ const FloatingFooter = styled.div<{ isSticky: boolean }>`
position: sticky;
left: 0;
right: 0;
// trick to get the IntersectionObserver to fire
bottom: -1px;
padding: ${variableGlsp(0.5)};
background: ${themeVal('color.surface')};
Expand Down
2 changes: 1 addition & 1 deletion app/scripts/components/datasets/s-overview/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ function DatasetsOverview() {
<PageActions>
{dataset?.data.disableExplore !== true && (
<Button
forwardedAs={Link as any}
forwardedAs={Link}
to={getDatasetExplorePath(dataset.data)}
size='large'
variation='achromic-outline'
Expand Down
11 changes: 2 additions & 9 deletions app/scripts/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import { BrowserRouter, Route, Routes, useLocation } from 'react-router-dom';
import { DevseedUiThemeProvider as DsTp } from '@devseed-ui/theme-provider';
import { userPages } from 'veda';

import { DatasetExploreRedirect, discoveryRoutes, thematicRoutes } from './redirects';

import theme, { GlobalStyles } from '$styles/theme';
import { getAppURL } from '$utils/history';
import LayoutRoot, {
Expand All @@ -28,6 +26,7 @@ const StoriesHub = lazy(() => import('$components/stories/hub'));
const StoriesSingle = lazy(() => import('$components/stories/single'));

const DataCatalog = lazy(() => import('$components/data-catalog'));
const DatasetsExplore = lazy(() => import('$components/datasets/s-explore'));
const DatasetsOverview = lazy(() => import('$components/datasets/s-overview'));

const Analysis = lazy(() => import('$components/analysis/define'));
Expand Down Expand Up @@ -94,7 +93,7 @@ function Root() {
/>
<Route
path={`${DATASETS_PATH}/:datasetId/explore`}
element={<DatasetExploreRedirect />}
element={<DatasetsExplore />}
/>
<Route path={STORIES_PATH} element={<StoriesHub />} />
<Route
Expand All @@ -111,12 +110,6 @@ function Root() {
{process.env.NODE_ENV !== 'production' && (
<Route path='/sandbox/*' element={<Sandbox />} />
)}

{/* Legacy: Routes related to thematic areas redirect. */}
{thematicRoutes}
{/* Legacy: Routes related to renaming /discoveries to /stories. */}
{discoveryRoutes}

{userPages.map((p) => (
<Route
key={p}
Expand Down
14 changes: 1 addition & 13 deletions app/scripts/redirects.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import React from 'react';
import { Navigate, Route, useParams } from 'react-router';

import { DATASETS_PATH, STORIES_PATH } from '$utils/routes';
import { useDataset } from '$utils/veda-data';
import DatasetsExplore from '$components/datasets/s-explore';
import { STORIES_PATH } from '$utils/routes';

function DiscoveryRedirect() {
const { discoveryId } = useParams();
Expand Down Expand Up @@ -54,13 +52,3 @@ export const discoveryRoutes = (
<Route path='discoveries/:discoveryId' element={<DiscoveryRedirect />} />
</Route>
);

export function DatasetExploreRedirect() {
const dataset = useDataset();
const url = `${DATASETS_PATH}/${dataset?.data.id}`;
return dataset?.data.disableExplore ? (
<Navigate replace to={url} />
) : (
<DatasetsExplore />
);
}

0 comments on commit aedbf51

Please sign in to comment.