mirror of
https://github.com/rgrgogu/new_starr.git
synced 2026-09-27 00:12:54 +08:00
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user