Migrate Organizations interface patterns
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
import type { DocumentationHelpReference } from "@govoplan/core-webui";
|
||||
|
||||
export const ORGANIZATIONS_DOCUMENTATION = {
|
||||
topicId: "organizations.model",
|
||||
documentationType: "admin"
|
||||
} satisfies DocumentationHelpReference;
|
||||
|
||||
export const ORGANIZATIONS_FIELD_DOCUMENTATION = {
|
||||
topicId: "organizations.reference.fields-and-consequences",
|
||||
documentationType: "admin"
|
||||
} satisfies DocumentationHelpReference;
|
||||
|
||||
export const ORGANIZATIONS_INTERFACE_I18N = {
|
||||
loading: "i18n:govoplan-organizations.loading_reason",
|
||||
busy: "i18n:govoplan-organizations.busy_reason",
|
||||
noChanges: "i18n:govoplan-organizations.no_changes_reason",
|
||||
modelWrite: "i18n:govoplan-organizations.model_write_reason",
|
||||
unitWrite: "i18n:govoplan-organizations.unit_write_reason",
|
||||
functionWrite: "i18n:govoplan-organizations.function_write_reason",
|
||||
settingsWrite: "i18n:govoplan-organizations.settings_write_reason",
|
||||
incomplete: "i18n:govoplan-organizations.incomplete_editor_reason",
|
||||
readOnlySummary: "i18n:govoplan-organizations.read_only_summary",
|
||||
requiredAction: "i18n:govoplan-organizations.required_action",
|
||||
actor: "i18n:govoplan-organizations.responsible_actor",
|
||||
destination: "i18n:govoplan-organizations.destination",
|
||||
permissionGuidance: "i18n:govoplan-organizations.request_write_permission",
|
||||
administrator: "i18n:govoplan-organizations.organization_or_access_administrator",
|
||||
administrationTarget: "i18n:govoplan-organizations.administration_roles_target"
|
||||
} as const;
|
||||
|
||||
export function organizationWriteReason(
|
||||
permitted: boolean,
|
||||
busy: boolean,
|
||||
kind: "model" | "unit" | "function" | "settings"
|
||||
): string | undefined {
|
||||
if (busy) return ORGANIZATIONS_INTERFACE_I18N.busy;
|
||||
if (permitted) return undefined;
|
||||
return {
|
||||
model: ORGANIZATIONS_INTERFACE_I18N.modelWrite,
|
||||
unit: ORGANIZATIONS_INTERFACE_I18N.unitWrite,
|
||||
function: ORGANIZATIONS_INTERFACE_I18N.functionWrite,
|
||||
settings: ORGANIZATIONS_INTERFACE_I18N.settingsWrite
|
||||
}[kind];
|
||||
}
|
||||
Reference in New Issue
Block a user