Skip to content

Commit

Permalink
Merge pull request PolicyEngine#1099 from anth-volk/fix/hide_cliff_im…
Browse files Browse the repository at this point in the history
…pacts

Hide cliff impacts page in reform calculator flow
  • Loading branch information
MaxGhenis authored Jan 2, 2024
2 parents e69d234 + 4bd7940 commit d255aea
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 8 deletions.
28 changes: 23 additions & 5 deletions src/pages/policy/output/FetchAndDisplayImpact.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
import { useEffect, useState } from "react";
import { DisplayError, DisplayImpact, DisplayWait } from "./Display";
import {
DisplayError,
DisplayImpact,
DisplayWait,
LowLevelDisplay,
} from "./Display";
import { useSearchParams } from "react-router-dom";
import { asyncApiCall, copySearchParams, apiCall } from "../../../api/call";
import LoadingCentered from "layout/LoadingCentered";
import ErrorPage from "layout/Error";
// import LoadingCentered from "layout/LoadingCentered";

/**
*
Expand Down Expand Up @@ -152,13 +158,16 @@ export function FetchAndDisplayCliffImpact(props) {
const timePeriod = searchParams.get("timePeriod");
const reformPolicyId = searchParams.get("reform");
const baselinePolicyId = searchParams.get("baseline");

// Remove the following eslint ignore when cliff impacts are restored
// eslint-disable-next-line no-unused-vars
const [impact, setImpact] = useState(null);
const [error, setError] = useState(null);
const {
metadata,
policy,
hasShownPopulationImpactPopup,
setHasShownPopulationImpactPopup,
// policy,
// hasShownPopulationImpactPopup,
// setHasShownPopulationImpactPopup,
} = props;
useEffect(() => {
if (!!region && !!timePeriod && !!reformPolicyId && !!baselinePolicyId) {
Expand Down Expand Up @@ -202,6 +211,14 @@ export function FetchAndDisplayCliffImpact(props) {
return <DisplayError error={error} />;
}

// Remove the below block when cliff impacts are reinstated
return (
<LowLevelDisplay {...props}>
<ErrorPage message="This service is temporarily unavailable. Please try again later." />
</LowLevelDisplay>
);

/*
if (!impact) {
return <LoadingCentered message="Computing the cliff impact..." />;
}
Expand All @@ -215,4 +232,5 @@ export function FetchAndDisplayCliffImpact(props) {
setHasShownPopulationImpactPopup={setHasShownPopulationImpactPopup}
/>
);
*/
}
6 changes: 3 additions & 3 deletions src/pages/policy/output/ImpactTypes.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import averageImpactByDecile from "./AverageImpactByDecile";
import averageImpactByWealthDecile from "./AverageImpactByWealthDecile";
import budgetaryImpact from "./BudgetaryImpact";
import cliffImpact from "./CliffImpact";
// import cliffImpact from "./CliffImpact";
import deepPovertyImpact from "./DeepPovertyImpact";
import deepPovertyImpactByGender from "./DeepPovertyImpactByGender";
import detailedBudgetaryImpact from "./DetailedBudgetaryImpact";
Expand Down Expand Up @@ -31,7 +31,7 @@ export const impactLabels = {
genderDeepPovertyImpact: "Deep poverty impact by sex",
racialPovertyImpact: "Poverty impact by race and ethnicity",
inequalityImpact: "Income inequality impact",
cliffImpact: "Cliff impact",
// cliffImpact: "Cliff impact",
codeReproducibility: "Reproduce in Python",
analysis: "Analysis",
};
Expand All @@ -52,7 +52,7 @@ const map = {
genderDeepPovertyImpact: deepPovertyImpactByGender,
racialPovertyImpact: povertyImpactByRace,
inequalityImpact: inequalityImpact,
cliffImpact: cliffImpact,
// cliffImpact: cliffImpact,
};

// get representations of the impact as a chart and a csv. The returned object
Expand Down

0 comments on commit d255aea

Please sign in to comment.