Openstatus
www.openstatus.dev
1import { Bookmark, Check, Trash2 } from "lucide-react";
2
3export const actions = [
4 {
5 id: "acknowledge",
6 label: "Acknowledge",
7 icon: Bookmark,
8 variant: "default" as const,
9 },
10 {
11 id: "resolve",
12 label: "Resolve",
13 icon: Check,
14 variant: "default" as const,
15 },
16 {
17 id: "delete",
18 label: "Delete",
19 icon: Trash2,
20 variant: "destructive" as const,
21 },
22] as const;
23
24export type IncidentAction = (typeof actions)[number];
25
26export const getActions = (
27 props: Partial<Record<IncidentAction["id"], () => Promise<void> | void>>,
28): (IncidentAction & {
29 onClick?: () => Promise<void> | void;
30})[] => {
31 return actions.map((action) => ({
32 ...action,
33 onClick: props[action.id as keyof typeof props],
34 }));
35};