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

Add Back Button on Explore page #779

Merged
merged 2 commits into from
Dec 18, 2023
Merged
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
30 changes: 29 additions & 1 deletion app/scripts/components/datasets/s-explore/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ import React, {
} from 'react';
import styled from 'styled-components';
import { useNavigate } from 'react-router';
import { Link } from 'react-router-dom';
import useQsStateCreator from 'qs-state-hook';
import { isSameDay } from 'date-fns';
import { themeVal } from '@devseed-ui/theme-provider';
import {
CollecticonExpandFromLeft,
CollecticonShrinkToLeft
CollecticonShrinkToLeft,
CollecticonArrowLeft,
} from '@devseed-ui/collecticons';
import { ProjectionOptions } from 'veda';
import { FormSwitch } from '@devseed-ui/form';
Expand All @@ -21,6 +23,7 @@ import LayerVisibilityToggleButton from './layer-visibility-toggle';
import TileLinkButton from './tile-link';
import DatasetLayers from './dataset-layers';
import { PanelDateWidget } from './panel-date-widget';
import { DATASETS_PATH } from '$utils/routes';
import { resourceNotFound } from '$components/uhoh';
import { LayoutProps } from '$components/common/layout-root';
import MapboxMap, { MapboxMapRef } from '$components/common/mapbox';
Expand All @@ -42,6 +45,7 @@ import {
PANEL_REVEAL_DURATION
} from '$styles/panel';


import { useDataset } from '$utils/veda-data';
import { useMediaQuery } from '$utils/use-media-query';
import { useEffectPrevious } from '$utils/use-effect-previous';
Expand All @@ -61,6 +65,25 @@ import {
BASEMAP_ID_DEFAULT
} from '$components/common/mapbox/map-options/basemaps';

const BackLink = styled(Link)`
display: flex;
padding: ${variableGlsp(0.5)};
font-size: 1rem;
font-weight: ${themeVal('type.base.bold')};
color: ${themeVal('color.link')};
background-color: ${themeVal('color.surface')};
cursor: pointer;

& > svg {
flex: 0 0 auto;
margin: 0.25rem 0.5rem 0 0;
}

&:hover {
opacity: 0.8;
}
`;

const Explorer = styled.div`
position: relative;
flex-grow: 1;
Expand Down Expand Up @@ -607,6 +630,11 @@ function DatasetsExplore() {
<PositionPlaceHolderForScroll />
<ScrollArea>
<ScrollAreaInner>
<BackLink
to={`${DATASETS_PATH}/${dataset.data.id}`}
>
<CollecticonArrowLeft /> Back to dataset overview
</BackLink>
<DatesWrapper>
{activeLayerTimeseries && (
<PanelDateWidget
Expand Down
Loading