Skip to content

Commit

Permalink
feat: Demo Project/fix: duplicate vintage changed to projects
Browse files Browse the repository at this point in the history
  • Loading branch information
SPageot committed Dec 2, 2021
1 parent 5e414d5 commit 6bace11
Show file tree
Hide file tree
Showing 10 changed files with 123 additions and 49 deletions.
8 changes: 4 additions & 4 deletions src/mocks/project-locations.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
[
{
"in_country_region": true,
"in_country_region": "true",
"host_country": "United States"
},
{

"in_country_region": true,
"in_country_region": "true",
"host_country": "United States"
},
{
"in_country_region": false,
"in_country_region": "false",
"host_country": "China"
},
{
"in_country_region": false,
"in_country_region": "false",
"host_country": "Russia"
},
{
Expand Down
2 changes: 1 addition & 1 deletion src/navigation/AppNavigator.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const AppNavigator = () => {
<Pages.Vintages />
</Route>
<Route exact path="/projects">
<Pages.Vintages />
<Pages.Projects />
</Route>
</Suspense>
</Router>
Expand Down
23 changes: 17 additions & 6 deletions src/pages/demo/CoBenefits/index.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,26 @@
import React from 'react';
import { useIntl } from 'react-intl';

import { Card, H3 } from '../../../components';
import React,{useEffect} from 'react';
import { useSelector, useDispatch } from 'react-redux';
import { Card, DataTable } from '../../../components';
import { getCoBenefits } from '../../../store/actions/climateWarehouseActions';

const CoBenefits = () => {
const intl = useIntl();
const dispatch = useDispatch();
const climateWarehouseStore = useSelector(
store => store.climateWarehouse
);

useEffect(() => dispatch(getCoBenefits({ useMockedResponse: true })), []);

return (
<>
<Card>
<H3>{intl.formatMessage({ id: 'hello-world' })}</H3>
<div>Co-Benefits</div>
{climateWarehouseStore.coBenefits && (
<DataTable
headings={['Co-Benefit']}
data={climateWarehouseStore.coBenefits}
/>
)}
</Card>
</>
);
Expand Down
22 changes: 16 additions & 6 deletions src/pages/demo/Locations/index.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
import React from 'react';
import { useIntl } from 'react-intl';

import { Card, H3 } from '../../../components';
import React,{ useEffect } from 'react';
import { useSelector, useDispatch } from 'react-redux';
import { DataTable } from '../../../components';
import { Card } from '../../../components';
import { getProjectLocations } from '../../../store/actions/climateWarehouseActions';

const Locations = () => {
const intl = useIntl();
const dispatch = useDispatch();
const climateWarehouseStore = useSelector( store => store.climateWarehouse);

useEffect(() => dispatch(getProjectLocations({ useMockedResponse: true })), []);

return (
<>
<Card>
<H3>{intl.formatMessage({ id: 'hello-world' })}</H3>
<div>Locations</div>
{climateWarehouseStore.projectLocations && (
<DataTable
headings={['in_country_region', 'host_country']}
data={climateWarehouseStore.projectLocations}
/>
)}
</Card>
</>
);
Expand Down
25 changes: 18 additions & 7 deletions src/pages/demo/Projects/index.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,26 @@
import React from 'react';
import { useIntl } from 'react-intl';

import { Card, H3 } from '../../../components';
import React, { useEffect } from 'react';
import { Card, DataTable } from '../../../components';
import { useSelector, useDispatch } from 'react-redux';
import { projectsResponseStub } from '../../../mocks';
import { getProjects } from '../../../store/actions/climateWarehouseActions';

const Projects = () => {
const intl = useIntl();
const dispatch = useDispatch();
const climateWarehouseStore = useSelector(
store => store.climateWarehouse
);

useEffect(() => dispatch(getProjects({ useMockedResponse: true })), []);
return (
<>
<Card>
<H3>{intl.formatMessage({ id: 'hello-world' })}</H3>
<Card>
<div>Projects</div>
{climateWarehouseStore.projects && (
<DataTable
headings={Object.keys(projectsResponseStub[0])}
data={climateWarehouseStore.projects}
/>
)}
</Card>
</>
);
Expand Down
23 changes: 17 additions & 6 deletions src/pages/demo/Qualifications/index.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,26 @@
import React from 'react';
import { useIntl } from 'react-intl';

import { Card, H3 } from '../../../components';
import React, { useEffect } from 'react';
import { useSelector, useDispatch } from 'react-redux';
import { DataTable } from '../../../components';
import { Card } from '../../../components';
import { qualificationsResponseStub } from '../../../mocks';
import { getQualifications } from '../../../store/actions/climateWarehouseActions';

const Qualifications = () => {
const intl = useIntl();
const dispatch = useDispatch();
const climateWarehouseStore = useSelector(store => store.climateWarehouse);

useEffect(() => dispatch(getQualifications({ useMockedResponse: true })), []);

return (
<>
<Card>
<H3>{intl.formatMessage({ id: 'hello-world' })}</H3>
<div>Qualifications</div>
{climateWarehouseStore.qualifications && (
<DataTable
headings={Object.keys(qualificationsResponseStub[0])}
data={climateWarehouseStore.qualifications}
/>
)}
</Card>
</>
);
Expand Down
1 change: 0 additions & 1 deletion src/pages/demo/Ratings/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React, { useEffect } from 'react';
import { getRatings } from '../../../store/actions/climateWarehouseActions';

import { Card, DataTable } from '../../../components';
import { useSelector, useDispatch } from 'react-redux';

Expand Down
24 changes: 18 additions & 6 deletions src/pages/demo/RelatedProjects/index.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,27 @@
import React from 'react';
import { useIntl } from 'react-intl';

import { Card, H3 } from '../../../components';
import React, { useEffect } from 'react';
import { Card, DataTable } from '../../../components';
import { getRelatedProjects } from '../../../store/actions/climateWarehouseActions';
import { useSelector, useDispatch } from 'react-redux';
import { relatedProjectsResponseStub } from '../../../mocks';

const RelatedProjects = () => {
const intl = useIntl();
const dispatch = useDispatch();
const climateWarehouseStore = useSelector(store => store.climateWarehouse);

useEffect(
() => dispatch(getRelatedProjects({ useMockedResponse: true })),
[],
);
return (
<>
<Card>
<H3>{intl.formatMessage({ id: 'hello-world' })}</H3>
<div>Related Project</div>
{climateWarehouseStore.relatedProjects && (
<DataTable
headings={Object.keys(relatedProjectsResponseStub[0])}
data={climateWarehouseStore.relatedProjects}
/>
)}
</Card>
</>
);
Expand Down
22 changes: 16 additions & 6 deletions src/pages/demo/Units/index.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
import React from 'react';
import { useIntl } from 'react-intl';

import { Card, H3 } from '../../../components';
import React, { useEffect } from 'react';
import { Card, DataTable } from '../../../components';
import { getUnits } from '../../../store/actions/climateWarehouseActions';
import { useSelector, useDispatch } from 'react-redux';
import { unitsResponseStub } from '../../../mocks';

const Units = () => {
const intl = useIntl();
const dispatch = useDispatch();
const climateWarehouseStore = useSelector(store => store.climateWarehouse);

useEffect(() => dispatch(getUnits({ useMockedResponse: true })), []);

return (
<>
<Card>
<H3>{intl.formatMessage({ id: 'hello-world' })}</H3>
<div>Units</div>
{climateWarehouseStore.units && (
<DataTable
headings={Object.keys(unitsResponseStub[0])}
data={climateWarehouseStore.units}
/>
)}
</Card>
</>
);
Expand Down
22 changes: 16 additions & 6 deletions src/pages/demo/Vintages/index.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
import React from 'react';
import { useIntl } from 'react-intl';

import { Card, H3 } from '../../../components';
import React, { useEffect } from 'react';
import { Card, DataTable } from '../../../components';
import { useSelector, useDispatch } from 'react-redux';
import { vintagesResponseStub } from '../../../mocks';
import { getVintages } from '../../../store/actions/climateWarehouseActions';

const Vintages = () => {
const intl = useIntl();
const dispatch = useDispatch();
const climateWarehouseStore = useSelector(store => store.climateWarehouse);

useEffect(() => dispatch(getVintages({ useMockedResponse: true })), []);

return (
<>
<Card>
<H3>{intl.formatMessage({ id: 'hello-world' })}</H3>
<div>Vintages</div>
{climateWarehouseStore.vintages && (
<DataTable
headings={Object.keys(vintagesResponseStub[0])}
data={climateWarehouseStore.vintages}
/>
)}
</Card>
</>
);
Expand Down

0 comments on commit 6bace11

Please sign in to comment.