From 71ed409ef26b4e6c2d677c35fb43927ec7a6865d Mon Sep 17 00:00:00 2001 From: estifanos Date: Fri, 28 Aug 2026 10:36:34 +0000 Subject: [PATCH] feat: expand supported document MIME types and add a helper description to the requirement editor --- .../DocumentRequirementEditorDrawer.tsx | 29 ++++++++++++++++++- apps/backoffice/src/app/i18n/locales/am.ts | 2 ++ apps/backoffice/src/app/i18n/locales/en.ts | 2 ++ 3 files changed, 32 insertions(+), 1 deletion(-) diff --git a/apps/backoffice/src/app/features/certificate-requirements/components/DocumentRequirementEditorDrawer.tsx b/apps/backoffice/src/app/features/certificate-requirements/components/DocumentRequirementEditorDrawer.tsx index 740457d99..2b9bcc817 100644 --- a/apps/backoffice/src/app/features/certificate-requirements/components/DocumentRequirementEditorDrawer.tsx +++ b/apps/backoffice/src/app/features/certificate-requirements/components/DocumentRequirementEditorDrawer.tsx @@ -24,12 +24,34 @@ import { import { ConditionBuilder, type ConditionValue } from './ConditionBuilder'; import type { ConditionTarget } from '../config/schema-paths'; +/** + * File types a slot may be opened to. + * + * Longer than the three a slot starts with, because what an applicant + * actually has is not always a scan: a phone photographs an ID as HEIC, a + * scanner writes multi-page TIFF, and an academic record often arrives as the + * Word file its institution issued. Widening a slot stays a deliberate choice + * — the defaults below do not change — but it no longer needs a release. + */ const MIME_OPTIONS = [ { value: 'application/pdf', label: 'PDF' }, { value: 'image/jpeg', label: 'JPEG' }, { value: 'image/png', label: 'PNG' }, + { value: 'image/webp', label: 'WebP' }, + { value: 'image/heic', label: 'HEIC (iPhone photo)' }, + { value: 'image/heif', label: 'HEIF' }, + { value: 'image/tiff', label: 'TIFF (scan)' }, + { value: 'image/bmp', label: 'BMP' }, + { value: 'application/msword', label: 'Word (.doc)' }, + { + value: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', + label: 'Word (.docx)', + }, ]; +/** What a new slot accepts until someone widens it. */ +const DEFAULT_MIME_TYPES = ['application/pdf', 'image/jpeg', 'image/png']; + type DraftRequirement = Omit; /** @@ -50,7 +72,7 @@ function emptyDraft(applicationKind: ApplicationKind, personal: boolean): DraftR // A personal document is never demanded by one application, so "always // required" would be a promise nothing here can keep. mode: personal ? 'OPTIONAL' : 'ALWAYS', - allowedMimeTypes: ['application/pdf', 'image/jpeg', 'image/png'], + allowedMimeTypes: [...DEFAULT_MIME_TYPES], maxSizeMb: 5, requiresValidityDates: false, allowMultiple: false, @@ -293,6 +315,11 @@ export function DocumentRequirementEditorDrawer({ setDraft((d) => ({ ...d, allowedMimeTypes: v }))} diff --git a/apps/backoffice/src/app/i18n/locales/am.ts b/apps/backoffice/src/app/i18n/locales/am.ts index a33fbd174..08524d17d 100644 --- a/apps/backoffice/src/app/i18n/locales/am.ts +++ b/apps/backoffice/src/app/i18n/locales/am.ts @@ -1350,6 +1350,8 @@ export const am: Translations = { modeOptional: "አማራጭ ስቀላ", conditionRequired: "ሁኔታዊ መስፈርት ሁኔታ ያስፈልገዋል", allowedTypes: "የተፈቀዱ የፋይል ዓይነቶች", + allowedTypesHelp: + "አመልካቹ እነዚህን ብቻ መስቀል ይችላል። በነባሪ PDF፣ JPEG እና PNG ተመርጠዋል።", maxSize: "ከፍተኛ የፋይል መጠን (MB)", requiresValidity: "የቀን ገደብ ያስፈልጋል", allowMultiple: "ብዙ ስቀላዎችን ፍቀድ", diff --git a/apps/backoffice/src/app/i18n/locales/en.ts b/apps/backoffice/src/app/i18n/locales/en.ts index e8a173633..77c11329f 100644 --- a/apps/backoffice/src/app/i18n/locales/en.ts +++ b/apps/backoffice/src/app/i18n/locales/en.ts @@ -1355,6 +1355,8 @@ export const en = { modeOptional: 'Optional upload', conditionRequired: 'A conditional requirement needs a condition', allowedTypes: 'Allowed file types', + allowedTypesHelp: + 'The applicant can only upload these. PDF, JPEG and PNG are selected by default.', maxSize: 'Max file size (MB)', requiresValidity: 'Requires validity dates', allowMultiple: 'Allow multiple uploads',