Skip to content

Commit 399862d

Browse files
committed
Merge branch 'feat/v6' of github.com:topcoder-platform/platform-ui into feat/v6
2 parents 9b1890c + 5f68c79 commit 399862d

File tree

5 files changed

+49
-7
lines changed

5 files changed

+49
-7
lines changed

src/apps/onboarding/src/components/modal-add-work/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import classNames from 'classnames'
44
import moment from 'moment'
55

66
import { Button, IconSolid, InputDatePicker, InputSelect, InputText, Tooltip } from '~/libs/ui'
7-
import { INDUSTRIES_OPTIONS } from '~/libs/shared'
7+
import { getIndustryOptionLabel, getIndustryOptionValue, INDUSTRIES_OPTIONS } from '~/libs/shared'
88

99
import FormInputCheckbox from '../form-input-checkbox'
1010
import OnboardingBaseModal from '../onboarding-base-modal'
@@ -23,8 +23,8 @@ interface ModalAddWorkProps {
2323

2424
const industryOptions: any = _.sortBy(INDUSTRIES_OPTIONS)
2525
.map(v => ({
26-
label: v,
27-
value: v,
26+
label: getIndustryOptionLabel(v),
27+
value: getIndustryOptionValue(v),
2828
}))
2929

3030
const ModalAddWork: FC<ModalAddWorkProps> = (props: ModalAddWorkProps) => {

src/apps/profiles/src/member-profile/work-expirence/ModifyWorkExpirenceModal/ModifyWorkExpirenceModal.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
UserTraitCategoryNames,
1212
UserTraitIds,
1313
} from '~/libs/core'
14-
import { INDUSTRIES_OPTIONS } from '~/libs/shared'
14+
import { getIndustryOptionLabel, getIndustryOptionValue, INDUSTRIES_OPTIONS } from '~/libs/shared'
1515

1616
import { WorkExpirenceCard } from '../WorkExpirenceCard'
1717

@@ -58,8 +58,8 @@ const ModifyWorkExpirenceModal: FC<ModifyWorkExpirenceModalProps> = (props: Modi
5858

5959
const industryOptions: any = sortBy(INDUSTRIES_OPTIONS)
6060
.map(v => ({
61-
label: v,
62-
value: v,
61+
label: getIndustryOptionLabel(v),
62+
value: getIndustryOptionValue(v),
6363
}))
6464

6565
function handleModifyWorkExpirenceSave(): void {

src/apps/profiles/src/member-profile/work-expirence/WorkExpirenceCard/WorkExpirenceCard.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import classNames from 'classnames'
33
import moment from 'moment'
44

55
import { UserTrait } from '~/libs/core'
6+
import { getIndustryOptionLabel } from '~/libs/shared'
67

78
import styles from './WorkExpirenceCard.module.scss'
89

@@ -17,7 +18,7 @@ const WorkExpirenceCard: FC<WorkExpirenceCardProps> = (props: WorkExpirenceCardP
1718
<div className={styles.workExpirenceCardHeaderLeft}>
1819
<p className='body-main-bold'>
1920
{props.work.position}
20-
{props.work.industry ? `, ${props.work.industry}` : undefined}
21+
{props.work.industry ? `, ${getIndustryOptionLabel(props.work.industry)}` : undefined}
2122
</p>
2223
<p>
2324
{props.work.company}

src/libs/shared/lib/utils/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@ export * from './copy-text-to-clipboard'
22
export * from './files'
33
export * from './generic-data-object.type'
44
export * from './handle-error'
5+
export * from './industry'
56
export * from './string'
67
export * from './text-format'
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
export const IndustryEnumToLabel: {
2+
[key: string]: string
3+
} = {
4+
ConsumerGoods: 'Consumer goods',
5+
PublicSector: 'Public sector',
6+
TechAndTechnologyService: 'Tech & technology services',
7+
TravelAndHospitality: 'Travel & hospitality',
8+
}
9+
10+
export const IndustryLabelToEnum: {
11+
[key: string]: string
12+
} = {
13+
'Consumer goods': 'ConsumerGoods',
14+
'Public sector': 'PublicSector',
15+
'Tech & technology services': 'TechAndTechnologyService',
16+
'Travel & hospitality': 'TravelAndHospitality',
17+
}
18+
19+
export const getIndustryOptionValue = (v: string): string => {
20+
const values = Object.values(IndustryEnumToLabel)
21+
const keys = Object.keys(IndustryEnumToLabel)
22+
if (values.includes(v)) {
23+
return IndustryLabelToEnum[v]
24+
}
25+
26+
if (keys.includes(v)) {
27+
return IndustryEnumToLabel[v]
28+
}
29+
30+
return v
31+
}
32+
33+
export const getIndustryOptionLabel = (v: string): string => {
34+
const keys = Object.keys(IndustryEnumToLabel)
35+
if (keys.includes(v)) {
36+
return IndustryEnumToLabel[v]
37+
}
38+
39+
return v
40+
}

0 commit comments

Comments
 (0)