merge new_starr_app@qas history into apps/web

git-subtree-dir: apps/web
git-subtree-mainline: eaa6d2276a
git-subtree-split: 459af9d46a
This commit is contained in:
2026-08-24 12:21:16 +08:00
699 changed files with 103969 additions and 0 deletions
@@ -0,0 +1,51 @@
// config/advertisements/archive/toolbar.config.jsx
import { RefreshCw, Download, Ban } from "lucide-react";
import { exportTableToExcel } from "@/utils/excel.util";
/**
* @param {Object} deps
* @param {Function} deps.fetchAdvertisements
* @param {Object} deps.pagination
* @param {Object} deps.exportConfig
* @param {Function} deps.navigate
* @param {Function} deps.getFilters
* @param {Function} deps.getSort
* @param {Function} deps.getTableInstance
* @param {Function} [deps.onRemoveExpired] - triggers the "Remove Expired" bulk-purge flow
*/
export function buildToolbarActions({ fetchAdvertisements, pagination, exportConfig, navigate, getFilters, getSort, getTableInstance, onRemoveExpired }) {
return [
{
key: "refresh",
type: "button",
icon: <RefreshCw className="h-3.5 w-3.5" />,
label: "Refresh",
onClick: () =>
fetchAdvertisements({
page: 1,
limit: pagination.limit,
filters: getFilters(),
sort: getSort(),
}),
},
{
key: "export",
type: "button",
icon: <Download className="h-3.5 w-3.5" />,
label: "Export",
onClick: (table) =>
exportTableToExcel({
...exportConfig,
tableInstance: table ?? getTableInstance(),
}),
},
...(onRemoveExpired ? [{
key: "remove-expired",
type: "button",
icon: <Ban className="h-3.5 w-3.5" />,
label: "Remove Expired",
className: "text-destructive border-destructive/40 hover:bg-destructive/10 hover:text-destructive",
onClick: onRemoveExpired,
}] : []),
];
}