Skip to content

Commit

Permalink
Merge pull request #292 from NASA-IMPACT/develop
Browse files Browse the repository at this point in the history
Release 0.9.0
  • Loading branch information
olafveerman authored Jun 24, 2020
2 parents 0fc6f5d + 99c93fa commit 9f5e48b
Show file tree
Hide file tree
Showing 23 changed files with 912 additions and 519 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,4 @@ The app can then be run by any web server.
**When building the site for deployment provide the base url trough the `BASEURL` environment variable. Omit the leading slash. (E.g. https://example.com)**

# License
This project is licensed under **The MIT License (MIT)**, see the [LICENSE](LICENSE.md) file for more details.
This project is licensed under **Apache 2**, see the [LICENSE](LICENSE) file for more details.
Binary file added app/assets/graphics/content/co2_april_1_20.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/assets/graphics/content/la-port.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/assets/graphics/content/no2_south_america.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/assets/graphics/content/water-quality-chlorophyll-a-sf.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions app/assets/icons/collecticons/speech-balloon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,25 +1,11 @@
import React from 'react';
import { PropTypes as T } from 'prop-types';
import styled from 'styled-components';
import { withRouter } from 'react-router-dom';
import Clipboard from 'clipboard';

import Button from '../../styles/button/button';
import Dropdown, {
DropTitle,
DropMenu,
DropInset,
DropMenuItem
} from './dropdown';
import Form from '../../styles/form/form';
import FormInput from '../../styles/form/input';
import collecticon from '../../styles/collecticons';

const ShareIconMenu = styled(DropMenuItem)`
:before {
${({ useIcon }) => collecticon(useIcon)}
}
`;

const FormInputGroup = styled.div`
display: grid;
Expand All @@ -36,60 +22,9 @@ const FormInputGroup = styled.div`
}
`;

class ShareOptions extends React.Component {
render () {
const url = window.location.toString();
return (
<Dropdown
alignment='right'
direction='down'
triggerElement={
<Button
variation='achromic-plain'
title='Toggle share options'
hideText
useIcon='share-2'
>
<span>Share</span>
</Button>
}
>
<DropTitle>Share</DropTitle>
<DropMenu role='menu' iconified>
<li>
<ShareIconMenu
useIcon='brand-facebook'
href={`https://www.facebook.com/sharer/sharer.php?u=${url}`}
title='Share on Facebook'
target='_blank'
>
<span>Facebook</span>
</ShareIconMenu>
</li>
<li>
<ShareIconMenu
useIcon='brand-twitter'
href={`https://twitter.com/intent/tweet?url=${url}`}
title='Share on Twitter'
target='_blank'
>
<span>Twitter</span>
</ShareIconMenu>
</li>
</DropMenu>
<DropInset>
<CopyField value={url} />
</DropInset>
</Dropdown>
);
}
}

export default withRouter(ShareOptions);

// This needs to be a separate class because of the mount and unmount methods.
// The dropdown unmounts when closed and the refs would be lost otherwise.
class CopyField extends React.Component {
export class CopyField extends React.Component {
constructor (props) {
super(props);
this.state = {
Expand Down Expand Up @@ -140,7 +75,7 @@ class CopyField extends React.Component {
this.triggerEl = el;
}}
>
<span>Copy to clipboard</span>
Copy to clipboard
</Button>
</FormInputGroup>
</Form>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default {
raster: {
type: 'raster',
tiles: [
`${config.api}/{z}/{x}/{y}@1x?url=s3://covid-eo-data/planet/{spotlightId}_{date}.tif&resampling_method=nearest&bidx=1,2,3`
`${config.api}/{z}/{x}/{y}@1x?url=s3://covid-eo-data/planet/{spotlightId}-{date}.tif&resampling_method=nearest&bidx=1,2,3`
]
}
},
Expand Down
9 changes: 6 additions & 3 deletions app/assets/scripts/components/common/layers/layer-no2.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,18 @@ export default {
name: 'Nitrogen dioxide',
type: 'raster-timeseries',
domain: [
'2019-03-01',
'2020-03-01'
'2018-03-01',
'2020-04-01'
],
source: {
type: 'raster',
tiles: [
`${config.api}/{z}/{x}/{y}@1x?url=s3://covid-eo-data/OMNO2d_HRM/OMI_trno2_0.10x0.10_{date}_Col3_V4.nc.tif&resampling_method=bilinear&bidx=1&rescale=0%2C1e16&color_map=custom_no2&color_formula=gamma r {gamma}`
`${config.api}/{z}/{x}/{y}@1x?url=s3://covid-eo-data/OMNO2d_HRM/OMI_trno2_0.10x0.10_{date}_Col3_V4.nc.tif&resampling_method=bilinear&bidx=1&rescale=0%2C1.5e16&color_map=custom_no2&color_formula=gamma r {gamma}`
]
},
paint: {
'raster-opacity': 0.75
},
exclusiveWith: ['co2', 'co2-diff', 'gibs-population', 'car-count', 'nightlights-viirs', 'nightlights-hd', 'detection-ship', 'detection-multi', 'water-chlorophyll', 'water-spm'],
enabled: true,
compare: {
Expand Down
21 changes: 17 additions & 4 deletions app/assets/scripts/components/common/layers/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export const layerTypes = {
'raster-timeseries': {
update: (ctx, layerInfo, prevProps) => {
const { mbMap, mbMapComparing, mbMapComparingLoaded, props } = ctx;
const { id, source, compare } = layerInfo;
const { id, source, compare, paint } = layerInfo;
const prevLayerInfo = prevProps.layers.find(l => l.id === layerInfo.id);
const { date, comparing } = props;

Expand Down Expand Up @@ -119,7 +119,8 @@ export const layerTypes = {
{
id: id,
type: 'raster',
source: id
source: id,
paint: paint || {}
},
'admin-0-boundary-bg'
);
Expand All @@ -135,7 +136,7 @@ export const layerTypes = {
},
show: (ctx, layerInfo) => {
const { mbMap, props } = ctx;
const { id, source } = layerInfo;
const { id, source, paint } = layerInfo;
const { date } = props;
if (!date) return;

Expand All @@ -147,7 +148,8 @@ export const layerTypes = {
{
id: id,
type: 'raster',
source: id
source: id,
paint: paint || {}
},
'admin-0-boundary-bg'
);
Expand Down Expand Up @@ -190,6 +192,17 @@ export const layerTypes = {
const rastId = `${id}-raster`;
const { vector, raster } = source;

// Do not update if:
if (
// There's no date defined.
prevProps.date && date &&
// Dates are the same
date.getTime() === prevProps.date.getTime()
) return;

// The source we're updating is not present.
if (!mbMap.getSource(id)) return;

const formatDate = format(utcDate(date), dateFormats[layerInfo.timeUnit]);
const vectorData = vector.data.replace('{date}', formatDate);
const rasterTiles = raster.tiles.map(tile => tile.replace('{date}', formatDate));
Expand Down
4 changes: 2 additions & 2 deletions app/assets/scripts/components/common/page-footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ const PageFooter = props => {
<dt>NASA official</dt>
<dd>
<Button
as='a'
element='a'
href='mailto:[email protected]'
title='Get in touch'
variation='base-plain'
Expand All @@ -138,7 +138,7 @@ const PageFooter = props => {
<dt>Open source code</dt>
<dd>
<Button
as='a'
element='a'
href='https://github.com/NASA-IMPACT/covid-dashboard'
title='Explore the code'
variation='base-plain'
Expand Down
Loading

0 comments on commit 9f5e48b

Please sign in to comment.