From 70f07f568fa19b292ed3af6a7940feaaa7a6df98 Mon Sep 17 00:00:00 2001 From: Matt Nigh Date: Mon, 30 Dec 2024 13:59:22 -0500 Subject: [PATCH 01/12] Add getClassificationLevels --- apps/web/src/pages/Classifications/helpers.tsx | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 apps/web/src/pages/Classifications/helpers.tsx diff --git a/apps/web/src/pages/Classifications/helpers.tsx b/apps/web/src/pages/Classifications/helpers.tsx new file mode 100644 index 00000000000..3ba9045741b --- /dev/null +++ b/apps/web/src/pages/Classifications/helpers.tsx @@ -0,0 +1,13 @@ +export function getClassificationLevels(): { + value: number; + label: number; +}[] { + const levels: { + value: number; + label: number; + }[] = []; + for (let i = 1; i <= 19; i++) { + levels.push({ value: i, label: i }); + } + return levels; +} From 559e2f475820f703e2840f84809a95bacd3490e2 Mon Sep 17 00:00:00 2001 From: Matt Nigh Date: Mon, 30 Dec 2024 14:04:33 -0500 Subject: [PATCH 02/12] Use getClassificationLevels --- .../Classifications/CreateClassificationPage.tsx | 14 +++----------- .../Classifications/UpdateClassificationPage.tsx | 14 +++----------- 2 files changed, 6 insertions(+), 22 deletions(-) diff --git a/apps/web/src/pages/Classifications/CreateClassificationPage.tsx b/apps/web/src/pages/Classifications/CreateClassificationPage.tsx index d1b57cdc1b3..0c0f243ddab 100644 --- a/apps/web/src/pages/Classifications/CreateClassificationPage.tsx +++ b/apps/web/src/pages/Classifications/CreateClassificationPage.tsx @@ -21,6 +21,7 @@ import pageTitles from "~/messages/pageTitles"; import Hero from "~/components/Hero"; import messages from "./messages"; +import { getClassificationLevels } from "./helpers"; type FormValues = CreateClassificationInput; @@ -168,17 +169,8 @@ export const CreateClassification = () => { rules={{ required: intl.formatMessage(errorMessages.required), }} - options={[ - { value: 1, label: "1" }, - { value: 2, label: "2" }, - { value: 3, label: "3" }, - { value: 4, label: "4" }, - { value: 5, label: "5" }, - { value: 6, label: "6" }, - { value: 7, label: "7" }, - { value: 8, label: "8" }, - { value: 9, label: "9" }, - ]} + options={getClassificationLevels()} + doNotSort /> Date: Tue, 31 Dec 2024 13:52:56 -0500 Subject: [PATCH 03/12] Add conditional for leading zero --- api/app/Models/Classification.php | 3 +-- api/app/Models/User.php | 4 +++- .../src/pages/Pools/CreatePoolPage/CreatePoolPage.tsx | 10 ++++++---- .../EditPoolPage/components/PoolNameSection/utils.ts | 2 +- .../pages/Pools/IndexPoolPage/components/helpers.tsx | 2 +- apps/web/src/utils/nameUtils.tsx | 4 ++-- apps/web/src/utils/poolUtils.tsx | 4 ++-- 7 files changed, 16 insertions(+), 13 deletions(-) diff --git a/api/app/Models/Classification.php b/api/app/Models/Classification.php index b0fb7b235bb..66ded88ec4a 100644 --- a/api/app/Models/Classification.php +++ b/api/app/Models/Classification.php @@ -52,8 +52,7 @@ protected function displayName(): Attribute { /** @disregard P1003 Not using values */ return Attribute::make( - get: fn (mixed $value, array $attributes) => $attributes['group'].'-'.sprintf('%02d', $attributes['level']), - + get: fn (mixed $value, array $attributes) => $attributes['group'].'-'.($attributes['level'] < 10 ? "0" : "").$attributes['level'], ); } diff --git a/api/app/Models/User.php b/api/app/Models/User.php index 078c5fd8fe8..27906ab9bb2 100644 --- a/api/app/Models/User.php +++ b/api/app/Models/User.php @@ -352,7 +352,9 @@ public function getClassification() $classification = $this->currentClassification()->first(); - return $classification->group.'-0'.$classification->level; + $leadingZero = $classification->level < 10 ? "0" : ""; + + return $classification->group.'-'.$leadingZero.$classification->level; } public function getDepartment() diff --git a/apps/web/src/pages/Pools/CreatePoolPage/CreatePoolPage.tsx b/apps/web/src/pages/Pools/CreatePoolPage/CreatePoolPage.tsx index cf0854efd37..47f40f7fe22 100644 --- a/apps/web/src/pages/Pools/CreatePoolPage/CreatePoolPage.tsx +++ b/apps/web/src/pages/Pools/CreatePoolPage/CreatePoolPage.tsx @@ -156,10 +156,12 @@ export const CreatePoolForm = ({ // recycled from EditPool const classificationOptions: Option[] = classifications.map( - ({ id, group, level, name }) => ({ - value: id, - label: `${group}-0${level} (${getLocalizedName(name, intl)})`, - }), + ({ id, group, level, name }) => { + return { + value: id, + label: `${group}-${level < 10 ? "0" : ""}${level} (${getLocalizedName(name, intl)})`, + }; + }, ); const departmentOptions: Option[] = departments.map(({ id, name }) => ({ diff --git a/apps/web/src/pages/Pools/EditPoolPage/components/PoolNameSection/utils.ts b/apps/web/src/pages/Pools/EditPoolPage/components/PoolNameSection/utils.ts index 7bb9f1a53ae..2c844ba9138 100644 --- a/apps/web/src/pages/Pools/EditPoolPage/components/PoolNameSection/utils.ts +++ b/apps/web/src/pages/Pools/EditPoolPage/components/PoolNameSection/utils.ts @@ -91,7 +91,7 @@ export const getClassificationOptions = ( ): Option[] => { return classifications.filter(notEmpty).map(({ id, group, level, name }) => ({ value: id, - label: `${group}-0${level} (${getLocalizedName(name, intl)})`, + label: `${group}-${level < 10 ? "0" : ""}${level} (${getLocalizedName(name, intl)})`, })); }; diff --git a/apps/web/src/pages/Pools/IndexPoolPage/components/helpers.tsx b/apps/web/src/pages/Pools/IndexPoolPage/components/helpers.tsx index 05a98208d70..5204fa08880 100644 --- a/apps/web/src/pages/Pools/IndexPoolPage/components/helpers.tsx +++ b/apps/web/src/pages/Pools/IndexPoolPage/components/helpers.tsx @@ -99,7 +99,7 @@ export function classificationCell( return ( - {`${classification.group}-0${classification.level}`} + {`${classification.group}-${classification.level < 10 ? "0" : ""}${classification.level}`} ); } diff --git a/apps/web/src/utils/nameUtils.tsx b/apps/web/src/utils/nameUtils.tsx index f83f670f306..34de078cecb 100644 --- a/apps/web/src/utils/nameUtils.tsx +++ b/apps/web/src/utils/nameUtils.tsx @@ -149,7 +149,7 @@ export const wrapAbbr = (text: ReactNode, intl: IntlShape, title?: string) => { } switch (stringifyText) { // Regex that matches all IT classifications with levels - case /[IT]-0\d/.exec(stringifyText)?.input: + case /[IT]-[0-9]\d/.exec(stringifyText)?.input: return ( @@ -165,7 +165,7 @@ export const wrapAbbr = (text: ReactNode, intl: IntlShape, title?: string) => { ); // Regex that matches all AS classifications with levels - case /[AS]-0\d/.exec(stringifyText)?.input: + case /[AS]-[0-9]\d/.exec(stringifyText)?.input: return ( diff --git a/apps/web/src/utils/poolUtils.tsx b/apps/web/src/utils/poolUtils.tsx index b7bc22be800..ac04b398c81 100644 --- a/apps/web/src/utils/poolUtils.tsx +++ b/apps/web/src/utils/poolUtils.tsx @@ -85,7 +85,7 @@ export const formatClassificationString = ({ group, level, }: formatClassificationStringProps): string => { - return `${group}-0${level}`; + return `${group}-${level < 10 ? "0" : ""}${level}`; }; interface formattedPoolPosterTitleProps { title: Maybe | undefined; @@ -457,7 +457,7 @@ export function getClassificationName( { group, level, name }: Pick, intl: IntlShape, ) { - const groupLevelStr = `${group}-0${level}`; + const groupLevelStr = `${group}-${level < 10 ? "0" : ""}${level}`; if (!name) { return groupLevelStr; From 632d1b957554c238d3795906cdbbc88c24b9dd4d Mon Sep 17 00:00:00 2001 From: Matt Nigh Date: Tue, 31 Dec 2024 14:00:49 -0500 Subject: [PATCH 04/12] Add conditional for leading zero --- .../Profile/components/GovernmentInformation/Display.tsx | 2 +- .../ProfileSections/GovernmentInformationSection.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/web/src/components/Profile/components/GovernmentInformation/Display.tsx b/apps/web/src/components/Profile/components/GovernmentInformation/Display.tsx index 834be2480cf..da2e0fa4ffa 100644 --- a/apps/web/src/components/Profile/components/GovernmentInformation/Display.tsx +++ b/apps/web/src/components/Profile/components/GovernmentInformation/Display.tsx @@ -133,7 +133,7 @@ const Display = ({ > {!!currentClassification?.group && !!currentClassification?.level ? wrapAbbr( - `${currentClassification?.group}-${currentClassification?.level}`, + `${currentClassification?.group}-${currentClassification?.level < 10 ? "0" : ""}${currentClassification?.level}`, intl, ) : notProvided} diff --git a/apps/web/src/components/UserProfile/ProfileSections/GovernmentInformationSection.tsx b/apps/web/src/components/UserProfile/ProfileSections/GovernmentInformationSection.tsx index b7ffb25f791..dfb74a4ba1f 100644 --- a/apps/web/src/components/UserProfile/ProfileSections/GovernmentInformationSection.tsx +++ b/apps/web/src/components/UserProfile/ProfileSections/GovernmentInformationSection.tsx @@ -110,7 +110,7 @@ const GovernmentInformationSection = ({ {wrapAbbr( - `${currentClassification?.group}-${currentClassification?.level}`, + `${currentClassification?.group}-${currentClassification?.level < 10 ? "0" : ""}${currentClassification?.level}`, intl, )} From 9eba13f352d9babde007c21192de6e191715a0f2 Mon Sep 17 00:00:00 2001 From: Matt Nigh Date: Tue, 31 Dec 2024 14:08:25 -0500 Subject: [PATCH 05/12] Fix syntax --- api/app/Models/Classification.php | 2 +- api/app/Models/User.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/api/app/Models/Classification.php b/api/app/Models/Classification.php index 66ded88ec4a..60ef232398a 100644 --- a/api/app/Models/Classification.php +++ b/api/app/Models/Classification.php @@ -52,7 +52,7 @@ protected function displayName(): Attribute { /** @disregard P1003 Not using values */ return Attribute::make( - get: fn (mixed $value, array $attributes) => $attributes['group'].'-'.($attributes['level'] < 10 ? "0" : "").$attributes['level'], + get: fn (mixed $value, array $attributes) => $attributes['group'].'-'.($attributes['level'] < 10 ? '0' : '').$attributes['level'], ); } diff --git a/api/app/Models/User.php b/api/app/Models/User.php index 27906ab9bb2..47b30076ed6 100644 --- a/api/app/Models/User.php +++ b/api/app/Models/User.php @@ -352,7 +352,7 @@ public function getClassification() $classification = $this->currentClassification()->first(); - $leadingZero = $classification->level < 10 ? "0" : ""; + $leadingZero = $classification->level < 10 ? '0' : ''; return $classification->group.'-'.$leadingZero.$classification->level; } From fa480365528c1633e3e837d0a395a085ffae4b2e Mon Sep 17 00:00:00 2001 From: Matt Nigh Date: Fri, 3 Jan 2025 09:28:42 -0500 Subject: [PATCH 06/12] Sort classification level options numerically --- .../ExperienceFormFields/WorkFields/GovFields.tsx | 6 ++++-- .../Profile/components/GovernmentInformation/FormFields.tsx | 6 +++++- .../Profile/components/GovernmentInformation/utils.ts | 2 +- .../EmployeeInformationPage/EmployeeInformationPage.tsx | 2 +- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/apps/web/src/components/ExperienceFormFields/WorkFields/GovFields.tsx b/apps/web/src/components/ExperienceFormFields/WorkFields/GovFields.tsx index 9a5fc905da4..9a60778f1dc 100644 --- a/apps/web/src/components/ExperienceFormFields/WorkFields/GovFields.tsx +++ b/apps/web/src/components/ExperienceFormFields/WorkFields/GovFields.tsx @@ -164,9 +164,10 @@ const GovFields = ({ labels }: SubExperienceFormProps) => { .map((iterator) => { return { value: iterator.id.toString(), // change the value to id for the query - label: iterator.level.toString(), + label: iterator.level, }; - }); + }) + .sort((a, b) => a.label - b.label); /** * Reset classification level when group changes @@ -356,6 +357,7 @@ const GovFields = ({ labels }: SubExperienceFormProps) => { uiMessages.nullSelectionOptionLevel, )} options={levelOptions} + doNotSort /> diff --git a/apps/web/src/components/Profile/components/GovernmentInformation/FormFields.tsx b/apps/web/src/components/Profile/components/GovernmentInformation/FormFields.tsx index 21d451608ba..0ee79b85742 100644 --- a/apps/web/src/components/Profile/components/GovernmentInformation/FormFields.tsx +++ b/apps/web/src/components/Profile/components/GovernmentInformation/FormFields.tsx @@ -114,7 +114,10 @@ const FormFields = ({ ]); const groupOptions = getGroupOptions([...classifications], intl); - const levelOptions = getLevelOptions([...classifications], groupSelection); + const levelOptions = getLevelOptions( + [...classifications], + groupSelection, + ).sort((a, b) => a.value - b.value); const hasPriorityEntitlement = priorityEntitlement === "yes"; const isGovEmployee = govEmployee === "yes"; const isPlaced = @@ -272,6 +275,7 @@ const FormFields = ({ uiMessages.nullSelectionOptionLevel, )} options={levelOptions} + doNotSort /> )} diff --git a/apps/web/src/components/Profile/components/GovernmentInformation/utils.ts b/apps/web/src/components/Profile/components/GovernmentInformation/utils.ts index 4c0d7de3ad7..c14ba928ddd 100644 --- a/apps/web/src/components/Profile/components/GovernmentInformation/utils.ts +++ b/apps/web/src/components/Profile/components/GovernmentInformation/utils.ts @@ -239,7 +239,7 @@ export const getLevelOptions = ( .filter((x) => x.group === groupSelection) .map((iterator) => { return { - value: iterator.level.toString(), + value: iterator.level, label: iterator.level.toString(), }; }); diff --git a/apps/web/src/pages/Auth/RegistrationPages/EmployeeInformationPage/EmployeeInformationPage.tsx b/apps/web/src/pages/Auth/RegistrationPages/EmployeeInformationPage/EmployeeInformationPage.tsx index 91ff03e397b..e218f0fed81 100644 --- a/apps/web/src/pages/Auth/RegistrationPages/EmployeeInformationPage/EmployeeInformationPage.tsx +++ b/apps/web/src/pages/Auth/RegistrationPages/EmployeeInformationPage/EmployeeInformationPage.tsx @@ -136,7 +136,7 @@ export const EmployeeInformationFormFields = ({ .filter((x) => x.group === groupSelection) .map((iterator) => { return { - value: iterator.level.toString(), + value: iterator.level, label: iterator.level.toString(), }; }); From fa6195a8a240929e4315ffb6948c98ccfd8179ae Mon Sep 17 00:00:00 2001 From: Matt Nigh Date: Mon, 6 Jan 2025 10:03:11 -0500 Subject: [PATCH 07/12] Sort classification level options numerically --- .../EmployeeInformationPage/EmployeeInformationPage.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/web/src/pages/Auth/RegistrationPages/EmployeeInformationPage/EmployeeInformationPage.tsx b/apps/web/src/pages/Auth/RegistrationPages/EmployeeInformationPage/EmployeeInformationPage.tsx index e218f0fed81..9b1951ce399 100644 --- a/apps/web/src/pages/Auth/RegistrationPages/EmployeeInformationPage/EmployeeInformationPage.tsx +++ b/apps/web/src/pages/Auth/RegistrationPages/EmployeeInformationPage/EmployeeInformationPage.tsx @@ -139,7 +139,8 @@ export const EmployeeInformationFormFields = ({ value: iterator.level, label: iterator.level.toString(), }; - }); + }) + .sort((a, b) => a.value - b.value); const isGovEmployee = govEmployee === "yes"; @@ -345,6 +346,7 @@ export const EmployeeInformationFormFields = ({ uiMessages.nullSelectionOptionLevel, )} options={levelOptions} + doNotSort /> From 3c83c58224e058391d6292c3bc7218724ddc3e73 Mon Sep 17 00:00:00 2001 From: Matt Nigh Date: Mon, 6 Jan 2025 10:35:57 -0500 Subject: [PATCH 08/12] Add conditional for leading zero --- apps/playwright/tests/search-workflows.spec.ts | 4 ++-- .../ExperienceCard/WorkContent/GovContent.tsx | 4 ++-- .../PoolCandidateFilterDialog.tsx | 2 +- apps/web/src/components/PoolCard/PoolCard.tsx | 2 +- .../SearchRequestFilters/SearchRequestFilters.tsx | 12 +++++++++--- .../components/SearchRequestFilterDialog.tsx | 2 +- .../SearchRequestTable/components/helpers.tsx | 6 +++--- .../JobPosterTemplatesPage.tsx | 4 ++-- .../components/EducationRequirementsSection.tsx | 5 ++++- .../IndexPoolPage/components/PoolFilterDialog.tsx | 2 +- .../pages/Pools/IndexPoolPage/components/helpers.tsx | 2 +- .../web/src/pages/SearchRequests/SearchPage/utils.ts | 2 +- 12 files changed, 28 insertions(+), 19 deletions(-) diff --git a/apps/playwright/tests/search-workflows.spec.ts b/apps/playwright/tests/search-workflows.spec.ts index c34364f6320..aedddab0523 100644 --- a/apps/playwright/tests/search-workflows.spec.ts +++ b/apps/playwright/tests/search-workflows.spec.ts @@ -134,7 +134,7 @@ test.describe("Talent search", () => { await expectNoCandidate(appPage.page); await classificationFilter.selectOption({ - value: `${classification.group}-0${classification.level}`, + value: `${classification.group}-${classification.level < 10 ? "0" : ""}${classification.level}`, }); const streamFilter = appPage.page.getByRole("combobox", { @@ -221,7 +221,7 @@ test.describe("Talent search", () => { await expect( appPage.page.getByText( new RegExp( - `${classification.group}-0${classification.level}: search pool`, + `${classification.group}-${classification.level < 10 ? "0" : ""}${classification.level}: search pool`, "i", ), ), diff --git a/apps/web/src/components/ExperienceCard/WorkContent/GovContent.tsx b/apps/web/src/components/ExperienceCard/WorkContent/GovContent.tsx index 45514c8ffe1..e7f4100ff40 100644 --- a/apps/web/src/components/ExperienceCard/WorkContent/GovContent.tsx +++ b/apps/web/src/components/ExperienceCard/WorkContent/GovContent.tsx @@ -78,7 +78,7 @@ const GovContent = ({ headingLevel={headingLevel} > {classification - ? `${classification.group}-0${classification.level}` + ? `${classification.group}-${classification.level < 10 ? "0" : ""}${classification.level}` : intl.formatMessage(commonMessages.notAvailable)} @@ -122,7 +122,7 @@ const GovContent = ({ headingLevel={headingLevel} > {classification - ? `${classification.group}-0${classification.level}` + ? `${classification.group}-${classification.level < 10 ? "0" : ""}${classification.level}` : intl.formatMessage(commonMessages.notAvailable)} diff --git a/apps/web/src/components/PoolCandidatesTable/PoolCandidateFilterDialog.tsx b/apps/web/src/components/PoolCandidatesTable/PoolCandidateFilterDialog.tsx index 858332d61df..16d2177ee21 100644 --- a/apps/web/src/components/PoolCandidatesTable/PoolCandidateFilterDialog.tsx +++ b/apps/web/src/components/PoolCandidatesTable/PoolCandidateFilterDialog.tsx @@ -206,7 +206,7 @@ const PoolCandidateFilterDialog = ({ label={intl.formatMessage(adminMessages.classifications)} options={classifications.map(({ group, level }) => ({ value: `${group}-${level}`, - label: `${group}-0${level}`, + label: `${group}-${level < 10 ? "0" : ""}${level}`, }))} /> { const classificationAbbr = pool.classification ? wrapAbbr( - `${pool.classification.group}-0${pool.classification.level}`, + `${pool.classification.group}-${pool.classification.level < 10 ? "0" : ""}${pool.classification.level}`, intl, ) : ""; diff --git a/apps/web/src/components/SearchRequestFilters/SearchRequestFilters.tsx b/apps/web/src/components/SearchRequestFilters/SearchRequestFilters.tsx index 7ebe703db46..6c9c17d837e 100644 --- a/apps/web/src/components/SearchRequestFilters/SearchRequestFilters.tsx +++ b/apps/web/src/components/SearchRequestFilters/SearchRequestFilters.tsx @@ -44,14 +44,20 @@ const ApplicantFilters = ({ // else set values if filters prop is of ApplicantFilterInput type const classificationsFromBrowserHistory = selectedClassifications?.map( (classification) => - wrapAbbr(`${classification?.group}-0${classification?.level}`, intl), + wrapAbbr( + `${classification?.group}-${classification?.level < 10 ? "0" : ""}${classification?.level}`, + intl, + ), ); const classifications = applicantFilter?.qualifiedClassifications ?? []; const classificationsFromApplicantFilter = classifications .filter(notEmpty) .map((classification) => - wrapAbbr(`${classification?.group}-0${classification?.level}`, intl), + wrapAbbr( + `${classification?.group}-${classification?.level < 10 ? "0" : ""}${classification?.level}`, + intl, + ), ); const skills: string[] | undefined = applicantFilter?.skills?.map((skill) => { @@ -270,7 +276,7 @@ const SearchRequestFilters = ({ const classifications: string[] | undefined = poolCandidateFilter?.classifications?.map( (classification) => - `${classification?.group.toLocaleUpperCase()}-0${classification?.level}`, + `${classification?.group.toLocaleUpperCase()}-${classification?.level < 10 ? "0" : ""}${classification?.level}`, ); const pools: Pool[] | undefined = poolCandidateFilter diff --git a/apps/web/src/components/SearchRequestTable/components/SearchRequestFilterDialog.tsx b/apps/web/src/components/SearchRequestTable/components/SearchRequestFilterDialog.tsx index 7e0e8c7f665..b81f27c320d 100644 --- a/apps/web/src/components/SearchRequestTable/components/SearchRequestFilterDialog.tsx +++ b/apps/web/src/components/SearchRequestTable/components/SearchRequestFilterDialog.tsx @@ -129,7 +129,7 @@ const SearchRequestFilterDialog = ({ label={intl.formatMessage(adminMessages.classifications)} options={classifications.map((classification) => ({ value: classification.id, - label: `${classification.group}-0${classification.level}`, + label: `${classification.group}-${classification.level < 10 ? "0" : ""}${classification.level}`, }))} /> `${c.group}-0${c.level}`) + ?.map((c) => `${c.group}-${level < 10 ? "0" : ""}${c.level}`) ?.join(", "); } @@ -34,10 +34,10 @@ export function classificationsCell( const chipsArray = filteredClassifications.map((classification) => { return ( - {`${classification.group}-0${classification.level}`} + {`${classification.group}-${classification.level < 10 ? "0" : ""}${classification.level}`} ); }); diff --git a/apps/web/src/pages/JobPosterTemplates/JobPosterTemplatesPage/JobPosterTemplatesPage.tsx b/apps/web/src/pages/JobPosterTemplates/JobPosterTemplatesPage/JobPosterTemplatesPage.tsx index d0a08084f09..3277b3e845b 100644 --- a/apps/web/src/pages/JobPosterTemplates/JobPosterTemplatesPage/JobPosterTemplatesPage.tsx +++ b/apps/web/src/pages/JobPosterTemplates/JobPosterTemplatesPage/JobPosterTemplatesPage.tsx @@ -132,7 +132,7 @@ function previewMetaData( metaData.push({ key: classification.id, type: "chip", - children: `${classification.group}-0${classification.level}`, + children: `${classification.group}-${classification.level < 10 ? "0" : ""}${classification.level}`, } satisfies PreviewMetaData); } @@ -356,7 +356,7 @@ const JobPosterTemplatesPage = () => { .sort((a, b) => a.level - b.level) .map((classification) => ({ value: classification.id, - label: `${classification.group}-0${classification.level}`, + label: `${classification.group}-${classification.level < 10 ? "0" : ""}${classification.level}`, }))} /> ({ value: `${group}-${level}`, - label: `${group}-0${level}`, + label: `${group}-${level < 10 ? "0" : ""}${level}`, }), )} /> diff --git a/apps/web/src/pages/Pools/IndexPoolPage/components/helpers.tsx b/apps/web/src/pages/Pools/IndexPoolPage/components/helpers.tsx index 5204fa08880..24e4d60aaf5 100644 --- a/apps/web/src/pages/Pools/IndexPoolPage/components/helpers.tsx +++ b/apps/web/src/pages/Pools/IndexPoolPage/components/helpers.tsx @@ -88,7 +88,7 @@ export function classificationAccessor( classification: Maybe> | undefined, ) { return classification - ? `${classification.group}-0${classification.level}` + ? `${classification.group}-${classification.level < 10 ? "0" : ""}${classification.level}` : ""; } diff --git a/apps/web/src/pages/SearchRequests/SearchPage/utils.ts b/apps/web/src/pages/SearchRequests/SearchPage/utils.ts index cda3a7fc2e0..191c76985fe 100644 --- a/apps/web/src/pages/SearchRequests/SearchPage/utils.ts +++ b/apps/web/src/pages/SearchRequests/SearchPage/utils.ts @@ -25,7 +25,7 @@ export const getClassificationLabel = ( labels: Record, intl: IntlShape, ) => { - const key = `${group}-0${level}`; + const key = `${group}-${level < 10 ? "0" : ""}${level}`; return !hasKey(labels, key) ? key : intl.formatMessage(labels[key]); }; From 3ecdaea8c77cc8a8ca2dd0df2ff30e14714288ac Mon Sep 17 00:00:00 2001 From: Matt Nigh Date: Mon, 6 Jan 2025 10:54:16 -0500 Subject: [PATCH 09/12] Update wrapAbbr cases --- apps/web/src/utils/nameUtils.tsx | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/apps/web/src/utils/nameUtils.tsx b/apps/web/src/utils/nameUtils.tsx index 34de078cecb..3ad0b652ee3 100644 --- a/apps/web/src/utils/nameUtils.tsx +++ b/apps/web/src/utils/nameUtils.tsx @@ -148,8 +148,8 @@ export const wrapAbbr = (text: ReactNode, intl: IntlShape, title?: string) => { ); } switch (stringifyText) { - // Regex that matches all IT classifications with levels - case /[IT]-[0-9]\d/.exec(stringifyText)?.input: + // Regex that matches IT classifications with levels from 01-09 + case /[IT]-0\d/.exec(stringifyText)?.input: return ( @@ -157,6 +157,15 @@ export const wrapAbbr = (text: ReactNode, intl: IntlShape, title?: string) => { ); + // Regex that matches IT classifications with levels from 10 and up + case /[IT]-\d/.exec(stringifyText)?.input: + return ( + + + {text} + + + ); // Regex that matches all IT(en)/TI(fr) case /[IT][TI]/.exec(stringifyText)?.input: return ( @@ -164,8 +173,8 @@ export const wrapAbbr = (text: ReactNode, intl: IntlShape, title?: string) => { {text} ); - // Regex that matches all AS classifications with levels - case /[AS]-[0-9]\d/.exec(stringifyText)?.input: + // Regex that matches AS classifications with levels from 01-09 + case /[AS]-0\d/.exec(stringifyText)?.input: return ( @@ -173,6 +182,15 @@ export const wrapAbbr = (text: ReactNode, intl: IntlShape, title?: string) => { ); + // Regex that matches AS classifications with levels from 10 and up + case /[AS]-\d/.exec(stringifyText)?.input: + return ( + + + {text} + + + ); case /AS/.exec(stringifyText)?.input: return ( From 369b1eb61396f5914151d0805a82f9438df0f07d Mon Sep 17 00:00:00 2001 From: Matt Nigh Date: Mon, 6 Jan 2025 11:06:08 -0500 Subject: [PATCH 10/12] Fix name --- .../src/components/SearchRequestTable/components/helpers.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/web/src/components/SearchRequestTable/components/helpers.tsx b/apps/web/src/components/SearchRequestTable/components/helpers.tsx index ac7dd1cb2f4..2320f71775f 100644 --- a/apps/web/src/components/SearchRequestTable/components/helpers.tsx +++ b/apps/web/src/components/SearchRequestTable/components/helpers.tsx @@ -18,7 +18,7 @@ export function classificationAccessor( ) { return classifications ?.filter(notEmpty) - ?.map((c) => `${c.group}-${level < 10 ? "0" : ""}${c.level}`) + ?.map((c) => `${c.group}-${c.level < 10 ? "0" : ""}${c.level}`) ?.join(", "); } From 71f6c9c88a4a2cb954637bb8bac2b2909eaca9c1 Mon Sep 17 00:00:00 2001 From: Matt Nigh Date: Mon, 6 Jan 2025 11:06:14 -0500 Subject: [PATCH 11/12] Fix conditional --- .../components/SearchRequestFilters/SearchRequestFilters.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/web/src/components/SearchRequestFilters/SearchRequestFilters.tsx b/apps/web/src/components/SearchRequestFilters/SearchRequestFilters.tsx index 6c9c17d837e..691421b0ad3 100644 --- a/apps/web/src/components/SearchRequestFilters/SearchRequestFilters.tsx +++ b/apps/web/src/components/SearchRequestFilters/SearchRequestFilters.tsx @@ -276,7 +276,7 @@ const SearchRequestFilters = ({ const classifications: string[] | undefined = poolCandidateFilter?.classifications?.map( (classification) => - `${classification?.group.toLocaleUpperCase()}-${classification?.level < 10 ? "0" : ""}${classification?.level}`, + `${classification?.group.toLocaleUpperCase()}-${classification && classification?.level < 10 ? "0" : ""}${classification?.level}`, ); const pools: Pool[] | undefined = poolCandidateFilter From 9f0dcd63f0dd2d766d2969241c916d52879a75d1 Mon Sep 17 00:00:00 2001 From: Matt Nigh Date: Mon, 6 Jan 2025 11:41:08 -0500 Subject: [PATCH 12/12] Fix conditional --- .../components/SearchRequestFilters/SearchRequestFilters.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/web/src/components/SearchRequestFilters/SearchRequestFilters.tsx b/apps/web/src/components/SearchRequestFilters/SearchRequestFilters.tsx index 691421b0ad3..231c250c2e3 100644 --- a/apps/web/src/components/SearchRequestFilters/SearchRequestFilters.tsx +++ b/apps/web/src/components/SearchRequestFilters/SearchRequestFilters.tsx @@ -45,7 +45,7 @@ const ApplicantFilters = ({ const classificationsFromBrowserHistory = selectedClassifications?.map( (classification) => wrapAbbr( - `${classification?.group}-${classification?.level < 10 ? "0" : ""}${classification?.level}`, + `${classification?.group}-${classification && classification?.level < 10 ? "0" : ""}${classification?.level}`, intl, ), );