Fix server/client component boundary issue with reasonColor/reasonLabel helper functions by moving them to shared utils
This commit is contained in:
@@ -4,6 +4,7 @@ import Link from "next/link";
|
||||
import { useMemo, useTransition } from "react";
|
||||
import { AbsenceReason } from "@prisma/client";
|
||||
import { Baby, CalendarX2, Check, ChevronRight, Loader2 } from "lucide-react";
|
||||
import { reasonColor, reasonLabel } from "@/lib/absence-utils";
|
||||
import { toast } from "sonner";
|
||||
|
||||
import { reportAbsence } from "@/actions/absences";
|
||||
@@ -331,14 +332,4 @@ function AbsenceRow({ absence }: { absence: AbsenceListItem }) {
|
||||
);
|
||||
}
|
||||
|
||||
function reasonLabel(reason: AbsenceReason) {
|
||||
if (reason === AbsenceReason.ILLNESS) return "Krank";
|
||||
if (reason === AbsenceReason.VACATION) return "Urlaub";
|
||||
return "Sonstiges";
|
||||
}
|
||||
|
||||
function reasonColor(reason: AbsenceReason) {
|
||||
if (reason === AbsenceReason.ILLNESS) return "var(--danger)";
|
||||
if (reason === AbsenceReason.VACATION) return "var(--warn)";
|
||||
return "var(--accent)";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user