Fix static asset paths for /crdc-demo subdirectory deployment
Deploy to git-pages / deploy (push) Successful in 10s

- App.jsx: Use import.meta.env.BASE_URL prefix for civilytics-logo.svg (was hardcoded as '/civilytics-logo.svg' → 404 on pages.civilytics.org/crdc-demo/)
- ChartPanel.jsx: Same fix for /data/national_rates.json path — was causing JSON.parse errors because the 404 HTML response couldn't be parsed
This commit is contained in:
2026-08-10 11:44:26 -04:00
parent 8ba7440a34
commit 2c900b003f
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -47,7 +47,7 @@ export default function App() {
<header className="cv-header cv-wrap">
<a href="/crdc-demo" aria-label="Civilytics" style={{ display: 'block' }}>
<img
src="/civilytics-logo.svg"
src={import.meta.env.BASE_URL + 'civilytics-logo.svg'}
alt="Civilytics — social science for the public good"
className="cv-logo"
onError={(e) => { e.target.style.display = 'none' }}
+1 -1
View File
@@ -23,7 +23,7 @@ export default function ChartPanel({ district, state }) {
// National rates from static fixture (or cache from loading step)
let nat = window.__NATIONAL_RATES__
if (!nat) {
const res = await fetch('/data/national_rates.json')
const res = await fetch(import.meta.env.BASE_URL + 'data/national_rates.json')
nat = await res.json()
}
setNationalRates(nat)