2025-03-04 12:53:19 +00:00
|
|
|
import { twMerge } from "tailwind-merge";
|
|
|
|
import { clsx, type ClassValue } from "clsx";
|
2025-03-30 12:30:58 +00:00
|
|
|
import type { EditorLanguageConfig, Difficulty } from "@prisma/client";
|
2025-02-19 01:05:45 +00:00
|
|
|
|
|
|
|
export function cn(...inputs: ClassValue[]) {
|
2025-03-23 07:34:57 +00:00
|
|
|
return twMerge(clsx(inputs));
|
2025-02-19 01:05:45 +00:00
|
|
|
}
|
2025-03-04 12:53:19 +00:00
|
|
|
|
2025-03-23 07:34:57 +00:00
|
|
|
export function getPath(
|
|
|
|
problemId: string,
|
|
|
|
editorLanguageConfig: EditorLanguageConfig
|
|
|
|
) {
|
|
|
|
return `file:///${problemId}/${editorLanguageConfig.fileName}${editorLanguageConfig.fileExtension}`;
|
2025-03-04 12:53:19 +00:00
|
|
|
}
|
2025-03-30 12:30:58 +00:00
|
|
|
|
|
|
|
export const getDifficultyColorClass = (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";
|
|
|
|
}
|
|
|
|
};
|