Skip to content

Commit e46c438

Browse files
yashwincleacos
authored andcommitted
Address PR comments
t pus
1 parent 2cea934 commit e46c438

File tree

2 files changed

+22
-24
lines changed

2 files changed

+22
-24
lines changed

client/a8c-for-agencies/sections/partner-directory/components/hooks/use-form-selectors.ts

+20-19
Original file line numberDiff line numberDiff line change
@@ -28,31 +28,32 @@ export function useFormSelectors() {
2828
headless_wordpress_and_woo: translate( 'Headless WordPress & Woo' ),
2929
};
3030

31+
// Always sort the industries alphabetically
3132
const availableIndustries: Record< string, string > = {
32-
technology_and_it_services: translate( 'Technology & IT Services' ),
33+
agriculture_and_farming: translate( 'Agriculture & Farming' ),
34+
arts_and_culture: translate( 'Arts & Culture' ),
35+
automotive_and_transportation: translate( 'Automotive & Transportation' ),
36+
construction_and_engineering: translate( 'Construction & Engineering' ),
37+
education_and_e_learning: translate( 'Education & E-Learning' ),
3338
e_commerce_and_retail: translate( 'E-commerce & Retail' ),
39+
energy_and_utilities: translate( 'Energy & Utilities' ),
40+
entertainment_and_media: translate( 'Entertainment & Media' ),
41+
environmental_and_sustainability: translate( 'Environmental & Sustainability' ),
42+
events_and_conferences: translate( 'Events & Conferences' ),
43+
fashion_and_beauty: translate( 'Fashion & Beauty' ),
3444
finance_and_insurance: translate( 'Finance & Insurance' ),
45+
food_and_beverage: translate( 'Food & Beverage' ),
46+
government_and_public_services: translate( 'Government & Public Services' ),
3547
healthcare_and_medical: translate( 'Healthcare & Medical' ),
36-
education_and_e_learning: translate( 'Education & E-Learning' ),
37-
real_estate_and_property: translate( 'Real Estate & Property' ),
38-
travel_and_hospitality: translate( 'Travel & Hospitality' ),
39-
nonprofits_and_ngos: translate( 'Nonprofits & NGOs' ),
4048
legal_and_professional_services: translate( 'Legal & Professional Services' ),
41-
entertainment_and_media: translate( 'Entertainment & Media' ),
42-
construction_and_engineering: translate( 'Construction & Engineering' ),
43-
automotive_and_transportation: translate( 'Automotive & Transportation' ),
44-
government_and_public_services: translate( 'Government & Public Services' ),
45-
marketing_and_advertising: translate( 'Marketing & Advertising' ),
46-
food_and_beverage: translate( 'Food & Beverage' ),
49+
logistics_and_supply_chain: translate( 'Logistics & Supply Chain' ),
4750
manufacturing_and_industry: translate( 'Manufacturing & Industry' ),
48-
energy_and_utilities: translate( 'Energy & Utilities' ),
51+
marketing_and_advertising: translate( 'Marketing & Advertising' ),
52+
nonprofits_and_ngos: translate( 'Nonprofits & NGOs' ),
53+
real_estate_and_property: translate( 'Real Estate & Property' ),
4954
sports_and_recreation: translate( 'Sports & Recreation' ),
50-
agriculture_and_farming: translate( 'Agriculture & Farming' ),
51-
arts_and_culture: translate( 'Arts & Culture' ),
52-
environmental_and_sustainability: translate( 'Environmental & Sustainability' ),
53-
fashion_and_beauty: translate( 'Fashion & Beauty' ),
54-
logistics_and_supply_chain: translate( 'Logistics & Supply Chain' ),
55-
events_and_conferences: translate( 'Events & Conferences' ),
55+
technology_and_it_services: translate( 'Technology & IT Services' ),
56+
travel_and_hospitality: translate( 'Travel & Hospitality' ),
5657
};
5758

5859
const availableProducts: Record< string, string > = {
@@ -88,7 +89,7 @@ export function useFormSelectors() {
8889
availableLanguages,
8990
availableProducts,
9091
availableDirectories,
91-
availableIndustries: Object.fromEntries( Object.entries( availableIndustries ).sort() ),
92+
availableIndustries,
9293
oldIndustries,
9394
};
9495
}

client/a8c-for-agencies/sections/partner-directory/components/industries-selector.tsx

+2-5
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,12 @@ const IndustriesSelector = ( { setIndustries, industries }: Props ) => {
3030
[ availableIndustriesByLabel, setIndustries ]
3131
);
3232

33-
// Get the selected industries by label
33+
// Get the selected industries by label, and remove any duplicates
3434
const selectedIndustriesByLabel = Array.from(
3535
new Set(
3636
industries.flatMap( ( slug ) => {
3737
const key = slug as string;
38-
const value =
39-
key in oldIndustries
40-
? availableIndustries[ oldIndustries[ key ] ]
41-
: availableIndustries[ key ];
38+
const value = availableIndustries[ oldIndustries[ key ] ?? key ];
4239
return value ? [ value ] : [];
4340
} )
4441
)

0 commit comments

Comments
 (0)