@@ -44,9 +44,9 @@ import { classNumberMatch, classSort, simplifyString } from "../lib/utils";
4444import type { TSemester } from "../lib/dates" ;
4545import { HydrantContext } from "../lib/hydrant" ;
4646import type { State } from "../lib/state" ;
47+ import { ColorClasses } from "../lib/colors" ;
4748
4849import tableClasses from "./ClassTable.module.css" ;
49- import colorClasses from "../lib/colors.module.css" ;
5050
5151const hydrantTheme = themeQuartz . withParams ( {
5252 accentColor : "var(--chakra-colors-fg)" ,
@@ -71,20 +71,12 @@ const GRID_MODULES: Module[] = [
7171
7272ModuleRegistry . registerModules ( GRID_MODULES ) ;
7373
74- const COLORS = {
75- Muted : colorClasses . muted ,
76- Success : colorClasses . success ,
77- Warning : colorClasses . warning ,
78- Error : colorClasses . error ,
79- Normal : colorClasses . normal ,
80- } as const ;
81-
8274const getRatingColor = ( rating ?: string | null ) => {
83- if ( ! rating || rating === "N/A" ) return COLORS . Muted ;
75+ if ( ! rating || rating === "N/A" ) return ColorClasses . Muted ;
8476 const ratingNumber = Number ( rating ) ;
85- if ( ratingNumber >= 6 ) return COLORS . Success ;
86- if ( ratingNumber >= 5 ) return COLORS . Warning ;
87- return COLORS . Error ;
77+ if ( ratingNumber >= 6 ) return ColorClasses . Success ;
78+ if ( ratingNumber >= 5 ) return ColorClasses . Warning ;
79+ return ColorClasses . Error ;
8880} ;
8981
9082const getHoursColor = (
@@ -93,9 +85,9 @@ const getHoursColor = (
9385 term : TSemester ,
9486 half : number | undefined ,
9587) => {
96- if ( ! hours || hours === "N/A" ) return COLORS . Muted ;
97- if ( totalUnits === undefined ) return COLORS . Muted ;
98- if ( totalUnits === 0 ) return COLORS . Normal ;
88+ if ( ! hours || hours === "N/A" ) return ColorClasses . Muted ;
89+ if ( totalUnits === undefined ) return ColorClasses . Muted ;
90+ if ( totalUnits === 0 ) return ColorClasses . Normal ;
9991
10092 const hoursNumber = Number ( hours ) ;
10193 let weeksInTerm = 0 ;
@@ -119,9 +111,9 @@ const getHoursColor = (
119111 const expectedHours = totalUnits * ( weeksInTerm / 14 ) * ( half ? 2 : 1 ) ;
120112 const proportion = hoursNumber / expectedHours ;
121113
122- if ( proportion < 0.8 ) return COLORS . Success ;
123- if ( proportion >= 0.8 && proportion <= 1.2 ) return COLORS . Warning ;
124- return COLORS . Error ;
114+ if ( proportion < 0.8 ) return ColorClasses . Success ;
115+ if ( proportion >= 0.8 && proportion <= 1.2 ) return ColorClasses . Warning ;
116+ return ColorClasses . Error ;
125117} ;
126118
127119/** A single row in the class table. */
0 commit comments