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

Rename discoveries to stories #595

Merged
merged 5 commits into from
Jul 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
20 changes: 10 additions & 10 deletions app/scripts/components/common/featured-slider-section.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import styled from 'styled-components';
import { DatasetData, DiscoveryData, datasets, discoveries } from 'veda';
import { DatasetData, StoryData, datasets, stories, getString } from 'veda';
import { VerticalDivider } from '@devseed-ui/toolbar';

import PublishedDate from './pub-date';
Expand All @@ -16,7 +16,7 @@ import {
} from '$styles/continuum';
import { useReactIndianaScrollControl } from '$styles/continuum/use-react-indiana-scroll-controls';
import { ContinuumScrollIndicator } from '$styles/continuum/continuum-scroll-indicator';
import { getDatasetPath, getDiscoveryPath } from '$utils/routes';
import { getDatasetPath, getStoryPath } from '$utils/routes';
import { Pill } from '$styles/pill';
import DatasetMenu from '$components/data-catalog/dataset-menu';
import {
Expand All @@ -25,7 +25,7 @@ import {
TAXONOMY_TOPICS
} from '$utils/veda-data';

const allFeaturedDiscoveries = Object.values(discoveries)
const allFeaturedStories = Object.values(stories)
.map((d) => d!.data)
.filter((d) => d.featured);

Expand All @@ -52,10 +52,10 @@ export const continuumFoldSpanCols = {
};

interface FeaturedSliderSectionProps {
featuring?: 'datasets' | 'discoveries';
featuredItems: DiscoveryData[] | DatasetData[];
featuring?: 'datasets' | 'stories';
featuredItems: StoryData[] | DatasetData[];
title: string;
getItemPath: typeof getDiscoveryPath | typeof getDatasetPath;
getItemPath: typeof getStoryPath | typeof getDatasetPath;
dateProperty?: string;
}

Expand Down Expand Up @@ -141,12 +141,12 @@ function FeaturedSliderSection(props: FeaturedSliderSectionProps) {
);
}

