Open
Conversation
ARtheboss
reviewed
Mar 4, 2026
Comment on lines
62
to
241
| ratingsCount?: number | null; | ||
| aggregatedRatings?: { | ||
| metrics: Array<{ metricName: string; weightedAverage: number }>; | ||
| } | null; | ||
| }; | ||
|
|
||
| type EnrollmentSnapshot = Pick< | ||
| IEnrollmentSingular, | ||
| "enrolledCount" | "maxEnroll" | "endTime" | "activeReservedMaxCount" | ||
| >; | ||
|
|
||
| type ClassCardClass = Partial<BaseClassFields> & { | ||
| year?: number; | ||
| semester?: Semester; | ||
| course?: Partial<CourseSummary> | null; | ||
| primarySection?: { | ||
| enrollment?: { | ||
| latest?: Partial<EnrollmentSnapshot> | null; | ||
| } | null; | ||
| } | null; | ||
| }; | ||
|
|
||
| interface ClassProps { | ||
| class?: ClassCardClass; | ||
| expandable?: boolean; | ||
| expanded?: boolean; | ||
| onExpandedChange?: (expanded: boolean) => void; | ||
| onDelete?: () => void; | ||
| leftBorderColor?: Color; | ||
| bookmarked?: boolean; | ||
| bookmarkToggle?: () => void; | ||
| active?: boolean; | ||
| wrapDescription?: boolean; | ||
| customActionMenu?: ReactNode; | ||
| onUnlock?: () => void; | ||
| } | ||
|
|
||
| export default function ClassCard({ | ||
| class: _class, | ||
| expandable = false, | ||
| expanded, | ||
| onExpandedChange, | ||
| onDelete, | ||
| leftBorderColor = undefined, | ||
| bookmarked = false, | ||
| children, | ||
| active = false, | ||
| wrapDescription = false, | ||
| customActionMenu, | ||
| onUnlock = undefined, | ||
| ...props | ||
| }: ClassProps & Omit<ComponentPropsWithRef<"div">, keyof ClassProps>) { | ||
| // bookmarked is part of the interface but not used in this component | ||
| void bookmarked; | ||
| const gradeDistribution = | ||
| _class?.course?.gradeDistribution ?? _class?.gradeDistribution; | ||
|
|
||
| const activeReservedMaxCount = | ||
| _class?.primarySection?.enrollment?.latest?.activeReservedMaxCount ?? 0; | ||
| const maxEnroll = _class?.primarySection?.enrollment?.latest?.maxEnroll ?? 0; | ||
|
|
||
| return ( | ||
| <Card.RootColumn | ||
| style={{ overflow: "visible", position: "relative", ...props?.style }} | ||
| active={active} | ||
| {...props} | ||
| > | ||
| {leftBorderColor && ( | ||
| <Card.LeftBorder | ||
| color={leftBorderColor} | ||
| style={{ | ||
| position: "absolute", | ||
| left: 0, | ||
| top: 0, | ||
| bottom: 0, | ||
| height: "100%", | ||
| backgroundColor: `var(--${leftBorderColor}-500)`, | ||
| }} | ||
| /> | ||
| )} | ||
| <Card.ColumnHeader | ||
| style={{ | ||
| overflow: "visible", | ||
| marginLeft: leftBorderColor ? "8px" : undefined, | ||
| }} | ||
| > | ||
| <Card.Body> | ||
| <div className={styles.cardContent}> | ||
| <div className={styles.topRow}> | ||
| <div className={styles.titleDescription}> | ||
| <Card.Heading> | ||
| {_class?.subject} {_class?.courseNumber}{" "} | ||
| <span className={styles.sectionNumber}> | ||
| #{formatClassNumber(_class?.number)} | ||
| <Card.Heading> | ||
| {_class?.subject} {_class?.courseNumber}{" "} | ||
| <span className={styles.sectionNumber}> | ||
| #{formatClassNumber(_class?.number)} | ||
| </span> | ||
| </Card.Heading> | ||
| <Card.Description wrapDescription={wrapDescription}> | ||
| {_class?.title ?? _class?.course?.title} | ||
| </Card.Description> | ||
| {_class?.semester && _class?.year && ( | ||
| <span className={styles.semester}> | ||
| {formatSemester(_class.semester)} {_class.year} | ||
| </span> | ||
| )} | ||
| <Card.Footer> | ||
| <EnrollmentDisplay | ||
| enrolledCount={ | ||
| _class?.primarySection?.enrollment?.latest?.enrolledCount | ||
| } | ||
| maxEnroll={_class?.primarySection?.enrollment?.latest?.maxEnroll} | ||
| time={_class?.primarySection?.enrollment?.latest?.endTime} | ||
| /> | ||
| {_class?.unitsMin !== undefined && | ||
| _class.unitsMax !== undefined && ( | ||
| <Units unitsMin={_class.unitsMin} unitsMax={_class.unitsMax} /> | ||
| )} | ||
| {(_class?.primarySection?.enrollment?.latest | ||
| ?.activeReservedMaxCount ?? 0) > 0 && ( | ||
| <Tooltip | ||
| trigger={ | ||
| <span className={styles.reservedSeating}> | ||
| <InfoCircle className={styles.reservedSeatingIcon} /> | ||
| Rsvd | ||
| </span> | ||
| </Card.Heading> | ||
| <Card.Description wrapDescription={wrapDescription}> | ||
| {_class?.title ?? _class?.course?.title} | ||
| </Card.Description> | ||
| {_class?.semester && _class?.year && ( | ||
| <span className={styles.semester}> | ||
| {formatSemester(_class.semester)} {_class.year} | ||
| } | ||
| title="Reserved Seating" | ||
| description={`${activeReservedMaxCount.toLocaleString()} out of ${maxEnroll.toLocaleString()} seats for this class are reserved.`} | ||
| /> | ||
| )} | ||
| {(_class?.course?.ratingsCount ?? 0) > 0 && ( | ||
| <Tooltip | ||
| trigger={ | ||
| <span className={styles.ratingsCount}> | ||
| <Star className={styles.ratingsIcon} /> | ||
| {_class?.course?.ratingsCount} | ||
| </span> | ||
| )} | ||
| </div> | ||
| {gradeDistribution && ( | ||
| <div className={styles.gradeContainer}> | ||
| <AverageGrade | ||
| gradeDistribution={gradeDistribution} | ||
| } | ||
| title="Ratings" | ||
| description={ | ||
| <div | ||
| style={{ | ||
| marginTop: 0.5, | ||
| fontSize: 14, | ||
| whiteSpace: "nowrap", | ||
| flexShrink: 0, | ||
| textAlign: "right", | ||
| display: "grid", | ||
| gridTemplateColumns: "auto auto auto", | ||
| gap: "4px 12px", | ||
| alignItems: "center", | ||
| }} | ||
| /> | ||
| </div> | ||
| )} | ||
| </div> | ||
| <Card.Footer className={styles.infoRow}> | ||
| <EnrollmentDisplay | ||
| enrolledCount={ | ||
| _class?.primarySection?.enrollment?.latest?.enrolledCount | ||
| } | ||
| maxEnroll={ | ||
| _class?.primarySection?.enrollment?.latest?.maxEnroll | ||
| > | ||
| {METRIC_ORDER.map((metricName) => { | ||
| const metric = | ||
| _class?.course?.aggregatedRatings?.metrics?.find( | ||
| (m) => m.metricName === metricName | ||
| ); | ||
| if (!metric) return null; | ||
| const status = getMetricStatus( | ||
| metricName, | ||
| metric.weightedAverage | ||
| ); | ||
| const color = getStatusColor( | ||
| metricName, | ||
| metric.weightedAverage | ||
| ); | ||
| return [ | ||
| <span key={`${metricName}-name`}>{metricName}:</span>, | ||
| <span | ||
| key={`${metricName}-status`} | ||
| style={{ | ||
| color: `var(--${color}-500)`, | ||
| whiteSpace: "nowrap", | ||
| }} | ||
| > | ||
| {status} | ||
| </span>, | ||
| <span | ||
| key={`${metricName}-avg`} | ||
| style={{ color: "var(--secondary-text-color)" }} | ||
| > | ||
| {metric.weightedAverage.toFixed(1)}/5.0 | ||
| </span>, | ||
| ]; | ||
| })} | ||
| </div> | ||
| } | ||
| time={_class?.primarySection?.enrollment?.latest?.endTime} | ||
| /> |
Contributor
There was a problem hiding this comment.
I think these are unrelated changes? From your other PR
ARtheboss
requested changes
Mar 4, 2026
Contributor
ARtheboss
left a comment
There was a problem hiding this comment.
Some overlapping changes unrelated to Gradtrak. Gradtrak-related ones look good.
983a3c0 to
5aeea05
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Course.instructorAggregatedRatingsandCourse.classes"None"to"Incomplete"on plan creationTest plan
"Incomplete"status