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

Function ProgramCard

src/Components/Favorites/ProgramCard.jsx:8–89  ·  view source on GitHub ↗
({program})

Source from the content-addressed store, hash-verified

6import {favoritesProgramPath} from "../RouteUtils";
7
8const ProgramCard = ({program}) => {
9 const navigate = useNavigate();
10
11 const color = univColorMapping[program.University] ?? [85, 221, 128];
12 const flags = (program.Region ?? []).map((r) => regionFlagMapping[r]).join(" ");
13 const majors = program.TargetApplicantMajor ?? [];
14
15 return (
16 <Paper
17 elevation={0}
18 onClick={() =>
19 navigate(`${favoritesProgramPath(program.ProgramID)}${window.location.search}`)
20 }
21 sx={{
22 position: "relative",
23 cursor: "pointer",
24 borderRadius: 3,
25 p: 2,
26 minHeight: 150,
27 display: "flex",
28 flexDirection: "column",
29 gap: 0.5,
30 bgcolor: (theme) => theme.palette.surface,
31 borderLeft: `4px solid rgb(${color})`,
32 transition: "transform 0.15s ease, box-shadow 0.15s ease",
33 "&:hover": {
34 transform: "translateY(-2px)",
35 boxShadow: "0 6px 16px rgba(16,24,40,0.10)",
36 },
37 }}
38 >
39 <Box sx={{display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: 1}}>
40 <Box sx={{minWidth: 0}}>
41 <Typography variant="h6" sx={{fontWeight: 700, lineHeight: 1.2}}>
42 {program.University}
43 </Typography>
44 <Typography variant="caption" sx={{color: "text.secondary"}} noWrap component="div">
45 {univAbbrFullNameMapping[program.University]}
46 </Typography>
47 </Box>
48 <Box sx={{display: "flex", alignItems: "center", gap: 0.5, flexShrink: 0}}>
49 {flags ? <Typography variant="body2">{flags}</Typography> : null}
50 <Form method="post">
51 <input type="hidden" name="ActionType" value="UnStar"/>
52 <input type="hidden" name="ProgramID" value={program.ProgramID}/>
53 <Tooltip title="取消收藏" arrow>
54 <IconButton
55 type="submit"
56 size="small"
57 onClick={(e) => e.stopPropagation()}
58 sx={{color: "text.secondary", "&:hover": {color: "primary.main"}}}
59 >
60 <BookmarkRemoveOutlined fontSize="small"/>
61 </IconButton>
62 </Tooltip>
63 </Form>
64 </Box>
65 </Box>

Callers

nothing calls this directly

Calls 1

favoritesProgramPathFunction · 0.90

Tested by

no test coverage detected