Skip to content

Commit

Permalink
Add link to data browser + prefix in dataset overview page (#617)
Browse files Browse the repository at this point in the history
# Description
- Add a `download` button to the dataset overview page that links to the
data browser > /path-to-collection/

# Demo

https://deploy-preview-41--ghg-demo.netlify.app/data-catalog/land-atmoshphere-co2-emissions-monthly-2022
  • Loading branch information
hanbyul-here authored Aug 30, 2023
2 parents 71be322 + 64f90cd commit 9367bb3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
10 changes: 7 additions & 3 deletions app/scripts/components/common/notebook-connect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import { Button, ButtonProps } from '@devseed-ui/button';
import {
CollecticonBook,
CollecticonCode,
CollecticonCog
CollecticonCog,
CollecticonDownload2
} from '@devseed-ui/collecticons';
import { Modal } from '@devseed-ui/modal';
import { DatasetData, datasets } from 'veda';
Expand Down Expand Up @@ -78,11 +79,12 @@ const DatasetUsageLabel = styled.div`
}
`;

type DatasetUsageType = 'jupyter' | 'github' | 'unknown';
type DatasetUsageType = 'jupyter' | 'github' | 'download' | 'unknown';

const IconByType: Record<DatasetUsageType, any> = {
jupyter: <CollecticonCog />,
github: <CollecticonBook />,
download: <CollecticonDownload2 />,
unknown: <CollecticonCog />
};

Expand All @@ -100,6 +102,8 @@ export function NotebookConnectModal(props: {
let type = 'unknown';
if (d.url.match('nasa-veda.2i2c.cloud')) type = 'jupyter';
else if (d.url.match('github.com/NASA-IMPACT/veda-docs')) type = 'github';
// TO DO: browser UI url pattern check
else if (d.url.match('browseui')) type = 'download';
return {
...d,
type
Expand Down Expand Up @@ -186,7 +190,7 @@ function NotebookConnectButtonSelf(props: NotebookConnectButtonProps) {
size={size}
>
<CollecticonCode meaningful={compact} title='Open data usage options' />
{compact ? '' : 'Analyze data (Python)'}
{compact ? '' : 'Access Data'}
</Button>
<NotebookConnectModal
dataset={dataset}
Expand Down
3 changes: 3 additions & 0 deletions mock/datasets/no2.data.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ usage:
- url: 'https://github.com/NASA-IMPACT/veda-docs'
label: All the docs for the site
title: 'Documentaion repo'
- url: https://d36s2ep3ahcq5b.cloudfront.net/browseui/index.html#ch4_inverse_flux
label: Data Browser
title: Download data
media:
src: ::file ./no2--dataset-cover.jpg
alt: Power plant shooting steam at the sky.
Expand Down

0 comments on commit 9367bb3

Please sign in to comment.