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 Content Override option to stories hub #736

Merged
merged 12 commits into from
Nov 10, 2023
4 changes: 2 additions & 2 deletions app/scripts/components/common/layout-root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function LayoutRoot(props: { children?: ReactNode }) {

useGoogleTagManager();

const { title, thumbnail, description, hideFooter, localNavProps } =
const { title, thumbnail, description, hideFooter } =
useContext(LayoutRootContext);

const truncatedTitle =
Expand All @@ -57,7 +57,7 @@ function LayoutRoot(props: { children?: ReactNode }) {
description={description || appDescription}
thumbnail={thumbnail}
/>
<NavWrapper localNavProps={localNavProps} />
<NavWrapper />
<PageBody>
<Outlet />
{children}
Expand Down
11 changes: 1 addition & 10 deletions app/scripts/components/common/nav-wrapper.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import React from 'react';
import T from 'prop-types';
import styled, { css } from 'styled-components';
import { themeVal } from '@devseed-ui/theme-provider';

import PageHeader from './page-header';
import { useSlidingStickyHeaderProps } from './layout-root';
import PageLocalNav from '$components/common/page-local-nav';

import {
HEADER_WRAPPER_ID,
Expand All @@ -29,9 +27,7 @@ const NavWrapper = styled.div`
`}
`;

function PageNavWrapper({ localNavProps }) {
const renderLocalNav = !!localNavProps;

function PageNavWrapper() {
const { isHeaderHidden, headerHeight } = useSlidingStickyHeaderProps();

return (
Expand All @@ -41,13 +37,8 @@ function PageNavWrapper({ localNavProps }) {
headerHeight={headerHeight}
>
<PageHeader />
{renderLocalNav && <PageLocalNav {...localNavProps} />}
</NavWrapper>
);
}

PageNavWrapper.propTypes = {
localNavProps: T.object
};

export default PageNavWrapper;
269 changes: 0 additions & 269 deletions app/scripts/components/common/page-local-nav.js

This file was deleted.

12 changes: 1 addition & 11 deletions app/scripts/components/datasets/s-explore/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import TileLinkButton from './tile-link';
import DatasetLayers from './dataset-layers';
import { PanelDateWidget } from './panel-date-widget';
import { resourceNotFound } from '$components/uhoh';
import { DatasetsLocalMenu } from '$components/common/page-local-nav';
import { LayoutProps } from '$components/common/layout-root';
import MapboxMap, { MapboxMapRef } from '$components/common/mapbox';
import PageHero from '$components/common/page-hero';
Expand All @@ -43,9 +42,8 @@ import {
PANEL_REVEAL_DURATION
} from '$styles/panel';

import { allDatasetsProps, useDataset } from '$utils/veda-data';
import { useDataset } from '$utils/veda-data';
import { useMediaQuery } from '$utils/use-media-query';
import { DATASETS_PATH } from '$utils/routes';
import { useEffectPrevious } from '$utils/use-effect-previous';
import { userTzDate2utcString, utcString2userTzDate } from '$utils/date';
import { AsyncDatasetLayer, useDatasetAsyncLayers } from '$context/layer-data';
Expand Down Expand Up @@ -574,14 +572,6 @@ function DatasetsExplore() {
title={`${dataset.data.name} Exploration`}
description={dataset.data.description}
thumbnail={dataset.data.media?.src}
localNavProps={{
parentName: 'Dataset',
parentLabel: 'Datasets',
parentTo: DATASETS_PATH,
items: allDatasetsProps,
currentId: dataset.data.id,
localMenuCmp: <DatasetsLocalMenu dataset={dataset} />
}}
hideFooter
/>
<PageMainContent>
Expand Down
15 changes: 1 addition & 14 deletions app/scripts/components/datasets/s-overview/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@ import { CollecticonCompass } from '@devseed-ui/collecticons';
import { resourceNotFound } from '$components/uhoh';
import { LayoutProps } from '$components/common/layout-root';
import { PageActions, PageMainContent } from '$styles/page';
import { DatasetsLocalMenu } from '$components/common/page-local-nav';
import PageHero from '$components/common/page-hero';
import RelatedContent from '$components/common/related-content';
import { NotebookConnectButton } from '$components/common/notebook-connect';

import {
allDatasetsProps,
TAXONOMY_GRADE,
TAXONOMY_UNCERTAINTY,
useDataset
Expand All @@ -38,17 +36,6 @@ function DatasetsOverview() {
title={`${dataset.data.name} Overview`}
description={dataset.data.description}
thumbnail={dataset.data.media?.src}
localNavProps={{
parentName: 'Dataset',
parentLabel: 'Datasets',
parentTo: DATASETS_PATH,
items: allDatasetsProps,
currentId: dataset.data.id,
localMenuCmp:
dataset?.data.disableExplore !== true ? (
<DatasetsLocalMenu dataset={dataset} />
) : null
}}
/>

<PageMainContent>
Expand All @@ -57,7 +44,7 @@ function DatasetsOverview() {
description={dataset.data.description}
renderBetaBlock={() => (
<PageActions>
{dataset?.data.disableExplore !== true && (
{dataset.data.disableExplore !== true && (
<Button
forwardedAs={Link}
to={getDatasetExplorePath(dataset.data)}
Expand Down
Loading
Loading