ldc-groupe/resources/ts/lib/utils.ts
2025-10-17 14:52:56 +02:00

76 lines
1.5 KiB
TypeScript

// * Packages
import { clsx, type ClassValue } from "clsx";
import {
Archive,
ArchiveRestore,
Copy,
Eye,
Pencil,
Plus,
Trash2,
} from "lucide-react";
import { twMerge } from "tailwind-merge";
/**
* Merge classes.
* @param inputs ClassValue[]
* @returns string
*/
export function cn(...inputs: ClassValue[]): string {
return twMerge(clsx(inputs));
}
/**
* List all actions on back-end models.
* @return object
*/
export const Views = {
CREATION: {
label: "creation",
value: "create",
policy: "create",
icon: Plus,
},
VISUALIZATION: {
label: "visualization",
value: "show",
policy: "view",
icon: Eye,
},
EDITION: {
label: "edition",
value: "edit",
policy: "update",
icon: Pencil,
},
DUPLICATION: {
label: "duplication",
value: "duplicate",
policy: "duplicate",
icon: Copy,
},
ARCHIVATION: {
label: "archivation",
value: "destroy",
policy: "delete",
icon: Archive,
},
RESTORATION: {
label: "restoration",
value: "restore",
policy: "restore",
icon: ArchiveRestore,
},
DELETION: {
label: "suppression",
value: "destroy",
policy: "delete",
icon: Trash2,
},
FORCEDELETION: {
label: "suppression",
value: "forceDestroy",
policy: "forceDelete",
icon: Trash2,
},
};