Skip to content

Commit a9969a5

Browse files
Add apps folder (for full-screen iframes) and OBBBA explorer placeholder (#2648)
* Add apps folder and first entry * Update with public URL * Address comments * Format
1 parent d522020 commit a9969a5

5 files changed

Lines changed: 66 additions & 0 deletions

File tree

src/PolicyEngine.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
import Donate from "./pages/Donate";
1414
import { useLocation } from "react-router-dom";
1515
import BlogPage from "./pages/BlogPage";
16+
import AppPage from "./pages/AppPage";
1617
import { COUNTRY_BASELINE_POLICIES, COUNTRY_CODES } from "./data/countries";
1718

1819
import { useEffect, useState, lazy, Suspense } from "react";
@@ -344,6 +345,7 @@ export default function PolicyEngine() {
344345
<Route path="benefits" element={<BenefitAccessPage />} />
345346
<Route path="education" element={<EducationPage />} />
346347
<Route path="open-source" element={<OpenSourcePage />} />
348+
<Route path=":appName" element={<AppPage />} />
347349

348350
<Route
349351
path="household/*"

src/apps/appTransformers.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import appsData from "./apps.json";
2+
3+
export const apps = appsData.map((app) => ({
4+
...app,
5+
slug: app.slug || app.title.toLowerCase().replace(/\s+/g, "-"),
6+
}));

src/apps/apps.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[
2+
{
3+
"title": "OBBA household impact explorer",
4+
"description": "Interactive tool to explore household-level impacts of the One Big Beautiful Bill Act",
5+
"url": "https://policyengine.github.io/obbba-scatter",
6+
"slug": "obba-household-explorer",
7+
"tags": ["us", "featured", "policy"]
8+
}
9+
]

src/pages/AppPage.jsx

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import { useParams } from "react-router-dom";
2+
import Header from "../layout/Header";
3+
import Footer from "../layout/Footer";
4+
import { apps } from "../apps/appTransformers";
5+
import { Helmet } from "react-helmet";
6+
7+
export default function AppPage() {
8+
const { appName } = useParams();
9+
10+
const app = apps.find((app) => app.slug === appName);
11+
12+
if (!app) {
13+
return (
14+
<>
15+
<Header />
16+
<div style={{ padding: "50px", textAlign: "center" }}>
17+
<h1>App not found</h1>
18+
<p>The app &ldquo;{appName}&rdquo; could not be found.</p>
19+
</div>
20+
<Footer />
21+
</>
22+
);
23+
}
24+
25+
return (
26+
<>
27+
<Helmet>
28+
<title>{app.title} - PolicyEngine</title>
29+
<meta name="description" content={app.description} />
30+
</Helmet>
31+
<Header />
32+
<div style={{ height: "var(--app-content-height)" }}>
33+
<iframe
34+
src={app.url}
35+
style={{
36+
width: "100%",
37+
height: "100%",
38+
border: "none",
39+
}}
40+
title={app.title}
41+
aria-label={app.description}
42+
/>
43+
</div>
44+
<Footer />
45+
</>
46+
);
47+
}

src/style/App.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ body {
1919

2020
:root {
2121
--bs-body-font-weight: 400;
22+
--header-height: 80px;
23+
--app-content-height: calc(100vh - var(--header-height));
2224
}
2325

2426
.ant-select-selection-item {

0 commit comments

Comments
 (0)