1- import { NavLink } from "react-router-dom" ;
1+ import { NavLink , useNavigate , useLocation } from "react-router-dom" ;
22import { EDGE_LEGEND } from "../constants/edgeStyles" ;
33
4- const stages = [
5- { path : "/" , label : "Overview" , desc : "Cross-stage data flow" } ,
6- { path : "/stage/0" , label : "Stage 0" , desc : "Raw Data Download" } ,
7- { path : "/stage/1" , label : "Stage 1" , desc : "Base Dataset Construction" } ,
8- { path : "/stage/2" , label : "Stage 2" , desc : "Extended CPS (PUF Clone)" } ,
9- { path : "/stage/3" , label : "Stage 3" , desc : "Stratified CPS" } ,
10- { path : "/stage/4" , label : "Stage 4" , desc : "Source Imputation" } ,
11- { path : "/stage/5" , label : "Stage 5" , desc : "Matrix Build" } ,
12- { path : "/stage/6" , label : "Stage 6" , desc : "Weight Fitting (L0)" } ,
13- { path : "/stage/7" , label : "Stage 7" , desc : "Local Area H5 Build" } ,
14- { path : "/stage/8" , label : "Stage 8" , desc : "Validation & Promotion" } ,
4+ const usStages = [
5+ { path : "/us" , label : "Overview" , desc : "Cross-stage data flow" } ,
6+ { path : "/us/stage/0" , label : "Stage 0" , desc : "Raw Data Download" } ,
7+ { path : "/us/stage/1" , label : "Stage 1" , desc : "Base Dataset Construction" } ,
8+ { path : "/us/stage/2" , label : "Stage 2" , desc : "Extended CPS (PUF Clone)" } ,
9+ { path : "/us/stage/3" , label : "Stage 3" , desc : "Stratified CPS" } ,
10+ { path : "/us/stage/4" , label : "Stage 4" , desc : "Source Imputation" } ,
11+ { path : "/us/stage/5" , label : "Stage 5" , desc : "Matrix Build" } ,
12+ { path : "/us/stage/6" , label : "Stage 6" , desc : "Weight Fitting (L0)" } ,
13+ { path : "/us/stage/7" , label : "Stage 7" , desc : "Local Area H5 Build" } ,
14+ { path : "/us/stage/8" , label : "Stage 8" , desc : "Validation & Promotion" } ,
15+ ] ;
16+
17+ const ukStages = [
18+ { path : "/uk" , label : "Overview" , desc : "Cross-stage data flow" } ,
19+ { path : "/uk/stage/0" , label : "Stage 0" , desc : "Raw Data Download" } ,
20+ { path : "/uk/stage/1" , label : "Stage 1" , desc : "Base Dataset Construction" } ,
21+ { path : "/uk/stage/2" , label : "Stage 2" , desc : "Income Enhancement (SPI)" } ,
22+ { path : "/uk/stage/3" , label : "Stage 3" , desc : "Stratification" , absent : true } ,
23+ { path : "/uk/stage/4" , label : "Stage 4" , desc : "Source Imputation" } ,
24+ { path : "/uk/stage/5" , label : "Stage 5" , desc : "Matrix Build" } ,
25+ { path : "/uk/stage/6" , label : "Stage 6" , desc : "Weight Fitting (Torch)" } ,
26+ { path : "/uk/stage/7" , label : "Stage 7" , desc : "Local Area Calibration" } ,
27+ { path : "/uk/stage/8" , label : "Stage 8" , desc : "Validation & Output" } ,
1528] ;
1629
1730const nodeLegend = [
@@ -22,36 +35,54 @@ const nodeLegend = [
2235 { color : "bg-red-200 border-red-300 border-dashed" , label : "Missing" } ,
2336 { color : "bg-yellow-200 border-yellow-400" , label : "External" } ,
2437 { color : "bg-pink-200 border-pink-400" , label : "US-Specific" } ,
38+ { color : "bg-teal-200 border-teal-400" , label : "UK-Specific" } ,
39+ { color : "bg-gray-100 border-gray-300 border-dashed" , label : "Absent" } ,
2540] ;
2641
2742export default function Sidebar ( ) {
43+ const navigate = useNavigate ( ) ;
44+ const location = useLocation ( ) ;
45+ const isUK = location . pathname . startsWith ( "/uk" ) ;
46+ const country = isUK ? "uk" : "us" ;
47+ const stages = isUK ? ukStages : usStages ;
48+
2849 return (
2950 < aside className = "w-[260px] bg-gray-50 border-r border-gray-200 flex flex-col h-full overflow-y-auto shrink-0" >
3051 < div className = "px-4 py-4 border-b border-gray-200" >
3152 < h1 className = "text-base font-bold text-gray-900 m-0" >
32- PE-US-Data Pipeline
53+ PolicyEngine data pipelines
3354 </ h1 >
34- < p className = "text-[11px] text-gray-500 mt-0.5" >
35- Interactive stage diagrams
36- </ p >
55+ < select
56+ className = "mt-2 w-full text-xs border border-gray-300 rounded px-2 py-1.5 bg-white text-gray-700 focus:outline-none focus:ring-1 focus:ring-blue-400"
57+ value = { country }
58+ onChange = { ( e ) => navigate ( e . target . value === "uk" ? "/uk" : "/us" ) }
59+ >
60+ < option value = "us" > PolicyEngine US</ option >
61+ < option value = "uk" > PolicyEngine UK</ option >
62+ </ select >
3763 </ div >
3864
3965 < nav className = "flex-1 px-2 py-2 space-y-0.5" >
4066 { stages . map ( ( s ) => (
4167 < NavLink
4268 key = { s . path }
4369 to = { s . path }
44- end = { s . path === "/" }
70+ end = { s . path === "/us" || s . path === "/uk "}
4571 className = { ( { isActive } ) =>
4672 `block px-3 py-2 rounded text-xs transition-colors ${
4773 isActive
4874 ? "bg-blue-100 text-blue-900 font-semibold"
49- : "text-gray-700 hover:bg-gray-100"
75+ : s . absent
76+ ? "text-gray-400 hover:bg-gray-100"
77+ : "text-gray-700 hover:bg-gray-100"
5078 } `
5179 }
5280 >
53- < div className = "font-medium text-[13px]" > { s . label } </ div >
54- < div className = "text-[10px] text-gray-500 mt-0.5" >
81+ < div className = { `font-medium text-[13px] ${ s . absent ? "text-gray-400" : "" } ` } >
82+ { s . label }
83+ { s . absent && " (absent)" }
84+ </ div >
85+ < div className = { `text-[10px] mt-0.5 ${ s . absent ? "text-gray-300" : "text-gray-500" } ` } >
5586 { s . desc }
5687 </ div >
5788 </ NavLink >
0 commit comments