mirror of
https://github.com/rgrgogu/new_starr.git
synced 2026-09-27 00:12:54 +08:00
50 lines
1.2 KiB
React
50 lines
1.2 KiB
React
import { RefreshCw, Download, ArchiveRestore } from "lucide-react";
|
|
import { exportTableToExcel } from "@/utils/excel.util";
|
|
|
|
export function buildToolbarActions({
|
|
fetchPlans,
|
|
pagination,
|
|
exportConfig,
|
|
navigate,
|
|
getFilters,
|
|
getSort,
|
|
getTableInstance,
|
|
}) {
|
|
return [
|
|
{
|
|
key: "refresh",
|
|
type: "button",
|
|
label: "Refresh",
|
|
icon: <RefreshCw className="h-3.5 w-3.5" />,
|
|
variant: "outline",
|
|
onClick: () => fetchPlans({
|
|
page: 1,
|
|
limit: pagination?.limit ?? 10,
|
|
filters: getFilters(),
|
|
sort: getSort(),
|
|
archived: true,
|
|
}),
|
|
},
|
|
{
|
|
key: "export",
|
|
type: "button",
|
|
label: "Export",
|
|
icon: <Download className="h-3.5 w-3.5" />,
|
|
variant: "outline",
|
|
onClick: () => exportTableToExcel({
|
|
...exportConfig,
|
|
tableInstance: getTableInstance(),
|
|
}),
|
|
},
|
|
{
|
|
key: "active-plans",
|
|
type: "button",
|
|
label: "Active Plans",
|
|
icon: <ArchiveRestore className="h-3.5 w-3.5" />,
|
|
variant: "secondary",
|
|
className: "border border-border",
|
|
onClick: () => navigate("/admin/tiers/plans"),
|
|
},
|
|
];
|
|
}
|