mirror of
https://github.com/rgrgogu/new_starr.git
synced 2026-09-27 00:12:54 +08:00
51 lines
1.5 KiB
React
51 lines
1.5 KiB
React
import { Eye, Archive, SquarePlus, SquareChartGantt } from "lucide-react";
|
|
|
|
// duration_seconds is derived from the lesson's authored content blocks
|
|
// (see duration.util.js) — zero means no page content exists yet.
|
|
const hasContent = (row) => !!row.duration_seconds;
|
|
|
|
export function buildRowActions({ onCreatePage, onViewPage, onView, onArchive }) {
|
|
return [
|
|
{
|
|
key: "view",
|
|
label: "View Lesson",
|
|
icon: <Eye className="h-3.5 w-3.5" />,
|
|
onClick: (row) => onView(row),
|
|
},
|
|
{
|
|
key: "create_content",
|
|
label: "Create Content",
|
|
icon: <SquarePlus className="h-3.5 w-3.5" />,
|
|
className: "text-sky-700 hover:text-sky-600",
|
|
onClick: (row) => onCreatePage(row),
|
|
hidden: (row) => hasContent(row),
|
|
separator: true,
|
|
},
|
|
{
|
|
key: "view_content",
|
|
label: "View Content",
|
|
icon: <SquareChartGantt className="h-3.5 w-3.5" />,
|
|
className: "text-sky-700 hover:text-sky-600",
|
|
onClick: (row) => onViewPage(row),
|
|
hidden: (row) => !hasContent(row),
|
|
separator: true,
|
|
},
|
|
{
|
|
key: "modify_content",
|
|
label: "Modify Content",
|
|
icon: <SquarePlus className="h-3.5 w-3.5" />,
|
|
className: "text-sky-700 hover:text-sky-600",
|
|
onClick: (row) => onCreatePage(row),
|
|
hidden: (row) => !hasContent(row),
|
|
},
|
|
{
|
|
key: "archive",
|
|
label: "Archive",
|
|
icon: <Archive className="h-3.5 w-3.5" />,
|
|
className: "text-destructive",
|
|
onClick: (row) => onArchive(row),
|
|
separator: true
|
|
},
|
|
]
|
|
}
|