Skip to content

Commit bd7477f

Browse files
committed
fix: work experience industry
1 parent ab3b2d1 commit bd7477f

File tree

3 files changed

+48
-3
lines changed

3 files changed

+48
-3
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
import { INDUSTRIES_OPTIONS } from '~/libs/shared'
1515

1616
import { WorkExpirenceCard } from '../WorkExpirenceCard'
17+
import { getIndustryOptionLabels, getIndustryOptionValues } from '../WorkExperience.utils'
1718

1819
import styles from './ModifyWorkExpirenceModal.module.scss'
1920

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

5960
const industryOptions: any = sortBy(INDUSTRIES_OPTIONS)
6061
.map(v => ({
61-
label: v,
62-
value: v,
62+
label: getIndustryOptionLabels(v),
63+
value: getIndustryOptionValues(v),
6364
}))
6465

6566
function handleModifyWorkExpirenceSave(): void {
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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+
20+
export const getIndustryOptionValues = (v: string) => {
21+
const values = Object.values(IndustryEnumToLabel)
22+
const keys = Object.keys(IndustryEnumToLabel)
23+
if (values.includes(v)) {
24+
return IndustryLabelToEnum[v]
25+
}
26+
27+
if (keys.includes(v)) {
28+
return IndustryEnumToLabel[v]
29+
}
30+
31+
return v
32+
}
33+
34+
export const getIndustryOptionLabels = (v: string) => {
35+
const keys = Object.keys(IndustryEnumToLabel)
36+
if (keys.includes(v)) {
37+
return IndustryEnumToLabel[v]
38+
}
39+
40+
return v
41+
}

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@ import moment from 'moment'
44

55
import { UserTrait } from '~/libs/core'
66

7+
import { getIndustryOptionLabels } from '../WorkExperience.utils'
8+
79
import styles from './WorkExpirenceCard.module.scss'
810

11+
912
interface WorkExpirenceCardProps {
1013
work: UserTrait
1114
isModalView?: boolean
@@ -17,7 +20,7 @@ const WorkExpirenceCard: FC<WorkExpirenceCardProps> = (props: WorkExpirenceCardP
1720
<div className={styles.workExpirenceCardHeaderLeft}>
1821
<p className='body-main-bold'>
1922
{props.work.position}
20-
{props.work.industry ? `, ${props.work.industry}` : undefined}
23+
{props.work.industry ? `, ${getIndustryOptionLabels(props.work.industry)}` : undefined}
2124
</p>
2225
<p>
2326
{props.work.company}

0 commit comments

Comments
 (0)