Fix static asset paths for /crdc-demo subdirectory deployment
Deploy to git-pages / deploy (push) Successful in 10s
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:
+1
-1
@@ -47,7 +47,7 @@ export default function App() {
|
|||||||
<header className="cv-header cv-wrap">
|
<header className="cv-header cv-wrap">
|
||||||
<a href="/crdc-demo" aria-label="Civilytics" style={{ display: 'block' }}>
|
<a href="/crdc-demo" aria-label="Civilytics" style={{ display: 'block' }}>
|
||||||
<img
|
<img
|
||||||
src="/civilytics-logo.svg"
|
src={import.meta.env.BASE_URL + 'civilytics-logo.svg'}
|
||||||
alt="Civilytics — social science for the public good"
|
alt="Civilytics — social science for the public good"
|
||||||
className="cv-logo"
|
className="cv-logo"
|
||||||
onError={(e) => { e.target.style.display = 'none' }}
|
onError={(e) => { e.target.style.display = 'none' }}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ export default function ChartPanel({ district, state }) {
|
|||||||
// National rates from static fixture (or cache from loading step)
|
// National rates from static fixture (or cache from loading step)
|
||||||
let nat = window.__NATIONAL_RATES__
|
let nat = window.__NATIONAL_RATES__
|
||||||
if (!nat) {
|
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()
|
nat = await res.json()
|
||||||
}
|
}
|
||||||
setNationalRates(nat)
|
setNationalRates(nat)
|
||||||
|
|||||||
Reference in New Issue
Block a user