feat: expand supported document MIME types and add a helper description to the requirement editor

This commit is contained in:
estifanos
2026-08-28 10:36:34 +00:00
parent 1c1347faeb
commit 71ed409ef2
3 changed files with 32 additions and 1 deletions

View File

@@ -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<DocumentRequirement, 'id' | 'licenseTypeId' | 'isActive'>;
/**
@@ -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({
<MultiSelect
label={t('certReq.doc.allowedTypes', 'Allowed file types')}
description={t(
'certReq.doc.allowedTypesHelp',
'The applicant can only upload these. PDF, JPEG and PNG are selected by default.',
)}
searchable
data={MIME_OPTIONS}
value={draft.allowedMimeTypes}
onChange={(v) => setDraft((d) => ({ ...d, allowedMimeTypes: v }))}

View File

@@ -1350,6 +1350,8 @@ export const am: Translations = {
modeOptional: "አማራጭ ስቀላ",
conditionRequired: "ሁኔታዊ መስፈርት ሁኔታ ያስፈልገዋል",
allowedTypes: "የተፈቀዱ የፋይል ዓይነቶች",
allowedTypesHelp:
"አመልካቹ እነዚህን ብቻ መስቀል ይችላል። በነባሪ PDF፣ JPEG እና PNG ተመርጠዋል።",
maxSize: "ከፍተኛ የፋይል መጠን (MB)",
requiresValidity: "የቀን ገደብ ያስፈልጋል",
allowMultiple: "ብዙ ስቀላዎችን ፍቀድ",

View File

@@ -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',