Signed-off-by: Kenneth Obsequio <k80308392@gmail.com>
This commit is contained in:
2026-07-11 12:12:40 +08:00
parent 01a2c63b06
commit 71f758fe0b
66 changed files with 3055 additions and 939 deletions
@@ -13,6 +13,12 @@ export const columnPinning = {
left: [],
};
const COURSE_STATUS_BADGE = {
published: "default",
draft: "secondary",
standalone: "outline",
};
const cellOverrides = {
duration_seconds: (info) => {
const seconds = parseInt(info.getValue() ?? 0, 10);
@@ -25,22 +31,19 @@ const cellOverrides = {
</div>
);
},
unit_count: (info) => {
course_count: (info) => {
const n = parseInt(info.getValue() ?? 0, 10);
return n > 0 ? (
return (
<Badge variant="secondary" className="text-xs tabular-nums">
in {n} unit{n === 1 ? "" : "s"}
{n} course{n === 1 ? "" : "s"}
</Badge>
) : (
<Badge variant="outline" className="text-xs text-muted-foreground">standalone</Badge>
);
},
course_bound: (info) =>
info.getValue() ? (
<Badge variant="default" className="text-xs">In a course</Badge>
) : (
<Badge variant="outline" className="text-xs text-muted-foreground">Not in a course</Badge>
),
course_status: (info) => (
<Badge variant={COURSE_STATUS_BADGE[info.getValue()] ?? "outline"} className="text-xs capitalize">
{info.getValue()}
</Badge>
),
};
export function buildDataColumns(attributes, rowActions) {