export function FeaturedDiscoveries() {
export function FeaturedStories() {
return (
<FeaturedSliderSection
title='Featured Data Stories'
featuredItems={allFeaturedDiscoveries}
getItemPath={getDiscoveryPath}
title={`Featured ${getString('stories').other}`}
featuredItems={allFeaturedStories}
getItemPath={getStoryPath}
dateProperty='pubDate'
/>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const BASEMAP_STYLES = [
}
];

// Default style used in discoveries and analysis, satellite no labels
// Default style used in stories and analysis, satellite no labels
export const DEFAULT_MAP_STYLE_URL =
'mapbox://styles/covid-nasa/ckb01h6f10bn81iqg98ne0i2y';

Expand Down
8 changes: 4 additions & 4 deletions app/scripts/components/common/page-header.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useCallback, useEffect, useRef, useState } from 'react';
import styled, { css } from 'styled-components';
import { Link, NavLink } from 'react-router-dom';
import { userPages, getOverride } from 'veda';
import { userPages, getOverride, getString } from 'veda';
import {
glsp,
listReset,
Expand Down Expand Up @@ -29,7 +29,7 @@ import { Tip } from './tip';
import UnscrollableBody from './unscrollable-body';
import { variableGlsp } from '$styles/variable-utils';
import {
DISCOVERIES_PATH,
STORIES_PATH,
DATASETS_PATH,
ANALYSIS_PATH,
ABOUT_PATH
Expand Down Expand Up @@ -418,10 +418,10 @@ function PageHeader() {
</li>
<li>
<GlobalMenuLink
to={DISCOVERIES_PATH}
to={STORIES_PATH}
onClick={closeNavOnClick}
>
Data Stories
{getString('stories').other}
</GlobalMenuLink>
</li>
</GlobalMenu>
Expand Down
22 changes: 11 additions & 11 deletions app/scripts/components/common/related-content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ import styled from 'styled-components';
import { media } from '@devseed-ui/theme-provider';

import {
discoveries,
stories,
datasets,
Media,
RelatedContentData,
DiscoveryData
StoryData
} from 'veda';
import { utcString2userTzDate } from '$utils/date';
import {
getDatasetPath,
getDiscoveryPath,
DISCOVERIES_PATH,
getStoryPath,
STORIES_PATH,
DATASETS_PATH
} from '$utils/routes';
import { Card, CardList } from '$components/common/card';
Expand All @@ -22,11 +22,11 @@ import { variableGlsp } from '$styles/variable-utils';
import { ContentBlock } from '$styles/content-block';

const datasetString = 'dataset';
const discoveryString = 'discovery';
const storyString = 'story';

const contentCategory = {
[datasetString]: datasets,
[discoveryString]: discoveries
[storyString]: stories
};

const TwoColumnCardList = styled(CardList)`
Expand Down Expand Up @@ -60,10 +60,10 @@ function formatUrl(id: string, parent: string) {
parentLink: DATASETS_PATH,
link: getDatasetPath(id)
};
case discoveryString:
case storyString:
return {
parentLink: DISCOVERIES_PATH,
link: getDiscoveryPath(id)
parentLink: STORIES_PATH,
link: getStoryPath(id)
};
default:
throw Error('Something went wrong with parent data of related content.');
Expand Down Expand Up @@ -109,7 +109,7 @@ function formatContents(relatedData: RelatedContentData[]) {
id,
name,
description,
date: (matchingContent as DiscoveryData).pubDate,
date: (matchingContent as StoryData).pubDate,
media,
type
});
Expand Down Expand Up @@ -144,7 +144,7 @@ export default function RelatedContent(props: RelatedContentProps) {
linkTo={t.link}
title={t.name}
date={
t.parent === discoveryString
t.parent === storyString
? utcString2userTzDate(t.date)
: undefined
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import React from 'react';
import styled from 'styled-components';
import { listReset, media } from '@devseed-ui/theme-provider';
import { discoveries } from 'veda';
import { stories, getString } from 'veda';

import { Card } from '$components/common/card';
import { Fold, FoldHeader, FoldTitle, FoldBody } from '$components/common/fold';
import { variableGlsp } from '$styles/variable-utils';
import { DISCOVERIES_PATH, getDiscoveryPath } from '$utils/routes';
import { STORIES_PATH, getStoryPath } from '$utils/routes';

const FeaturedDiscoveryList = styled.ol`
const FeaturedStoryList = styled.ol`
${listReset()}
display: grid;
grid-template-columns: repeat(4, 1fr);
Expand Down Expand Up @@ -55,33 +55,33 @@ const FeaturedDiscoveryList = styled.ol`
}
`;

// Get 5 discoveries that have the featured flag
// Get 5 stories that have the featured flag
/* eslint-disable-next-line fp/no-mutating-methods */
const featuredDiscoveries = Object.values(discoveries)
const featuredStories = Object.values(stories)
.filter((d) => d && !!d.data.featured)
.slice(0, 5)
.map((d) => d!.data)
.sort((a, b) => (new Date(a.pubDate) > new Date(b.pubDate) ? -1 : 1));

function FeaturedDiscoveries() {
function FeaturedStories() {
return (
<Fold>
<FoldHeader>
<FoldTitle>Featured Data Stories</FoldTitle>
<FoldTitle>Featured {getString('stories').other}</FoldTitle>
</FoldHeader>
<FoldBody>
{featuredDiscoveries.length ? (
<FeaturedDiscoveryList>
{featuredDiscoveries.map((d, i) => {
{featuredStories.length ? (
<FeaturedStoryList>
{featuredStories.map((d, i) => {
return (
<li key={d.id}>
<Card
cardType='cover'
linkLabel='View more'
linkTo={getDiscoveryPath(d)}
linkTo={getStoryPath(d)}
title={d.name}
parentName='Data Story'
parentTo={DISCOVERIES_PATH}
parentName={getString('stories').one}
parentTo={STORIES_PATH}
description={i === 0 ? d.description : undefined}
date={d.pubDate ? new Date(d.pubDate) : undefined}
imgSrc={d.media?.src}
Expand All @@ -90,11 +90,11 @@ function FeaturedDiscoveries() {
</li>
);
})}
</FeaturedDiscoveryList>
</FeaturedStoryList>
) : null}
</FoldBody>
</Fold>
);
}

export default FeaturedDiscoveries;
export default FeaturedStories;
4 changes: 2 additions & 2 deletions app/scripts/components/home/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { getOverride } from 'veda';

import rootCoverImage from '../../../graphics/layout/root-welcome--cover.jpg';

import FeaturedDiscoveries from './featured-discoveries';
import FeaturedStories from './featured-stories';
import ValueProposition from './value-propostion';
import Audience from './audience';

Expand Down Expand Up @@ -160,7 +160,7 @@ function RootHome() {
<ContentOverride with='homeContent'>
<Audience />

<FeaturedDiscoveries />
<FeaturedStories />

<ValueProposition />
</ContentOverride>
Expand Down
3 changes: 2 additions & 1 deletion app/scripts/components/home/value-propostion.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react';
import styled from 'styled-components';
import { getString } from 'veda';

import imgVP01 from '../../../graphics/layout/vp-01-illu.png';
import imgVP02 from '../../../graphics/layout/vp-02-illu.png';
Expand Down Expand Up @@ -89,7 +90,7 @@ function ValueProposition() {
<ContentBlockProseAlt>
<h3>Science communication platform</h3>
<p>
Share your data stories with others through the VEDA Dashboard.
Share your {getString('stories').other.toLocaleLowerCase()} with others through the VEDA Dashboard.
Submit a{' '}
<a
href='#'
Expand Down
3 changes: 2 additions & 1 deletion app/scripts/components/sandbox/cards/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react';
import { getString } from 'veda';

import { Fold } from '$components/common/fold';
import { Card, CardList } from '$components/common/card';
Expand All @@ -14,7 +15,7 @@ function SandboxCards() {
title='Cities Experiencing Clearer Air During Lockdowns'
description='Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce varius erat in vulputate.'
date={new Date('2021-10-26')}
parentName='Data Story'
parentName={getString('stories').one}
parentTo='/sandbox'
imgSrc='https://picsum.photos/id/1002/2048/1024'
imgAlt='Generic placeholder by lorem picsum'
Expand Down
2 changes: 1 addition & 1 deletion app/scripts/components/sandbox/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ const pages = [
},
{
id: 'mdxeditor',
name: 'Discovery Editor ⚠️EXPERIMENTAL',
name: 'Story Editor ⚠️EXPERIMENTAL',
component: SandboxMDXEditor
}
];
Expand Down
2 changes: 1 addition & 1 deletion app/scripts/components/sandbox/mdx-editor/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export const MDX_SOURCE_DEFAULT = `<Block>

NASA scientists will continue to monitor nitrogen dioxide levels and long-term trends around the world. NASA is expected to launch its [Tropospheric Emissions: Monitoring of Pollution (TEMPO)](http://tempo.si.edu/overview.html "Explore the TEMPO instrument") instrument in 2022, which will provide hourly, high-resolution measurements of nitrogen dioxide, ozone, and other air pollutants across North America, improving future air quality forecasts.

[Explore How COVID-19 Is Affecting Earth's Climate](/covid19/discoveries/climate/climate-change-and-covid "Explore How COVID-19 Is Affecting Earth's Climate")
[Explore How COVID-19 Is Affecting Earth's Climate](/covid19/stories/climate/climate-change-and-covid "Explore How COVID-19 Is Affecting Earth's Climate")
</Prose>
</Block>

Expand Down
Loading
Loading