This commit is contained in:
rgrgogu
2026-05-20 13:25:03 +08:00
parent 2b1955608d
commit 95242709b0
71 changed files with 5535 additions and 1035 deletions
@@ -0,0 +1,62 @@
// config/courses/lessons/toolbar.config.jsx
import { Plus, RefreshCw, Download, Archive } from "lucide-react";
import { exportTableToExcel } from "@/utils/excel.util";
export function buildToolbarActions({
fetchLessons,
pagination,
exportConfig,
navigate,
courseId,
unitId,
getFilters,
getSort,
getTableInstance,
}) {
return [
{
key: "refresh",
type: "button",
label: "Refresh",
icon: <RefreshCw className="h-3.5 w-3.5" />,
variant: "outline",
onClick: () => fetchLessons({
page: 1,
limit: pagination?.limit ?? 10,
filters: getFilters(),
sort: getSort(),
}),
},
{
key: "export",
type: "button",
label: "Export",
icon: <Download className="h-3.5 w-3.5" />,
variant: "outline",
onClick: () => exportTableToExcel({
...exportConfig,
tableInstance: getTableInstance(),
}),
},
{
key: "create",
type: "button",
label: "New Lesson",
icon: <Plus className="h-3.5 w-3.5" />,
variant: "default",
onClick: () => navigate(
`/admin/courses/${courseId}/units/${unitId}/lessons/add`
),
},
{
key: "archived-lessons",
type: "button",
icon: <Archive className="h-3.5 w-3.5" />,
label: "Archived Lessons",
variant: "secondary",
className: "border border-border",
onClick: () => navigate("/admin/lessons/archived"),
},
];
}