-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #85 from tech-for-better/81-D3-LMI4all
81 d3 lmi4all
- Loading branch information
Showing
12 changed files
with
172 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
import React from 'react'; | ||
import styled from 'styled-components'; | ||
|
||
// import Card from 'react-bootstrap/esm/Card'; | ||
// import { CardGroupStyle, StyledCard } from '../../../templates/sharedStyles.styles'; | ||
// import Graph1 from '../../../assets/temp/lc1.png'; | ||
// import Graph2 from '../../../assets/temp/lc2.png'; | ||
// import Graph3 from '../../../assets/temp/dc.png'; | ||
// import DonutChart from '../d3charts/d3donutChart'; | ||
// import SparklineChart from '../../d3charts/d3areaChart'; | ||
|
||
import EstimatedPay from './EstimatedPay'; | ||
import WorkingFuturesPrediction from './WorkingFuturesPrediction'; | ||
import WorkingFuturesReplacemendDemand from './WorkingFuturesReplacementDemand'; | ||
|
||
// const ReverseCardGroupStyle = styled(CardGroupStyle)` | ||
// grid-template-columns: 35% 60%; | ||
// `; | ||
// const GraphImg = styled.img` | ||
// width: 100%; | ||
// `; | ||
const Charts: React.FC<{ soc: string; name: string }> = ({ soc, name }) => { | ||
return ( | ||
<div> | ||
<WorkingFuturesPrediction soc={soc} /> | ||
<WorkingFuturesReplacemendDemand soc={soc} /> | ||
<EstimatedPay soc={soc} /> | ||
</div> | ||
); | ||
// ); | ||
// return ( | ||
// <div className="mb-5"> | ||
// <h2 className="mb-4"> | ||
// Statistical Data About <strong>{name}</strong> | ||
// </h2> | ||
// <ReverseCardGroupStyle className="mb-5 mt-5"> | ||
// <div style={{ width: `100%` }}> | ||
// <StyledCard className="mb-3"> | ||
// <Card.Body> | ||
// <Card.Title className="mb-4"> | ||
// <strong>Average Salary</strong> | ||
// </Card.Title> | ||
// <GraphImg src={Graph1} /> | ||
// {/* {lmiData.loading ? ( | ||
// `loading` | ||
// ) : ( | ||
// <SparklineChart estimatePay={lmiData.lmiData.estimatePay} /> | ||
// )} */} | ||
// </Card.Body> | ||
// </StyledCard> | ||
// <StyledCard> | ||
// <Card.Body> | ||
// <Card.Title className="mb-4"> | ||
// <strong>Employment Rate</strong> | ||
// </Card.Title> | ||
// <GraphImg src={Graph2} /> | ||
// </Card.Body> | ||
// </StyledCard> | ||
// </div> | ||
// <StyledCard> | ||
// <Card.Body> | ||
// <Card.Title className="mb-4"> | ||
// <strong>Courses taken to become {name}</strong> | ||
// </Card.Title> | ||
// <GraphImg src={Graph3} /> | ||
// </Card.Body> | ||
// </StyledCard> | ||
// </ReverseCardGroupStyle> | ||
// <p> | ||
// <StyledCard> | ||
// <Card.Body> | ||
// <Card.Title className="mb-4"> | ||
// <strong> | ||
// Another card that has infomration about current number of vacancies, replacemenet | ||
// demand with a number over ceratin time of years. top skills in demand to become | ||
// {` `} | ||
// {name}. | ||
// </strong> | ||
// <WorkingFutures soc={soc} /> | ||
// <EstimatedPay /> | ||
// </Card.Title> | ||
// </Card.Body> | ||
// </StyledCard> | ||
// </p> | ||
// <p> | ||
// <StyledCard> | ||
// <Card.Body> | ||
// <Card.Title className="mb-4"> | ||
// <strong>predicted Employment</strong> | ||
// <DonutChart /> | ||
// </Card.Title> | ||
// </Card.Body> | ||
// </StyledCard> | ||
// </p> | ||
// </div> | ||
// ); | ||
}; | ||
|
||
export default Charts; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import React, { useState } from 'react'; | ||
import useSOC from './useSOC'; | ||
|
||
const EstimatedPay: React.FC<{ soc: string }> = ({ soc }) => { | ||
const [estimatedPay, setEstimatedPay] = useState(``); | ||
const [, setError] = useState(``); | ||
|
||
useSOC({ soc, endpoint: `/ashe/estimatePay`, setter: setEstimatedPay, setError }); | ||
|
||
return ( | ||
<p> | ||
{estimatedPay?.data?.series?.reduce((acc, year) => { | ||
return acc + year.estpay; | ||
}, 0) / estimatedPay?.data?.series?.length || null} | ||
</p> | ||
); | ||
}; | ||
|
||
export default EstimatedPay; |
12 changes: 12 additions & 0 deletions
12
src/components/careerPath/charts/WorkingFuturesPrediction.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import React, { useState } from 'react'; | ||
import useSOC from './useSOC'; | ||
|
||
const WorkingFuturesPrediction: React.FC<{ soc: string }> = ({ soc }) => { | ||
const [, setWfData] = useState(``); | ||
const [, setError] = useState(``); | ||
|
||
useSOC({ soc, endpoint: `/wf/predict`, setter: setWfData, setError }); | ||
return <p>{soc}</p>; | ||
}; | ||
|
||
export default WorkingFuturesPrediction; |
23 changes: 23 additions & 0 deletions
23
src/components/careerPath/charts/WorkingFuturesReplacementDemand.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import React, { useState } from 'react'; | ||
import useSOC from './useSOC'; | ||
|
||
const WorkingFuturesReplacementDemand: React.FC<{ soc: string }> = ({ soc }) => { | ||
const [wfData, setWfData] = useState(``); | ||
const [, setError] = useState(``); | ||
|
||
useSOC({ soc, endpoint: `/wf/replacement_demand`, setter: setWfData, setError }); | ||
|
||
if (wfData) { | ||
const { start_year, end_year, rate } = wfData?.data; | ||
return ( | ||
<p> | ||
Between {start_year} and {end_year} the rate of replacement for {soc} is predicted to be | ||
{rate}. | ||
</p> | ||
); | ||
} | ||
|
||
return <p />; | ||
}; | ||
|
||
export default WorkingFuturesReplacementDemand; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { useEffect } from 'react'; | ||
import axios from 'axios'; | ||
|
||
const apiBaseUrl = `http://api.lmiforall.org.uk/api/v1`; | ||
|
||
export default function useSOC({ endpoint, soc, setter, setError }) { | ||
useEffect(() => { | ||
axios.get(`${apiBaseUrl + endpoint}?soc=${soc}`).then((res) => { | ||
setter(res); | ||
}); | ||
}, [endpoint, soc, setter, setError]); | ||
} |
4 changes: 2 additions & 2 deletions
4
src/components/d3charts/d3areaChart.tsx → ...nents/careerPath/d3charts/d3areaChart.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters