22500 Phase 1: extract pure helpers from elements index

This commit is contained in:
2026-04-07 09:34:50 +01:00
parent 02512ec403
commit 06b7855826
5 changed files with 252 additions and 174 deletions
+34
View File
@@ -18,6 +18,40 @@ Follow-ups:
---
### CL-00X: 22500 `components/elements/index.js` Phase 1 helper extraction
date: 2026-04-07
author: Cline
scope: `components/elements/index.js`, `components/elements/helpers/fileUploadHelpers.js`, `components/elements/helpers/translationHelpers.js`, `memory-bank/refactor-backlog.md`
type: change
rationale: Execute Phase 1 of the approved `components/elements/index.js` decomposition plan by extracting pure helper logic only, reducing monolith coupling while preserving UI/component behavior.
impact: No route/API contract changes; refactor-only extraction of translation/file-upload helper functions with expected behavior parity for EN/CY field labels, file naming, thumbnail icon mapping, and filename validation.
status: completed
Summary:
- Created work branch from `origin/SIPS-Development`: `22500-elements-index-phase1`.
- Added helper modules:
- `components/elements/helpers/fileUploadHelpers.js`
- `getThumbnailIconByMimeType`
- `getDocumentTypePrefix`
- `validateUploadFilename`
- `components/elements/helpers/translationHelpers.js`
- `getFieldTranslation`
- `getPickListTranslation`
- Updated `components/elements/index.js` to consume these helpers and removed duplicated inline helper implementations.
- Kept field renderer/component placement and external prop contracts unchanged (Phase 1 non-goals respected).
- Updated `memory-bank/refactor-backlog.md` with a phased Priority 6 track and Phase 1 guardrail-aligned acceptance criteria.
Validation:
- `npx eslint components/elements/index.js components/elements/helpers/fileUploadHelpers.js components/elements/helpers/translationHelpers.js` -> pass
Follow-ups:
- Phase 2: extract low-risk leaf field renderer components from `components/elements/index.js` in bounded slices.
- Perform manual EN/CY + a11y smoke matrix on new appeal/myportal form journeys before merge.
### CL-001: TASK22211 endpoint search-document contract consistency slice
date: 2026-03-23