Skip to content

Commit

Permalink
Merge pull request #314 from policy-design-lab/release-1.0.4
Browse files Browse the repository at this point in the history
Release 1.0.4
  • Loading branch information
pengyin-shan authored Aug 16, 2024
2 parents 13cf0b9 + 56a90c5 commit e4ea316
Show file tree
Hide file tree
Showing 11 changed files with 297 additions and 139 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@ 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.4] - 2024-08-16

### Added
- Added the top info session for IRA page [#309](https://github.com/policy-design-lab/pdl-frontend/issues/309)
- Added "Other CSP" statues and related categories to the CSP pages [#303](https://github.com/policy-design-lab/pdl-frontend/issues/303)
- Added null value handling for the latest CSP data [#301](https://github.com/policy-design-lab/pdl-frontend/issues/301)

### Changed
- Changed the "Other Improvement" in the EQIP page categories to "Other Improvements" [#311](https://github.com/policy-design-lab/pdl-frontend/issues/311)
- Updated CSP category list to match latest data [#305](https://github.com/policy-design-lab/pdl-frontend/issues/305)
- Updated the color legends for the EQIP and CSP maps to match latest data [#304](https://github.com/policy-design-lab/pdl-frontend/issues/304)

## [1.0.3] - 2024-08-01

### Fixed
Expand Down Expand Up @@ -268,6 +280,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.4]: https://github.com/policy-design-lab/pdl-frontend/compare/1.0.3...1.0.4
[1.0.3]: https://github.com/policy-design-lab/pdl-frontend/compare/1.0.2...1.0.3
[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
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.3",
"version": "1.0.4",
"description": "the front end of policy design lab",
"repository": "https://github.com/policy-design-lab/pdl-frontend",
"main": "src/app.tsx",
Expand Down
19 changes: 12 additions & 7 deletions src/components/ProgramDrawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ function EQIPCheckboxList({ setEQIPChecked, setShowPopUp, zeroCategory }) {
"Structural",
"Soil remediation",
"Vegetative",
"Other improvement",
"Other improvements",
"Soil testing",
"Other planning",
"Conservation planning assessment",
Expand Down Expand Up @@ -297,24 +297,28 @@ function CSPCheckboxList({ setCSPChecked, setShowPopUp, zeroCategory }) {
// Match PR89 suggestions
const CSPList = [
"Total CSP Benefits",

"2018 Practices",
"Structural",
"Vegetative",
"Land management",
"Forest management",
"Soil remediation",
"Existing activity payments",
"Bundles",
"Soil testing",
"Other improvement",
"Other improvements",

"2014 Eligible Land",
"Cropland",
"Grassland",
"Rangeland",
"Pastureland",
"Non-industrial private forestland",
"Other: supplemental, adjustment & other"
"Non-Industrial Private Forestland (NIPF)",

"Other CSP",
"Miscellaneous",
"Bundles",
"(6)(B) Planning"
];
const classes = useStyles();
return (
Expand Down Expand Up @@ -349,7 +353,8 @@ function CSPCheckboxList({ setCSPChecked, setShowPopUp, zeroCategory }) {
if (
category !== "2018 Practices" &&
category !== "2014 Eligible Land" &&
category !== "Total CSP Benefits"
category !== "Total CSP Benefits" &&
category !== "Other CSP"
) {
return (
<ListItem key={category} disablePadding>
Expand Down Expand Up @@ -400,7 +405,7 @@ function CSPCheckboxList({ setCSPChecked, setShowPopUp, zeroCategory }) {
</ListItem>
);
}
if (category === "2018 Practices" || category === "2014 Eligible Land") {
if (category === "2018 Practices" || category === "2014 Eligible Land" || category === "Other CSP") {
return (
<Box key={category}>
<ListItem key={category} disablePadding>
Expand Down
21 changes: 17 additions & 4 deletions src/components/csp/CategoryMap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,25 @@ const MapChart = (props) => {
const AArray = ACur.practiceCategories;
const BCur = statuteRecord.find((s) => s.statuteName === "2014 Eligible Land");
const BArray = BCur.practiceCategories;
const TotalArray = AArray.concat(BArray);
const CCur = statuteRecord.find((s) => s.statuteName === "Other CSP");
const CArray = CCur.practiceCategories;
const TotalArray = AArray.concat(BArray).concat(CArray);
if (category === "2018 Practices") {
categoryRecord = statuteRecord[0];
} else if (category === "2014 Eligible Land") {
categoryRecord = statuteRecord[1];
} else if (category === "Other CSP") {
categoryRecord = statuteRecord[2];
} else {
categoryRecord = TotalArray.find((s) => s.practiceCategoryName === category);
}
if (categoryRecord === undefined) {
return null;
}
const categoryPayment = categoryRecord.totalPaymentInDollars;
const nationwidePercentage = categoryRecord.totalPaymentInPercentageNationwide;
const nationwidePercentage = categoryRecord.totalPaymentInPercentageNationwide
? categoryRecord.totalPaymentInPercentageNationwide
: categoryRecord.totalPaymentInPercentage;
const hoverContent = (
<div className="map_tooltip">
<div className={classes.tooltip_header}>
Expand Down Expand Up @@ -182,11 +191,15 @@ const CategoryMap = ({
const AArray = ACur.practiceCategories;
const BCur = statuteRecord.find((s) => s.statuteName === "2014 Eligible Land");
const BArray = BCur.practiceCategories;
const TotalArray = AArray.concat(BArray);
const CCur = statuteRecord.find((s) => s.statuteName === "Other CSP");
const CArray = CCur.practiceCategories;
const TotalArray = AArray.concat(BArray).concat(CArray);
if (category === "2018 Practices") {
categoryRecord = statuteRecord[0];
} else if (category === "2014 Eligible Land") {
categoryRecord = statuteRecord[1];
} else if (category === "Other CSP") {
categoryRecord = statuteRecord[2];
} else {
categoryRecord = TotalArray.find((s) => s.practiceCategoryName === category);
}
Expand All @@ -201,7 +214,7 @@ const CategoryMap = ({
if (category === "Land management") legendCategory = "Land management-CSP";
if (category === "Forest management") legendCategory = "Forest management-CSP";
if (category === "Soil testing") legendCategory = "Soil testing-CSP";
if (category === "Other improvement") legendCategory = "Other improvement-CSP";
if (category === "Other improvements") legendCategory = "Other improvements-CSP";
const customScale = legendConfig[legendCategory];
const colorScale = d3.scaleThreshold(customScale, mapColor);
const classes = useStyles();
Expand Down
10 changes: 8 additions & 2 deletions src/components/csp/CategoryTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,15 @@ function App({
const AArray = ACur.practiceCategories;
const BCur = value.statutes.find((s) => s.statuteName === "2014 Eligible Land");
const BArray = BCur.practiceCategories;
const TotalArray = AArray.concat(BArray);
const CCur = value.statutes.find((s) => s.statuteName === "Other CSP");
const CArray = CCur.practiceCategories;
const TotalArray = AArray.concat(BArray).concat(CArray);
if (category === "2018 Practices") {
categoryRecord = statuteRecord[0];
} else if (category === "2014 Eligible Land") {
categoryRecord = statuteRecord[1];
} else if (category === "Other CSP") {
categoryRecord = statuteRecord[2];
} else {
categoryRecord = TotalArray.find((s) => s.practiceCategoryName === category);
}
Expand All @@ -171,7 +175,9 @@ function App({
categoryBenefit: `$${Number(totalPaymentInDollars).toLocaleString(undefined, {
minimumFractionDigits: 2
})}`,
categoryPercentage: `${totalPaymentInPercentageWithinState.toString()}%`,
categoryPercentage: totalPaymentInPercentageWithinState
? `${totalPaymentInPercentageWithinState.toString()}%`
: "0%",
cspBenefit: `$${value.totalPaymentInDollars.toLocaleString(undefined, {
minimumFractionDigits: 2
})}`,
Expand Down
Loading

0 comments on commit e4ea316

Please sign in to comment.