Openstatus www.openstatus.dev
at main 41 lines 892 B view raw
1import { Cog, Eye, Plus, Trash2 } from "lucide-react"; 2 3export const actions = [ 4 { 5 id: "edit", 6 label: "Settings", 7 icon: Cog, 8 variant: "default" as const, 9 }, 10 { 11 id: "create-update", 12 label: "Create Update", 13 icon: Plus, 14 variant: "default" as const, 15 }, 16 { 17 id: "view-report", 18 label: "View Report", 19 icon: Eye, 20 variant: "default" as const, 21 }, 22 { 23 id: "delete", 24 label: "Delete", 25 icon: Trash2, 26 variant: "destructive" as const, 27 }, 28] as const; 29 30export type StatusReportUpdateAction = (typeof actions)[number]; 31 32export const getActions = ( 33 props: Partial< 34 Record<StatusReportUpdateAction["id"], () => Promise<void> | void> 35 >, 36): (StatusReportUpdateAction & { onClick?: () => Promise<void> | void })[] => { 37 return actions.map((action) => ({ 38 ...action, 39 onClick: props[action.id as keyof typeof props], 40 })); 41};