MCPcopy Create free account
hub / github.com/OpenSIST/OpenSIST.github.io / ProgramList

Function ProgramList

src/Components/ProgramPage/SideBar/SideBar.jsx:96–140  ·  view source on GitHub ↗
({univProgram, selectProgram, setSelectProgram, ButtonComponent})

Source from the content-addressed store, hash-verified

94}
95
96export function ProgramList({univProgram, selectProgram, setSelectProgram, ButtonComponent}) {
97 const univName = univProgram[0];
98 const programList = univProgram[1];
99 const hasPrograms = programList.length > 0;
100 const [isFolded, setIsFolded] = React.useState(!hasPrograms);
101 const region = programList[0]?.Region ?? univRegionMapping[univName] ?? [];
102 const flags = region.map((r) => regionFlagMapping[r]).filter(Boolean).join(' ');
103 return (
104 <>
105 <ListItemButton
106 onClick={() => setIsFolded(!isFolded)}
107 >
108 {isFolded ? <ExpandMore fontSize="0.9em"/> : <NavigateNext fontSize="0.9em"/>}
109 <ListItemText
110 primary={
111 <Box sx={{display: 'flex', justifyContent: 'space-between'}}>
112 <Typography>{univName}</Typography>
113 <Typography>{flags}</Typography>
114 </Box>
115 }
116 secondary={
117 <Typography variant='subtitle1' sx={{fontSize: 'clamp(11px, 1.5vw, 13px)', color: 'text.secondary'}}>
118 {univAbbrFullNameMapping[univName]}
119 </Typography>
120 }/>
121
122 </ListItemButton>
123 <Divider component="li" light/>
124 <Collapse in={isFolded} timeout='auto' unmountOnExit>
125 <List component="div" disablePadding>
126 {
127 hasPrograms ? programList.map((program) => (
128 <ButtonComponent
129 program={program}
130 selectProgram={selectProgram}
131 setSelectProgram={setSelectProgram}
132 key={program.ProgramID}
133 />
134 )) : <EmptyProgramButton univName={univName}/>
135 }
136 </List>
137 </Collapse>
138 </>
139 )
140}
141
142function EmptyProgramButton({univName}) {
143 return (

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected