diff --git a/frontend/src/features/admin-form/create/builder-and-design/BuilderAndDesignDrawer/FieldListDrawer/field-panels/utils.ts b/frontend/src/features/admin-form/create/builder-and-design/BuilderAndDesignDrawer/FieldListDrawer/field-panels/utils.ts index cdae03cb2b..3a89354d63 100644 --- a/frontend/src/features/admin-form/create/builder-and-design/BuilderAndDesignDrawer/FieldListDrawer/field-panels/utils.ts +++ b/frontend/src/features/admin-form/create/builder-and-design/BuilderAndDesignDrawer/FieldListDrawer/field-panels/utils.ts @@ -9,8 +9,8 @@ const checkSearchValueMatchesFieldMeta = ( const lowerCaseSearchValue = searchValue.toLowerCase() return ( fieldMeta.label.toLowerCase().includes(lowerCaseSearchValue) || - fieldMeta.alias?.some((alias) => - alias.toLowerCase().includes(lowerCaseSearchValue), + fieldMeta.searchAliases?.some((searchAlias) => + searchAlias.toLowerCase().includes(lowerCaseSearchValue), ) ) } diff --git a/frontend/src/features/admin-form/create/constants.ts b/frontend/src/features/admin-form/create/constants.ts index a8e31311b6..61b25c6783 100644 --- a/frontend/src/features/admin-form/create/constants.ts +++ b/frontend/src/features/admin-form/create/constants.ts @@ -52,7 +52,7 @@ export type BuilderSidebarFieldMeta = { icon: As // Is this fieldType included in submissions? isSubmitted: boolean - alias?: string[] + searchAliases?: string[] } // !!! Do not use this to reference field titles for MyInfo fields. !!! @@ -64,42 +64,48 @@ export const BASICFIELD_TO_DRAWER_META: { label: 'Image', icon: BiImage, isSubmitted: false, - alias: ['photo', 'picture'], + searchAliases: ['photo', 'picture'], }, [BasicField.Statement]: { label: 'Paragraph', icon: BiText, isSubmitted: false, - alias: ['description'], + searchAliases: ['description'], }, [BasicField.Section]: { label: 'Heading', icon: BiHeading, isSubmitted: false, - alias: ['header', 'title', 'section'], + searchAliases: ['header', 'title', 'section'], }, [BasicField.Attachment]: { label: 'Attachment', icon: BiCloudUpload, isSubmitted: true, - alias: ['document', 'file', 'upload'], + searchAliases: ['supporting', 'screenshot', 'document', 'file', 'upload'], }, [BasicField.Checkbox]: { label: 'Checkbox', icon: BiSelectMultiple, isSubmitted: true, - alias: ['choice', 'options', 'multiple'], + searchAliases: [ + 'choice', + 'options', + 'multiple', + 'declaration', + 'acknowledgement', + ], }, [BasicField.Date]: { label: 'Date', icon: BiCalendarEvent, isSubmitted: true, - alias: [ + searchAliases: [ 'birthdate', 'dob', 'date of birth', @@ -114,45 +120,46 @@ export const BASICFIELD_TO_DRAWER_META: { label: 'Decimal', icon: BiCalculator, isSubmitted: true, - alias: ['price', 'amount', 'cost'], + searchAliases: ['price', 'amount', 'cost'], }, [BasicField.Dropdown]: { label: 'Dropdown', icon: BiCaretDownSquare, isSubmitted: true, - alias: ['choice', 'options', 'category', 'type', 'status'], + searchAliases: ['choice', 'options', 'category', 'type', 'status'], }, [BasicField.CountryRegion]: { label: 'Country/Region', icon: BiFlag, isSubmitted: true, - alias: ['country', 'region', 'location', 'nationality'], + searchAliases: ['country', 'region', 'location', 'nationality'], }, [BasicField.Email]: { label: 'Email', icon: BiMailSend, isSubmitted: true, - alias: ['contact'], + searchAliases: ['contact'], }, [BasicField.HomeNo]: { label: 'Home number', icon: BiPhone, isSubmitted: true, - alias: ['phone', 'contact', 'telephone'], + searchAliases: ['phone', 'contact', 'telephone'], }, [BasicField.LongText]: { label: 'Long answer', icon: BiAlignLeft, isSubmitted: true, - alias: [ + searchAliases: [ 'text', 'description', 'comments', + 'remarks', 'feedback', 'notes', 'details', @@ -165,49 +172,55 @@ export const BASICFIELD_TO_DRAWER_META: { label: 'Mobile number', icon: BiMobile, isSubmitted: true, - alias: ['phone', 'contact', 'telephone'], + searchAliases: ['phone', 'contact', 'telephone', 'sms'], }, [BasicField.Nric]: { label: 'NRIC/FIN', icon: BiUser, isSubmitted: true, - alias: ['id', 'identification', 'national', 'singpass', 'ic number'], + searchAliases: [ + 'id', + 'identification', + 'national', + 'singpass', + 'ic number', + ], }, [BasicField.Number]: { label: 'Number', icon: BiHash, isSubmitted: true, - alias: ['age', 'quantity', 'count'], + searchAliases: ['age', 'quantity', 'count'], }, [BasicField.Radio]: { label: 'Radio', icon: BiRadioCircleMarked, isSubmitted: true, - alias: ['choice', 'options', 'mcq', 'multiple'], + searchAliases: ['choice', 'options', 'mcq', 'multiple'], }, [BasicField.Rating]: { label: 'Rating', icon: BiStar, isSubmitted: true, - alias: ['satisfaction', 'quality', 'performance'], + searchAliases: ['satisfaction', 'quality', 'performance'], }, [BasicField.ShortText]: { label: 'Short answer', icon: BiRename, isSubmitted: true, - alias: ['name', 'text'], + searchAliases: ['name', 'text'], }, [BasicField.Table]: { label: 'Table', icon: BiTable, isSubmitted: true, - alias: [ + searchAliases: [ 'grid', 'spreadsheet', 'list', @@ -223,14 +236,29 @@ export const BASICFIELD_TO_DRAWER_META: { label: 'UEN', icon: BiBuilding, isSubmitted: true, - alias: ['business id', 'company registration', 'organization number'], + searchAliases: [ + 'id', + 'business', + 'company registration', + 'organization', + 'corporation', + 'unique entity', + 'number', + ], }, [BasicField.YesNo]: { label: 'Yes/No', icon: BiToggleLeft, isSubmitted: true, - alias: ['consent', 'agreement', 'confirmation', 'approval', 'accept_terms'], + searchAliases: [ + 'consent', + 'agreement', + 'confirmation', + 'approve', + 'approval', + 'accept', + ], }, [BasicField.Children]: { @@ -254,6 +282,7 @@ export const MYINFO_FIELD_TO_DRAWER_META: { label: 'Sex', icon: BiInfinite, isSubmitted: true, + searchAliases: ['gender'], }, [MyInfoAttribute.DateOfBirth]: { label: 'Date of Birth',