Add audits

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
Sacha Al Himdani
2025-07-22 17:34:43 +02:00
parent 95caa4b630
commit e85a7b4955
37 changed files with 8775 additions and 2 deletions

View File

@@ -0,0 +1,43 @@
type Translator = (s: string) => string;
export const auditStates = [
"NOT_STARTED",
"IN_PROGRESS",
"COMPLETED",
"REJECTED",
"OUTDATED",
] as const;
export function getAuditStateLabel(__: Translator, state: (typeof auditStates)[number]) {
switch (state) {
case "NOT_STARTED":
return __("Not Started");
case "IN_PROGRESS":
return __("In Progress");
case "COMPLETED":
return __("Completed");
case "REJECTED":
return __("Rejected");
case "OUTDATED":
return __("Outdated");
default:
return __("Unknown");
}
}
export function getAuditStateVariant(state: (typeof auditStates)[number]) {
switch (state) {
case "NOT_STARTED":
return "neutral";
case "IN_PROGRESS":
return "info";
case "COMPLETED":
return "success";
case "REJECTED":
return "danger";
case "OUTDATED":
return "warning";
default:
return "neutral";
}
}

View File

@@ -15,5 +15,6 @@ export { certificationCategoryLabel, certifications } from "./certifications";
export { availableFrameworks } from "./frameworks";
export { getDocumentTypeLabel, documentTypes } from "./documents";
export { getAssetTypeVariant, getCriticityVariant } from "./assets";
export { getAuditStateLabel, getAuditStateVariant, auditStates } from "./audits";
export { promisifyMutation } from "./relay";
export { fileType, fileSize } from "./file";