Fix chart sizing, model predictions, 90% intervals, and deep link district name
Deploy to git-pages / deploy (push) Successful in 17s
Deploy to git-pages / deploy (push) Successful in 17s
- Increase SVG dimensions in all 6 charts to prevent label truncation - Fix ModelDrawsComparison: pass quadData so predictions render for three-year models - Change error bars from 95% to 90% (legend text + SD calculation) - Widen chart viewport: max-width 70rem vs default 60rem text width - Fix deep link: fetch district name from API instead of showing 'Loading...'
This commit is contained in:
+18
-4
@@ -4,6 +4,7 @@ import DistrictSearch from './components/DistrictSearch.jsx'
|
||||
import LoadingAnimation from './components/LoadingAnimation.jsx'
|
||||
import ChartPanel from './components/ChartPanel.jsx'
|
||||
import Footer from './components/Footer.jsx'
|
||||
import { searchDistricts } from './hooks/useApi.js'
|
||||
|
||||
/**
|
||||
* CRDC Arrests API Demo App — main router.
|
||||
@@ -20,11 +21,24 @@ export default function App() {
|
||||
const leaid = params.get('leaid')
|
||||
const stateParam = params.get('state')
|
||||
if (leaid && stateParam) {
|
||||
// Deep link: skip straight to loading → results.
|
||||
// We need to fetch the district name since we only have LEAID from URL.
|
||||
// Deep link: fetch district name first, then go to loading.
|
||||
setSelectedState(stateParam)
|
||||
setDistrict({ leaid, lea_name: 'Loading…', state: stateParam })
|
||||
setStep('loading')
|
||||
|
||||
// Fetch district name from API
|
||||
searchDistricts(leaid, stateParam).then(results => {
|
||||
const district = results?.find(d => d.leaid === leaid)
|
||||
if (district) {
|
||||
setDistrict(district)
|
||||
} else {
|
||||
// Fallback if district not found
|
||||
setDistrict({ leaid, lea_name: 'Unknown District', state: stateParam })
|
||||
}
|
||||
setStep('loading')
|
||||
}).catch(() => {
|
||||
// Fallback on error
|
||||
setDistrict({ leaid, lea_name: 'Unknown District', state: stateParam })
|
||||
setStep('loading')
|
||||
})
|
||||
}
|
||||
}, [])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user