diff --git a/src/lib/utils/grades.ts b/src/lib/utils/grades.ts
index 40601d5..e9b7abc 100644
--- a/src/lib/utils/grades.ts
+++ b/src/lib/utils/grades.ts
@@ -34,3 +34,46 @@ export function getGrades({
return true;
});
}
+
+export type GradeBadgeInfo = {
+ label: string;
+ rawCode: string;
+ normalizedCode: string;
+};
+
+const gradeBadgeKeywordMap: Array<{ keyword: string; label: string }> = [
+ { keyword: "math", label: "Maths" },
+ { keyword: "phys", label: "Physique" },
+ { keyword: "optique", label: "Physique" },
+ { keyword: "info", label: "Informatique" },
+ { keyword: "prog", label: "Informatique" },
+ { keyword: "web", label: "Informatique" },
+ { keyword: "anglais", label: "Anglais" },
+ { keyword: "sii", label: "SII" },
+ { keyword: "fhs", label: "FHS" },
+];
+
+export function getGradeBadgeInfoFromCode(code?: string | null): GradeBadgeInfo | null {
+ const rawCode = (code ?? "").trim();
+ if (!rawCode) return null;
+
+ const normalizedBase = rawCode
+ .normalize("NFD")
+ .replace(/[\u0300-\u036f]/g, "")
+ .replace(/\s+/g, " ")
+ .trim();
+
+ const normalizedCode = normalizedBase.toUpperCase();
+ const searchableCode = normalizedBase.toLowerCase();
+
+ const keywordMatch = gradeBadgeKeywordMap.find(({ keyword }) =>
+ searchableCode.includes(keyword)
+ );
+ const label = keywordMatch?.label ?? "";
+
+ return {
+ label,
+ rawCode,
+ normalizedCode,
+ };
+}
diff --git a/src/pages/grades/grade-card.tsx b/src/pages/grades/grade-card.tsx
index 014ff2f..ed7dd09 100644
--- a/src/pages/grades/grade-card.tsx
+++ b/src/pages/grades/grade-card.tsx
@@ -1,10 +1,12 @@
import { Card } from "@/components/ui/card";
+import { Badge } from "@/components/ui/badge";
import { Grade } from "@/types/aurion";
import { format } from "date-fns";
import { fr } from "date-fns/locale";
import { motion } from "framer-motion";
import { SquareArrowOutDownRightIcon } from "lucide-react";
import { useTranslation } from "react-i18next";
+import { getGradeBadgeInfoFromCode } from "@/lib/utils/grades";
const MotionCard = motion(Card);
@@ -39,9 +41,10 @@ export function GradeCardAnimate({
initial="hidden"
animate="show"
exit="exit"
- className="border-none bg-white shadow-md transition-shadow dark:bg-mauria-card p-4 h-full"
+ className="relative border-none bg-white shadow-md transition-shadow dark:bg-mauria-card p-4 h-full overflow-visible"
onClick={onGradeClick.bind(null, grade)}
>
+