Skip to content

Commit

Permalink
Merge pull request #442 from devinit/development
Browse files Browse the repository at this point in the history
release/v3.3.9
  • Loading branch information
edwinmp authored Oct 9, 2018
2 parents be09d80 + 9238955 commit 6b4652f
Show file tree
Hide file tree
Showing 56 changed files with 1,335 additions and 649 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "@devinit/dh-app",
"version": "3.3.7",
"version": "3.3.9",
"config": {
"API": "http://212.111.41.68:3000/graphql",
"API": "http://212.111.41.68:9090/graphql",
"PUPPETEER_SKIP_CHROMIUM_DOWNLOAD": true,
"OLD_DATAHUB_URL": "http://212.111.41.68:8888"
},
Expand Down
32 changes: 32 additions & 0 deletions pages/_document.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export default class MyDocument extends Document {
<title>{ pageMeta.title }</title>
<style dangerouslySetInnerHTML={ { __html: this.props.css } } />
{/* <style key="critical" dangerouslySetInnerHTML={{ __html: criticalCSS}} /> */ }
<link as="style" href="/outdatedbrowser/outdatedbrowser.min.css" rel="stylesheet"/>
<link as="style" href={ `/semantic.min.css?v${version}` } rel="stylesheet" />
<link as="style" href={ `/di-charts.min.css?v${version}` } rel="stylesheet"/>
{ process.env.NODE_ENV !== 'production' ?
Expand Down Expand Up @@ -67,11 +68,42 @@ export default class MyDocument extends Document {
gtag('config', 'UA-122244396-1');`
} }
/>
<script async src="/outdatedbrowser/outdatedbrowser.min.js"/>

</Head>
<body>
<Main />
<NextScript />
<div id="outdated"/>
<script
dangerouslySetInnerHTML={ {
__html: `
//event listener form DOM ready
function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function() {
if (oldonload) {
oldonload();
}
func();
}
}
}
//call function after DOM ready
addLoadEvent(function(){
outdatedBrowser({
bgColor: '#f25648',
color: '#ffffff',
lowerThan: 'Edge',
languagePath: '/outdatedbrowser/lang/en.html'
})
});
`
} }
/>
</body>
</html>
);
Expand Down
14 changes: 7 additions & 7 deletions src/components/MethodologyData/country-profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default {
{
name: 'International resource flows to and from developed countries',
description:
'Estimates of international resource flows from developed countries, 2016 US$.',
'Estimates of international resource flows from and to the country, US$ (constant 2016 prices). Data is for 2000-2016. Data on private development assistance (PDA) is shown for a single year only. See methodology for detailed notes on the data for each resource flow.',
methodology: '',
uom: 'constant 2016 US$',
csv:
Expand All @@ -30,15 +30,15 @@ export default {
'https://github.com/devinit/digital-platform/blob/master/user-data/intl-flows-donors.zip?raw=true',
source: {
name:
'Development Initiatives based on numerous sources. Note that data of some flows is missing. Foreign direct investment: OECD. Disbursements of official development assistance and other official flows: OECD DAC. Export Credits: OECD DAC. PDA: Hudson Insitutue and OECD. Remittances: World Bank Migration and Remittances Factbook.',
'Source: Development Initiatives based on numerous sources. Note that data on some flows are missing. Official development assistance, other official flows and officially supported export credits: OECD DAC. Foreign direct investment: OECD. Long- and short-term debt: World Bank International Debt Statistics. Portfolio equity: World Bank data bank. Remittances: World Bank Migration and Remittances Data. Private Development Assistance: Hudson Institute Index of Global Philanthropy and Remittances 2016 and OECD DAC.',
link: ''
}
},
{
name: 'Non-grant government revenue',
description: 'Non-grant government revenue. Data is for 2015.',
description: 'Non-grant government revenue. Data is for 2016.',
methodology: '',
uom: 'constant 2015 US$, NCU',
uom: 'constant 2016 US$, NCU',
csv:
'https://github.com/devinit/digital-platform/blob/master/user-data/domestic',
zip:
Expand All @@ -51,16 +51,16 @@ export default {
{
name: 'International resource flows to and from developing countries',
description:
'Estimates of international resource flows into the country, 2015 US$. Data is for 2015. Estimates are gross inflows where available, with the following exceptions: foreign direct investment and portfolio equity are net inflows (new investments minus disinvestments) and short-term debt is net flows (disbursements minus capital repayments). See methodology for detailed notes on the data for each resource flow.',
'Estimates of international resource flows to and from the country, US$ (constant 2016 prices). Data is for 2000-2016. Estimates are in gross for inflows where available, with the following exceptions: foreign direct investment and portfolio equity are net inflows (new investments minus disinvestments) and short-term debt is net flows (disbursements minus capital repayments). Blended finance refers to private finance mobilised by official development finance interventions, data is available for 2012-2015 only. Data on South-South Cooperation can vary in-terms of definition and types of flow included by provider. See methodology for detailed notes on the data for each resource flow.',
methodology: '',
uom: 'constant 2015 US$',
uom: 'constant 2016 US$',
csv:
'https://github.com/devinit/digital-platform/blob/master/user-data/intl-flows-recipients',
zip:
'https://github.com/devinit/digital-platform/blob/master/user-data/intl-flows-recipients.zip?raw=true',
source: {
name:
'Development Initiatives based on numerous sources. Note that data on some flows are missing. Official development assistance and other official flows: OECD DAC. Foreign direct investment: UNCTAD Stats. Long- and short-term debt: World Bank International Debt Statistics. Portfolio equity: World Bank data bank. Remittances: World Bank Migration and Remittances Data.',
'Source: Development Initiatives based on numerous sources. Note that data on some flows are missing. Official development assistance, other official flows, officially supported export credits, blended finance: OECD DAC. Foreign direct investment: UNCTAD Stats. Long- and short-term debt: World Bank International Debt Statistics. Portfolio equity: World Bank data bank. Remittances: World Bank Migration and Remittances Data. Tourism: World Bank World Development Indicators. South-South cooperation data is based on the national sources of each provider.',
link: ''
}
},
Expand Down
30 changes: 15 additions & 15 deletions src/components/MethodologyData/global-picture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
{
name: '% of people in the P20',
description:
'The percentage of population of each country who are in the global poorest 20%',
'The percentage of population of each country who are in the global poorest 20%. 2013 represents the most recent year data is available',
methodology: '',
uom: 'percent',
csv:
Expand All @@ -22,7 +22,7 @@ export default {
{
name: '% of population living in extreme poverty',
description:
"Extreme poverty is defined as living on less than $1.90 a day. It is calculated using the national poverty lines of some of the world's poorest countries at 2011 PPP$.",
"Extreme poverty is defined as living on less than $1.90 a day. It is calculated using the national poverty lines of some of the world's poorest countries at 2011 PPP$. 2013 represents the most recent year data is available.",
methodology: '',
uom: 'percent',
csv:
Expand All @@ -37,7 +37,7 @@ export default {
{
name: '% of population living on less than $3.10 a day',
description:
'Data for those living under $3.10 a day illustrates that while many people are not in extreme poverty (less than $1.90 a day) they are still very poor.',
'Data for those living under $3.10 a day illustrates that while many people are not in extreme poverty (less than $1.90 a day) they are still very poor. 2013 represents the most recent year data is available.',
methodology: '',
uom: 'percent',
csv:
Expand Down Expand Up @@ -609,11 +609,11 @@ export default {
}
},
{
name: 'Government revenue per person (excluding grants), 2015 PPP$',
name: 'Government revenue per person (excluding grants), 2011 PPP$',
description:
'Average revenue raised per person by the government, including tax and non-tax revenue (grants and borrowing are excluded). Figures are displayed in 2015 constant purchasing power parity (PPP)$. (Data series is from 1999-2021, where available. The hover function details whether the data point is an actual or a projected figure.)',
'Average revenue raised per person by the government, including tax and non-tax revenue (grants and borrowing are excluded). Figures are displayed in 2011 PPP$ (purchasing power parity). (Data series is from 1999-2023, where available. The hover function details whether the data point is an actual or a projected figure.)',
methodology: '',
uom: '2015 PPP$',
uom: '2011 PPP$',
csv:
'https://github.com/devinit/digital-platform/blob/master/user-data/non-grant-revenue-ppp-pc',
zip:
Expand All @@ -625,11 +625,11 @@ export default {
}
},
{
name: 'Government revenue per person (including grants), 2015 PPP$',
name: 'Government revenue per person (including grants), 2011 PPP$',
description:
'Average revenue raised per person by the government, including tax, non-tax revenue and grants (borrowing is excluded). Figures are displayed in 2015 constant purchasing power parity (PPP)$. (Data series is from 1999-2021, where available. The hover function details whether the data point is an actual or a projected figure.)',
'Average revenue raised per person by the government, including tax, non-tax revenue and grants (borrowing is excluded). Figures are displayed in 2011 PPP$ (purchasing power parity). (Data series is from 1999-2023, where available. The hover function details whether the data point is an actual or a projected figure.)',
methodology: '',
uom: '2015 PPP$',
uom: '2011 PPP$',
csv:
'https://github.com/devinit/digital-platform/blob/master/user-data/total-revenue-ppp-pc',
zip:
Expand All @@ -643,7 +643,7 @@ export default {
{
name: 'Government revenue (excluding grants), % of GDP',
description:
'Revenue raised as a proportion of national income (GDP) by the government, including tax and non-tax revenue (grants and borrowing are excluded). (Data series is from 1999-2021, where available. The hover function details whether the data point is an actual or a projected figure.)',
'Revenue raised as a proportion of national income (GDP) by the government, including tax and non-tax revenue (grants and borrowing are excluded). (Data series is from 1999-2023, where available. The hover function details whether the data point is an actual or a projected figure.)',
methodology: '',
uom: 'percent',
csv:
Expand All @@ -659,7 +659,7 @@ export default {
{
name: 'Government revenue (including grants), % of GDP',
description:
'Revenue raised as a proportion of national income (GDP) by the government, including tax, non-tax revenue and grants (borrowing is excluded). (Data series is from 1999-2021, where available. The hover function details whether the data point is an actual or a projected figure.)',
'Revenue raised as a proportion of national income (GDP) by the government, including tax, non-tax revenue and grants (borrowing is excluded). (Data series is from 1999-2023, where available. The hover function details whether the data point is an actual or a projected figure.)',
methodology: '',
uom: 'percent',
csv:
Expand All @@ -674,7 +674,7 @@ export default {
{
name: 'Grants, % of government revenue',
description:
'Grants from international donors as a proportion of government revenue (including grants). (Data series is from 1999-2021, where available. The hover function details whether the data point is an actual or a projected figure.)',
'Grants from international donors as a proportion of government revenue (including grants). (Data series is from 1999-2023, where available. The hover function details whether the data point is an actual or a projected figure.)',
methodology: '',
uom: 'percent',
csv:
Expand All @@ -688,11 +688,11 @@ export default {
}
},
{
name: 'Government spending per person, 2015 PPP$',
name: 'Government spending per person, 2011 PPP$',
description:
'Total expenditure by the government divided by the total population. Figures are displayed in 2015 constant purchasing power parity (PPP)$. (Data series is from 1999-2021, where available. The hover function details whether the data point is an actual or a projected figure.)',
'Total expenditure by the government divided by the total population. Figures are displayed in 2011 PPP$ (purchasing power parity). (Data series is from 1999-2023, where available. The hover function details whether the data point is an actual or a projected figure.)',
methodology: '',
uom: '2015 PPP$',
uom: '2011 PPP$',
csv:
'https://github.com/devinit/digital-platform/blob/master/user-data/govt-spend-pc',
zip:
Expand Down
8 changes: 7 additions & 1 deletion src/components/atoms/BaseMap/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ class BaseMap extends React.Component<Props, State> {
}

private getRegionFeature(slug: string, propertyLayer?: string): Feature | void {
slug = slug === 'eswatini' ? 'swaziland' : slug; // FIXME: please do this the right way. Consult Alex
const layer = propertyLayer || 'national';
const slugProperty = this.propertyLayerSlugMap[layer];
const features: Feature[] = this.map.queryRenderedFeatures({ layers: [ layer ] });
Expand Down Expand Up @@ -350,6 +351,9 @@ class BaseMap extends React.Component<Props, State> {
const pointData: DH.IMapUnit | null = this.getMouseHoverPointData(features);
if (!pointData) {
return !!this.popup && this.popup.remove();
} else if (pointData.slug === 'swaziland') {
pointData.slug = 'eswatini';
pointData.name = 'Eswatini';
}
const countryData = globalData.countries.find(data => data.slug === pointData.slug);
if (countryData && countryData.name !== pointData.name) {
Expand Down Expand Up @@ -405,9 +409,11 @@ class BaseMap extends React.Component<Props, State> {
return false;
}
const slugProperty = this.propertyLayerSlugMap[this.props.paint.propertyLayer || 'national'];
const slug: string | void = feature.properties[slugProperty];
let slug: string | void = feature.properties[slugProperty];
if (!slug || !this.props.meta || !this.props.meta.country) {
return false;
} else if (slug === 'swaziland') {
slug = 'eswatini';
}
const route: Route = countryOrDistrictLink(this.props.meta.country, slug.toLowerCase());
this.setState({ profileLoading: true });
Expand Down
7 changes: 4 additions & 3 deletions src/components/atoms/Timeline/index.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import { storiesOf } from '@storybook/react';
import TimeLine, {Props} from '.';
import TimeLine, { Props } from '.';
import config from '../../visbox/linePartition';
import data from './testData';

Expand All @@ -16,9 +16,10 @@ storiesOf('TimeLine', module).add('Timeline', () => {
axisMinimum: '2013',
axisMaximum: '2018'
},
anchor: { start: '2013'},
anchor: { start: '2013' }
},
onYearChanged: console.info
};
return <div style={{padding: '5em'}}><TimeLine {...props} /></div>;

return <div style={ { padding: '5em' } }><TimeLine { ...props } /></div>;
});
34 changes: 22 additions & 12 deletions src/components/atoms/Timeline/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export interface Props {
config: any;
width?: string;
height?: string;
recreate?: boolean;
onYearChanged(year: string): void;
}

Expand All @@ -28,25 +29,34 @@ class Timeline extends React.Component<Props> {
}

componentDidMount() {
const element = this.element;
const data = this.props.data;
const config = this.props.config;
const chart = draw({ element, data, config });
chart.then(xchart => {
this.chart = xchart;
xchart.onAnchorMoved(this.props.onYearChanged);
});
this.renderChart(this.props);
}

componentWillUpdate(props: Props) {
if (this.chart) {
this.chart.update(props.data);

if (props.config.anchor.start !== this.props.config.anchor.start) {
this.chart.moveAnchor(props.config.anchor.start.toString());
if (props.recreate) {
this.chart.destroy();
this.renderChart(props);
} else {
this.chart.update(props.data);

if (props.config.anchor.start !== this.props.config.anchor.start) {
this.chart.moveAnchor(props.config.anchor.start.toString());
}
}
}
}

private renderChart(props: Props) {
const element = this.element;
const data = props.data;
const config = props.config;
const chart = draw({ element, data, config });
chart.then(xchart => {
this.chart = xchart;
xchart.onAnchorMoved(props.onYearChanged);
});
}
}

export default Timeline;
Loading

0 comments on commit 6b4652f

Please sign in to comment.