All files / src/app/student-page/page/my-grade gradeStatus.js

100% Statements 5/5
100% Branches 4/4
100% Functions 1/1
100% Lines 4/4

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28                          2x               2x     90x 75x    
import CheckCircleIcon from "@mui/icons-material/CheckCircle";
import CancelIcon from "@mui/icons-material/Cancel";
import HourglassEmptyIcon from "@mui/icons-material/HourglassEmpty";
import PendingIcon from "@mui/icons-material/Pending";
import BlockIcon from "@mui/icons-material/Block";
 
/**
 * Status labels/icons mirror the resolver states shared with the assignment
 * list and teacher gradebook (`resolve_cell_grade`): graded | missed |
 * incomplete | pending | rejected. Status color is reserved (never reused as
 * a categorical series color) and always paired with an icon + label so
 * identity never rides on color alone.
 */
export const STATUS_META = {
    graded: { label: "Graded", colorKey: "success", Icon: CheckCircleIcon },
    missed: { label: "Missed", colorKey: "error", Icon: CancelIcon },
    incomplete: { label: "No submission", colorKey: "grey", Icon: HourglassEmptyIcon },
    pending: { label: "Pending Review", colorKey: "warning", Icon: PendingIcon },
    rejected: { label: "Rejected", colorKey: "error", Icon: BlockIcon },
};
 
export const STATUS_ORDER = ["graded", "missed", "incomplete", "pending", "rejected"];
 
export function statusColor(theme, colorKey) {
    if (colorKey === "grey") return theme.palette.grey[500];
    return theme.palette[colorKey]?.main ?? theme.palette.grey[500];
}