Skip to content

Commit 115dd1d

Browse files
authored
Merge pull request #2694 from PolicyEngine/redirect-obbba-household-explorer
Redirect obbba-household-explorer to obbba-household-by-household
2 parents deaa5d3 + aff4664 commit 115dd1d

9 files changed

Lines changed: 54 additions & 29 deletions

src/PolicyEngine.jsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ import style from "./style";
4444
import RedirectToCountry from "./routing/RedirectToCountry";
4545
import CountryIdLayout from "./routing/CountryIdLayout";
4646
import RedirectBlogPost from "./routing/RedirectBlogPost";
47+
import RedirectOBBBAHouseholdExplorer from "./routing/RedirectOBBBAHouseholdExplorer";
4748
import { StatusPage } from "./pages/StatusPage";
4849
import ManifestosComparison from "./applets/ManifestosComparison";
4950
import DeveloperLayout from "./pages/DeveloperLayout";
@@ -386,6 +387,11 @@ export default function PolicyEngine() {
386387
/>
387388
{/* redirect from /countryId/blog/slug to /countryId/research/slug */}
388389
<Route path="blog/:postName" element={<RedirectBlogPost />} />
390+
{/* redirect from old obbba-household-explorer to obbba-household-by-household */}
391+
<Route
392+
path="obbba-household-explorer"
393+
element={<RedirectOBBBAHouseholdExplorer />}
394+
/>
389395
</Route>
390396
<Route path="/uk/cec" element={<CitizensEconomicCouncil />} />
391397
<Route path="/uk/2024-manifestos" element={<ManifestosComparison />} />

src/applets/OBBBAHouseholdExplorer.jsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import style from "../style";
44
import { useWindowHeight } from "../hooks/useWindow";
55
import { useEffect, useRef, useMemo } from "react";
66
import { useNavigate, useLocation } from "react-router-dom";
7-
import config from "../config/environment";
87

98
export default function OBBBAHouseholdExplorer() {
109
const windowHeight = useWindowHeight();
@@ -13,7 +12,11 @@ export default function OBBBAHouseholdExplorer() {
1312
const iframeRef = useRef(null);
1413

1514
// Memoize baseUrl to prevent unnecessary re-renders
16-
const baseUrl = useMemo(() => config.OBBBA_IFRAME_URL, []);
15+
// Hardcoding URL to bypass any build/environment issues
16+
const baseUrl = useMemo(
17+
() => "https://policyengine.github.io/obbba-scatter",
18+
[],
19+
);
1720

1821
// Memoize iframe origin for efficient message verification
1922
const iframeOrigin = useMemo(() => new URL(baseUrl).origin, [baseUrl]);
@@ -26,6 +29,14 @@ export default function OBBBAHouseholdExplorer() {
2629
? `${baseUrl}?${urlParams.toString()}`
2730
: baseUrl;
2831

32+
// Debug logging
33+
console.log("OBBBA Explorer Debug:", {
34+
baseUrl,
35+
locationSearch: location.search,
36+
urlParams: urlParams.toString(),
37+
finalIframeUrl: iframeUrl,
38+
});
39+
2940
useEffect(() => {
3041
// Listen for messages from the iframe
3142
const handleMessage = (event) => {

src/apps/apps.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"title": "OBBBA household impact explorer",
44
"description": "Interactive tool to explore household-level impacts of the One Big Beautiful Bill Act",
55
"url": "https://policyengine.github.io/obbba-scatter",
6-
"slug": "obbba-household-explorer",
6+
"slug": "obbba-household-by-household",
77
"tags": ["us", "featured", "policy"]
88
}
99
]

src/config/environment.js

Lines changed: 0 additions & 24 deletions
This file was deleted.

src/images/posts/introducing-obbba-household-explorer.png renamed to src/images/posts/introducing-obbba-household-by-household.png

File renamed without changes.

src/posts/articles/introducing-obbba-household-explorer.md renamed to src/posts/articles/introducing-obbba-household-by-household.md

File renamed without changes.

src/posts/posts.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
"description": "New interactive tool reveals household-level impacts of the One Big Beautiful Bill Act.",
1414
"date": "2025-07-03",
1515
"tags": ["us", "policy", "featured", "reconciliation"],
16-
"filename": "introducing-obbba-household-explorer.md",
17-
"image": "introducing-obbba-household-explorer.png",
16+
"filename": "introducing-obbba-household-by-household.md",
17+
"image": "introducing-obbba-household-by-household.png",
1818
"authors": ["max-ghenis", "pavel-makarchuk", "elena-cura"]
1919
},
2020
{
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { Navigate, useParams } from "react-router-dom";
2+
3+
export default function RedirectOBBBAHouseholdExplorer() {
4+
const { countryId } = useParams();
5+
6+
return <Navigate to={`/${countryId}/obbba-household-by-household`} replace />;
7+
}

test-iframe.html

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<!doctype html>
2+
<html>
3+
<head>
4+
<title>Test OBBBA Iframe</title>
5+
</head>
6+
<body>
7+
<h1>Testing OBBBA Iframe URL Construction</h1>
8+
9+
<p>Direct iframe with query parameters:</p>
10+
<iframe
11+
src="https://policyengine.github.io/obbba-scatter?household=46067&baseline=tcja-expiration"
12+
width="100%"
13+
height="600"
14+
style="border: 2px solid red"
15+
>
16+
</iframe>
17+
18+
<script>
19+
console.log(
20+
"Iframe URL:",
21+
"https://policyengine.github.io/obbba-scatter?household=46067&baseline=tcja-expiration",
22+
);
23+
</script>
24+
</body>
25+
</html>

0 commit comments

Comments
 (0)