Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/apps/onboarding/src/components/skill-tag/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,18 @@ import styles from './styles.module.scss'
interface SkillTagProps {
skill: Skill
onDelete?: () => void
disabled?: boolean
}

const SkillTag: FC<SkillTagProps> = (props: SkillTagProps) => (
<div className={classNames('d-flex align-items-center', styles.container)}>
{props.skill.name}
<button type='button' className={styles.btnDelete} onClick={props.onDelete}>
<button
type='button'
className={styles.btnDelete}
onClick={props.onDelete}
disabled={props.disabled}
>
<img width={7} height={7} src={XIcon} alt='' />
</button>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,8 @@
flex-shrink: 0;
width: 15px;
height: 15px;

&:disabled {
opacity: 0.2;
}
}
37 changes: 24 additions & 13 deletions src/apps/onboarding/src/pages/educations/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,25 @@ export const PageEducationsContent: FC<{
/* eslint-disable react-hooks/exhaustive-deps */
}, [props.reduxEducations])

useEffect(() => {
const saveData: any = async () => {
setLoading(true)
if (!props.reduxEducations) {
await props.createMemberEducations(educations || [])
} else {
await props.updateMemberEducations(educations || [])
}

setLoading(false)
}

if (!!educations && !_.isEqual(props.reduxEducations, educations)) {
saveData()
.then(_.noop)
}
/* eslint-disable react-hooks/exhaustive-deps */
}, [educations])

return (
<div className={classNames('d-flex flex-column', styles.container)}>
<h2>Add your education information</h2>
Expand All @@ -57,13 +76,17 @@ export const PageEducationsContent: FC<{
setEditingEducation(education)
setShowAddEducationModal(true)
}}
disabled={loading}
className={styles.btn}
>
<img width={15} height={15} src={IconEdit} alt='' />
</button>
<button
aria-label='edit'
type='button'
onClick={() => setEducations(_.filter(educations, w => w.id !== education.id))}
disabled={loading}
className={styles.btn}
>
<img width={15} height={15} src={IconTrash} alt='' />
</button>
Expand Down Expand Up @@ -111,19 +134,7 @@ export const PageEducationsContent: FC<{
size='lg'
primary
iconToLeft
disabled={loading || props.loadingMemberTraits}
onClick={async () => {
setLoading(true)
if (!_.isEqual(props.reduxEducations, educations)) {
if (!props.reduxEducations) {
await props.createMemberEducations(educations || [])
} else {
await props.updateMemberEducations(educations || [])
}
}

setLoading(false)
}}
disabled={loading}
>
next
</Button>
Expand Down
4 changes: 4 additions & 0 deletions src/apps/onboarding/src/pages/educations/styles.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@
margin-top: auto;
margin-bottom: 32px;
}

.btn:disabled {
opacity: 0.2;
}
26 changes: 17 additions & 9 deletions src/apps/onboarding/src/pages/skills/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,20 @@ const PageSkillsContent: FC<{
/* eslint-disable react-hooks/exhaustive-deps */
}, [props.memberInfo])

useEffect(() => {
const saveData: any = async () => {
setLoading(true)
await props.updateMemberSkills([...(skillsFilter || [])])
setLoading(false)
}

if (!!skillsFilter && !_.isEqual(props.memberInfo?.emsiSkills, skillsFilter)) {
saveData()
.then(_.noop)
}
/* eslint-disable react-hooks/exhaustive-deps */
}, [skillsFilter])

return (
<div className={classNames('d-flex flex-column', styles.container)}>
<h2>What skills do you have?</h2>
Expand All @@ -58,6 +72,7 @@ const PageSkillsContent: FC<{
<SkillTag
key={skillItem.name}
skill={skillItem}
disabled={loading}
onDelete={() => {
setSkillsFilter(
_.filter(skillsFilter, skill => skill.name !== skillItem.name),
Expand Down Expand Up @@ -121,6 +136,7 @@ const PageSkillsContent: FC<{
size='lg'
primary
iconToLeft
disabled={loading}
onClick={() => navigate('../start')}
>
back
Expand All @@ -130,15 +146,7 @@ const PageSkillsContent: FC<{
primary
iconToLeft
disabled={loading}
onClick={async () => {
setLoading(true)
if (!_.isEqual(props.memberInfo?.emsiSkills, skillsFilter)) {
await props.updateMemberSkills([...(skillsFilter || [])])
}

setLoading(false)
navigate('../works')
}}
onClick={() => navigate('../works')}
>
next
</Button>
Expand Down
42 changes: 27 additions & 15 deletions src/apps/onboarding/src/pages/works/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,25 @@ export const PageWorksContent: FC<{
/* eslint-disable react-hooks/exhaustive-deps */
}, [props.reduxWorks])

useEffect(() => {
const saveData: any = async () => {
setLoading(true)
if (!props.reduxWorks) {
await props.createMemberWorks(works || [])
} else {
await props.updateMemberWorks(works || [])
}

setLoading(false)
}

if (!!works && !_.isEqual(props.reduxWorks, works)) {
saveData()
.then(_.noop)
}
/* eslint-disable react-hooks/exhaustive-deps */
}, [works])

return (
<div className={classNames('d-flex flex-column', styles.container)}>
<h2>Add your work experience here</h2>
Expand All @@ -58,13 +77,17 @@ export const PageWorksContent: FC<{
setEditingWork(work)
setShowAddWorkModal(true)
}}
disabled={loading}
className={styles.btn}
>
<img width={15} height={15} src={IconEdit} alt='' />
</button>
<button
aria-label='delete'
type='button'
onClick={() => setWorks(_.filter(works, w => w.id !== work.id))}
disabled={loading}
className={styles.btn}
>
<img width={15} height={15} src={IconTrash} alt='' />
</button>
Expand All @@ -89,7 +112,7 @@ export const PageWorksContent: FC<{
secondary
iconToLeft
onClick={() => setShowAddWorkModal(true)}
disabled={props.loadingMemberTraits}
disabled={props.loadingMemberTraits || loading}
>
+ add work experience
</Button>
Expand All @@ -113,6 +136,7 @@ export const PageWorksContent: FC<{
size='lg'
primary
iconToLeft
disabled={loading}
onClick={() => navigate('../skills')}
>
back
Expand All @@ -121,20 +145,8 @@ export const PageWorksContent: FC<{
size='lg'
primary
iconToLeft
disabled={loading || props.loadingMemberTraits}
onClick={async () => {
setLoading(true)
if (!_.isEqual(props.reduxWorks, works)) {
if (!props.reduxWorks) {
await props.createMemberWorks(works || [])
} else {
await props.updateMemberWorks(works || [])
}
}

setLoading(false)
navigate('../educations')
}}
disabled={loading}
onClick={() => navigate('../educations')}
>
next
</Button>
Expand Down
6 changes: 5 additions & 1 deletion src/apps/onboarding/src/pages/works/styles.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,8 @@

.textPosition {
font-weight: 700;
}
}

.btn:disabled {
opacity: 0.2;
}