Skip to content

Commit 92a570b

Browse files
committed
MP-191 onboarding completed modal
1 parent 03048c7 commit 92a570b

File tree

5 files changed

+83
-0
lines changed

5 files changed

+83
-0
lines changed

src/apps/profiles/src/config/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,5 @@ export enum profileEditModes {
1818
workExperience = 'workExperience',
1919
education = 'education',
2020
skills = 'skills',
21+
onboardingCompleted = 'onboardingCompleted',
2122
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
@import '@libs/ui/styles/includes';
2+
3+
.container {
4+
text-align: center;
5+
}
6+
7+
.modalTitle {
8+
text-align: center;
9+
}
10+
11+
.modalButtons {
12+
display: flex;
13+
justify-content: center;
14+
width: 100%;
15+
}
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
import { Dispatch, FC, SetStateAction, useEffect, useState } from 'react'
2+
import { useSearchParams } from 'react-router-dom'
3+
4+
import { UserProfile } from '~/libs/core'
5+
import { BaseModal, Button } from '~/libs/ui'
6+
7+
import { EDIT_MODE_QUERY_PARAM, profileEditModes } from '../../config'
8+
9+
import styles from './OnboardingCompleted.module.scss'
10+
11+
interface OnboardingCompletedProps {
12+
authProfile: UserProfile | undefined
13+
}
14+
15+
const OnboardingCompleted: FC<OnboardingCompletedProps> = (props: OnboardingCompletedProps) => {
16+
const [queryParams]: [URLSearchParams, any] = useSearchParams()
17+
18+
const editMode: string | null = queryParams.get(EDIT_MODE_QUERY_PARAM)
19+
20+
const [isOpenModal, setIsOpenModal]: [boolean, Dispatch<SetStateAction<boolean>>]
21+
= useState<boolean>(false)
22+
23+
useEffect(() => {
24+
if (props.authProfile && editMode === profileEditModes.onboardingCompleted) {
25+
setIsOpenModal(true)
26+
}
27+
// eslint-disable-next-line react-hooks/exhaustive-deps
28+
}, [props.authProfile])
29+
30+
function handleInfoModalClose(): void {
31+
setIsOpenModal(false)
32+
}
33+
34+
return (
35+
<>
36+
<BaseModal
37+
onClose={handleInfoModalClose}
38+
open={isOpenModal}
39+
size='lg'
40+
showCloseIcon={false}
41+
title={<h3 className={styles.modalTitle}>Off to a great start!</h3>}
42+
buttons={(
43+
<div className={styles.modalButtons}>
44+
<Button
45+
label='View your profile'
46+
onClick={handleInfoModalClose}
47+
primary
48+
/>
49+
</div>
50+
)}
51+
>
52+
<div className={styles.container}>
53+
<p>
54+
Great work on starting your profile.
55+
The more information you add, the more visibility you have in our community and to customers.
56+
</p>
57+
</div>
58+
</BaseModal>
59+
</>
60+
)
61+
}
62+
63+
export default OnboardingCompleted
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default as OnboardingCompletedModal } from './OnboardingCompleted'

src/apps/profiles/src/member-profile/page-layout/ProfilePageLayout.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { MemberLinks } from '../links'
1414
import { MemberTCAchievements } from '../tc-achievements'
1515
import { WorkExpirence } from '../work-expirence'
1616
import { EducationAndCertifications } from '../education-and-certifications'
17+
import OnboardingCompleted from '../onboarding-complete/OnboardingCompleted'
1718

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

@@ -108,6 +109,8 @@ const ProfilePageLayout: FC<ProfilePageLayoutProps> = (props: ProfilePageLayoutP
108109

109110
</ContentLayout>
110111

112+
<OnboardingCompleted authProfile={props.authProfile} />
113+
111114
</div>
112115
)
113116
}

0 commit comments

Comments
 (0)