Openstatus
www.openstatus.dev
1import type { StatusReportStatus } from "@openstatus/db/src/schema";
2import { Cog, Trash2 } from "lucide-react";
3
4export const actions = [
5 {
6 id: "edit",
7 label: "Settings",
8 icon: Cog,
9 variant: "default" as const,
10 },
11 {
12 id: "delete",
13 label: "Delete",
14 icon: Trash2,
15 variant: "destructive" as const,
16 },
17] as const;
18
19export type StatusReportUpdateAction = (typeof actions)[number];
20
21export const getActions = (
22 props: Partial<
23 Record<StatusReportUpdateAction["id"], () => Promise<void> | void>
24 >,
25): (StatusReportUpdateAction & { onClick?: () => Promise<void> | void })[] => {
26 return actions.map((action) => ({
27 ...action,
28 onClick: props[action.id as keyof typeof props],
29 }));
30};
31
32export const colors = {
33 resolved:
34 "text-success/80 data-[state=selected]:bg-success/10 data-[state=selected]:text-success",
35 investigating:
36 "text-destructive/80 data-[state=selected]:bg-destructive/10 data-[state=selected]:text-destructive",
37 monitoring:
38 "text-info/80 data-[state=selected]:bg-info/10 data-[state=selected]:text-info",
39 identified:
40 "text-warning/80 data-[state=selected]:bg-warning/10 data-[state=selected]:text-warning",
41} as const satisfies Record<StatusReportStatus, string>;