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
10 changes: 1 addition & 9 deletions src/apps/onboarding/src/pages/onboarding/index.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import { FC, useContext, useEffect } from 'react'
import { Outlet, Routes, useLocation } from 'react-router-dom'
import { Provider, useDispatch, useSelector } from 'react-redux'
import { Provider, useDispatch } from 'react-redux'
import classNames from 'classnames'

import { routerContext, RouterContextData } from '~/libs/core'
import { Member } from '~/apps/talent-search/src/lib/models'
import { SharedSwrConfig } from '~/libs/shared'
import { EnvironmentConfig } from '~/config'

import { onboardRouteId } from '../../onboarding.routes'
import { fetchMemberInfo, fetchMemberTraits } from '../../redux/actions/member'
Expand All @@ -20,7 +18,6 @@ const OnboardingContent: FC<{
const { getChildRoutes }: RouterContextData = useContext(routerContext)
const location = useLocation()
const dispatch = useDispatch()
const reduxMemberInfo: Member = useSelector((state: any) => state.member.memberInfo)

useEffect(() => {
dispatch(fetchMemberInfo())
Expand All @@ -43,11 +40,6 @@ const OnboardingContent: FC<{
{getChildRoutes(onboardRouteId)}
</Routes>
</div>
<span className={styles.textFooter}>
I will complete this onboarding later,
<a href={`${EnvironmentConfig.USER_PROFILE_URL}/${reduxMemberInfo?.handle}`}> skip for now</a>
.
</span>
</>
)
}
Expand Down
16 changes: 0 additions & 16 deletions src/apps/onboarding/src/pages/onboarding/styles.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -68,19 +68,3 @@
text-transform: none;
}
}

.textFooter {
color: $black-80;
margin-top: 64px;
text-align: center;

@include ltemd {
margin-top: 32px;
max-width: 284px;
}

a {
color: $turq-160;
font-weight: 500;
}
}
20 changes: 19 additions & 1 deletion src/apps/onboarding/src/pages/skills/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useNavigate } from 'react-router-dom'
import { FC, useState } from 'react'
import { FC, useEffect, useState } from 'react'
import { connect } from 'react-redux'
import classNames from 'classnames'

Expand All @@ -17,8 +17,15 @@ export const PageSkillsContent: FC<{
const navigate: any = useNavigate()
const [loading, setLoading] = useState(false)
const editor: MemberSkillEditor = useMemberSkillEditor()
const [showValidationError, setShowValidationError] = useState(false)

async function saveSkills(): Promise<void> {
if (!editor.hasValidSkills()) {
setShowValidationError(true)
return
}

setShowValidationError(false)
setLoading(true)
try {
await editor.saveSkills()
Expand All @@ -29,6 +36,12 @@ export const PageSkillsContent: FC<{
navigate('../open-to-work')
}

useEffect(() => {
if (editor.hasValidSkills()) {
setShowValidationError(false)
}
}, [editor])

return (
<div className={classNames('d-flex flex-column', styles.container)}>
<h2>
Expand Down Expand Up @@ -56,6 +69,11 @@ export const PageSkillsContent: FC<{
progress={1}
maxStep={5}
/>
{showValidationError && (
<span className={styles.validationError}>
* Please select at least one skill in both Principal and Additional Skills.
</span>
)}

<div className={classNames('d-flex justify-content-end', styles.blockFooter)}>
<Button
Expand Down
7 changes: 6 additions & 1 deletion src/apps/onboarding/src/pages/skills/styles.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,9 @@

.blockSkilTags {
gap: 10px;
}
}

.validationError {
color: #EA1900;
font-size: small;
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { InputSkillSelector } from '../input-skill-selector'
export interface MemberSkillEditor {
formInput: ReactNode
saveSkills: () => Promise<void>,
hasValidSkills: () => boolean
}

/**
Expand Down Expand Up @@ -152,10 +153,16 @@ export const useMemberSkillEditor = ({
return () => { mounted = false }
}, [profile?.userId])

const hasValidSkills = (): boolean => {
const principalCount = principalSkills.length
const additionalCount = additionalSkills.length
return principalCount > 0 && additionalCount > 0
}

// build the form input
const formInput = useMemo(() => (
<>
<p className='body-main-bold'>Principal Skills</p>
<p className='body-main-bold'>Principal Skills *</p>
<p>
Add up to 10 of the skills that are central to your expertise.
These will be showcased at the top of your profile.
Expand All @@ -168,7 +175,7 @@ export const useMemberSkillEditor = ({
limit={MAX_PRINCIPAL_SKILLS_COUNT}
/>

<p className='body-main-bold'>Additional skills</p>
<p className='body-main-bold'>Additional skills *</p>
<p>
All your other skills that make you a valuable asset on a project or a team.
</p>
Expand All @@ -184,6 +191,7 @@ export const useMemberSkillEditor = ({

return {
formInput,
hasValidSkills,
saveSkills,
}
}
Loading