Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reverts routing related changes #684

Merged
merged 8 commits into from
Sep 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
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 Expand Up @@ -288,7 +287,7 @@
const onDatasetLayerChange = useCallback(
(e) => {
const id = e.target.id;
let newDatasetsLayers = [...(datasetsLayers || [])];

Check warning on line 290 in app/scripts/components/analysis/define/index.tsx

View workflow job for this annotation

GitHub Actions / lint

Prefer using nullish coalescing operator (`??`) instead of a logical or (`||`), as it is a safer operator
if (e.target.checked) {
const newDatasetLayer = allAvailableDatasetsLayers.find(
(l) => l.id === id
Expand Down Expand Up @@ -329,7 +328,7 @@
setAnalysisParam('datasetsLayers', cleanedDatasetsLayers);
// Only update when stac search gets updated to avoid triggering an infinite
// read/set state loop
}, [selectableDatasetLayers, setAnalysisParam]);

Check warning on line 331 in app/scripts/components/analysis/define/index.tsx

View workflow job for this annotation

GitHub Actions / lint

React Hook useEffect has a missing dependency: 'datasetsLayers'. Either include it or remove the dependency array

const notReady = !readyToLoadDatasets || !datasetsLayers?.length;

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 />
);
}
Loading