mirror of
https://github.com/massbug/judge4c.git
synced 2025-05-17 23:12:23 +00:00
refactor(utils): move getDifficultyColor function
This commit is contained in:
parent
daa7775862
commit
6ab3e16598
@ -8,20 +8,7 @@ import {
|
||||
TableRow,
|
||||
} from "@/components/ui/table";
|
||||
import prisma from "@/lib/prisma";
|
||||
import { Difficulty } from "@prisma/client";
|
||||
|
||||
const getDifficultyColor = (difficulty: Difficulty) => {
|
||||
switch (difficulty) {
|
||||
case "EASY":
|
||||
return "text-green-500";
|
||||
case "MEDIUM":
|
||||
return "text-yellow-500";
|
||||
case "HARD":
|
||||
return "text-red-500";
|
||||
default:
|
||||
return "text-gray-500";
|
||||
}
|
||||
};
|
||||
import { getDifficultyColorClass } from "@/lib/utils";
|
||||
|
||||
export default async function ProblemsetPage() {
|
||||
const problems = await prisma.problem.findMany({
|
||||
@ -68,7 +55,7 @@ export default async function ProblemsetPage() {
|
||||
{problem.title}
|
||||
</Link>
|
||||
</TableCell>
|
||||
<TableCell className={`py-2.5 ${getDifficultyColor(problem.difficulty)}`}>
|
||||
<TableCell className={`py-2.5 ${getDifficultyColorClass(problem.difficulty)}`}>
|
||||
{problem.difficulty}
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
|
Loading…
Reference in New Issue
Block a user