Skip to content

Commit

Permalink
Merge pull request #297 from policy-design-lab/release-1.0.2
Browse files Browse the repository at this point in the history
Release 1.0.2
  • Loading branch information
pengyin-shan authored Jul 23, 2024
2 parents 0f8f845 + 289892f commit 5cf3110
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 40 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [1.0.2] - 2024-07-23

### Fixed
- Fixed the occasional bug where the IRA page failed to load because the summary data was not ready [#293](https://github.com/policy-design-lab/pdl-frontend/issues/293)


## [1.0.1] - 2024-07-19

### Added
Expand Down Expand Up @@ -257,6 +263,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Map data json [#12](https://github.com/policy-design-lab/pdl-frontend/issues/12)
- Final landing page changes for initial milestone [#15](https://github.com/policy-design-lab/pdl-frontend/issues/15)

[1.0.2]: https://github.com/policy-design-lab/pdl-frontend/compare/1.0.1...1.0.2
[1.0.1]: https://github.com/policy-design-lab/pdl-frontend/compare/1.0.0...1.0.1
[1.0.0]: https://github.com/policy-design-lab/pdl-frontend/compare/0.20.0...1.0.0
[0.20.0]: https://github.com/policy-design-lab/pdl-frontend/compare/0.19.0...0.20.0
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "policy-design-lab",
"version": "1.0.1",
"version": "1.0.2",
"description": "the front end of policy design lab",
"repository": "https://github.com/policy-design-lab/pdl-frontend",
"main": "src/app.tsx",
Expand Down
72 changes: 34 additions & 38 deletions src/pages/IRAPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,50 +19,47 @@ export default function IRAPage(): JSX.Element {

// Fetching Data
const [eqipStateDistributionData, setEqipStateDistributionData] = React.useState({});
const [eqipPredictedData, setEqipPredictedDData] = React.useState({});
const [eqipPredictedData, setEqipPredictedData] = React.useState({});
const [eqipSummaryData, setEqipSummaryData] = React.useState({});
const [eqipPracticeNames, setEqipPracticeNames] = React.useState({});
const [stateCodesData, setStateCodesData] = React.useState({});
const [stateCodesArray, setStateCodesArray] = React.useState({});
const [allStatesData, setAllStatesData] = React.useState([]);
const [zeroCategories, setZeroCategories] = React.useState([]);
const [totalAcep, setTotalAcep] = React.useState(0);
React.useEffect(() => {
const allstates_url = `${config.apiUrl}/states`;
getJsonDataFromUrl(allstates_url).then((response) => {
setAllStatesData(response);
});

const statecode_url = `${config.apiUrl}/statecodes`;
getJsonDataFromUrl(statecode_url).then((response) => {
setStateCodesArray(response);
const converted_json = convertAllState(response);
setStateCodesData(converted_json);
});

// eqip IRA data
const eqip_statedistribution_url = `${config.apiUrl}/titles/title-ii/programs/eqip-ira/state-distribution`;
getJsonDataFromUrl(eqip_statedistribution_url).then((response) => {
setEqipStateDistributionData(response);
});
const eqip_predicted_url = `${config.apiUrl}/titles/title-ii/programs/eqip-ira/predicted`;
getJsonDataFromUrl(eqip_predicted_url).then((response) => {
setEqipPredictedDData(response);
});
const eqip_summary_url = `${config.apiUrl}/titles/title-ii/programs/eqip-ira/summary`;
getJsonDataFromUrl(eqip_summary_url).then((response) => {
setEqipSummaryData(response);
});
const eqip_practicenames_url = `${config.apiUrl}/titles/title-ii/programs/eqip-ira/practice-names`;
getJsonDataFromUrl(eqip_practicenames_url).then((response) => {
setEqipPracticeNames(response);
});
const [isDataReady, setIsDataReady] = React.useState(false);

// csp IRA data

// rccp IRA data

// acep IRA data
React.useEffect(() => {
const fetchData = async () => {
try {
const [
allStatesResponse,
stateCodesResponse,
eqipStateDistributionResponse,
eqipPredictedResponse,
eqipSummaryResponse,
eqipPracticeNamesResponse
] = await Promise.all([
getJsonDataFromUrl(`${config.apiUrl}/states`),
getJsonDataFromUrl(`${config.apiUrl}/statecodes`),
getJsonDataFromUrl(`${config.apiUrl}/titles/title-ii/programs/eqip-ira/state-distribution`),
getJsonDataFromUrl(`${config.apiUrl}/titles/title-ii/programs/eqip-ira/predicted`),
getJsonDataFromUrl(`${config.apiUrl}/titles/title-ii/programs/eqip-ira/summary`),
getJsonDataFromUrl(`${config.apiUrl}/titles/title-ii/programs/eqip-ira/practice-names`)
]);
setAllStatesData(allStatesResponse);
setStateCodesArray(stateCodesResponse);
setStateCodesData(convertAllState(stateCodesResponse));
setEqipStateDistributionData(eqipStateDistributionResponse);
setEqipPredictedData(eqipPredictedResponse);
setEqipSummaryData(eqipSummaryResponse);
setEqipPracticeNames(eqipPracticeNamesResponse);
setIsDataReady(true);
} catch (error) {
console.error("Error fetching data:", error);
}
};
fetchData();
}, []);

// Modal
Expand Down Expand Up @@ -112,8 +109,7 @@ export default function IRAPage(): JSX.Element {
</Tabs>
</Box>
{/* NOTE: Because of divider, the index are increased by 2 */}
{Object.keys(eqipStateDistributionData).length > 0 &&
Object.keys(stateCodesData).length > 0 ? (
{isDataReady ? (
<span>
<TabPanel
v={value}
Expand Down

0 comments on commit 5cf3110

Please sign in to comment.