Skip to content

Commit fde1972

Browse files
authored
Merge pull request #778 from topcoder-platform/onboarding
Onboarding
2 parents ca04fd3 + 1150573 commit fde1972

File tree

9 files changed

+53
-26
lines changed

9 files changed

+53
-26
lines changed

src/apps/onboarding/src/components/FieldAvatar/index.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,10 @@ const FieldAvatar: FC<FieldAvatarProps> = (props: FieldAvatarProps) => {
108108
>
109109
{imgUrl ? (
110110
<img className={styles.img} src={imgUrl} alt='avatar' />
111-
) : (
111+
) : undefined}
112+
{!imgUrl ? (
112113
<img className={styles.imgPlaceholder} src={AvatarPlaceholder} alt='avatar' />
113-
)}
114+
) : undefined}
114115
</div>
115116
<div className='d-flex flex-column align-items-start'>
116117
<span className='color-black-60'>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ const ModalAddWork: FC<ModalAddWorkProps> = (props: ModalAddWorkProps) => {
172172
dirty
173173
/>
174174
</div>
175-
<div className='d-flex gap-16 full-width'>
175+
<div className='d-flex gap-16 full-width flex-wrap'>
176176
<div
177177
className='flex-1'
178178
>

src/apps/onboarding/src/components/modal-upload-photo/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ const ModalUploadPhoto: FC<ModalUploadPhotoProps> = (props: ModalUploadPhotoProp
5353

5454
setIsSaving(true)
5555
try {
56-
await updateMemberPhotoAsync(props.memberInfo.handle, formData)
57-
props.setMemberPhotoUrl(URL.createObjectURL(myFiles[0]))
56+
const result = await updateMemberPhotoAsync(props.memberInfo.handle, formData)
57+
props.setMemberPhotoUrl(result?.photoURL || URL.createObjectURL(myFiles[0]))
5858
setMyFiles([])
5959
props.onClose?.()
6060
} catch (error) {

src/apps/onboarding/src/components/onboarding-base-modal/index.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ const OnboardingBaseModal: FC<OnboardingBaseModalProps> = (props: OnboardingBase
2020
size='body'
2121
title={props.title}
2222
classNames={{ modal: styles.infoModal }}
23-
blockScroll
2423
>
2524
{props.children}
2625
</BaseModal>

src/apps/onboarding/src/pages/onboarding/index.tsx

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,33 +14,23 @@ import '../../styles/global/_index.scss'
1414

1515
import styles from './styles.module.scss'
1616

17-
const OnboardingContent: FC<{
17+
const OnboardingFooterContent: FC<{
1818
fetchMemberInfo: () => void
1919
fetchMemberTraits: () => void
2020
reduxMemberInfo: Member | undefined
2121
}> = props => {
22-
const { getChildRoutes }: RouterContextData = useContext(routerContext)
2322
useEffect(() => {
2423
props.fetchMemberInfo()
2524
props.fetchMemberTraits()
2625
/* eslint-disable react-hooks/exhaustive-deps */
2726
}, [])
2827

2928
return (
30-
<>
31-
<div className={classNames('d-flex flex-column', styles.container)}>
32-
<Outlet />
33-
<Routes>
34-
{getChildRoutes(onboardRouteId)}
35-
</Routes>
36-
<div id='calendar-portal' />
37-
</div>
38-
<span className={styles.textFooter}>
39-
I will complete this onboarding later,
40-
<a href={`${EnvironmentConfig.USER_PROFILE_URL}/${props.reduxMemberInfo?.handle}`}> skip for now</a>
41-
.
42-
</span>
43-
</>
29+
<span className={styles.textFooter}>
30+
I will complete this onboarding later,
31+
<a href={`${EnvironmentConfig.USER_PROFILE_URL}/${props.reduxMemberInfo?.handle}`}> skip for now</a>
32+
.
33+
</span>
4434
)
4535
}
4636

@@ -58,12 +48,30 @@ const mapDispatchToProps: any = {
5848
fetchMemberInfo,
5949
fetchMemberTraits,
6050
}
61-
const Onboarding: any = connect(mapStateToProps, mapDispatchToProps)(OnboardingContent)
51+
const OnboardingFooter: any = connect(mapStateToProps, mapDispatchToProps)(OnboardingFooterContent)
52+
53+
const OnboardingContent: FC<{
54+
}> = () => {
55+
const { getChildRoutes }: RouterContextData = useContext(routerContext)
56+
57+
return (
58+
<>
59+
<div className={classNames('d-flex flex-column', styles.container)}>
60+
<Outlet />
61+
<Routes>
62+
{getChildRoutes(onboardRouteId)}
63+
</Routes>
64+
<div id='calendar-portal' />
65+
</div>
66+
<OnboardingFooter />
67+
</>
68+
)
69+
}
6270

6371
export const OnboardingWrapper: FC<{}> = () => (
6472
<div className={classNames(styles.blockWrapper, 'd-flex flex-column align-items-center')}>
6573
<Provider store={store}>
66-
<Onboarding />
74+
<OnboardingContent />
6775
</Provider>
6876
</div>
6977
)

src/apps/onboarding/src/redux/reducers/member.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import _ from 'lodash'
22

3+
import { notifyUniNavi } from '~/apps/profiles/src/lib'
4+
35
import { ACTIONS } from '../../config'
46
import ConnectInfo from '../../models/ConnectInfo'
57
import EducationInfo from '../../models/EducationInfo'
@@ -89,6 +91,9 @@ const memberReducer: any = (
8991

9092
const newMemberInfo = _.cloneDeep(state.memberInfo)
9193
newMemberInfo.photoURL = action.payload
94+
if (newMemberInfo) {
95+
notifyUniNavi(newMemberInfo as any)
96+
}
9297

9398
return {
9499
...state,

src/apps/profiles/src/member-profile/profile-header/ProfileHeader.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
UserTraitIds,
1212
UserTraits,
1313
} from '~/libs/core'
14+
import { Button } from '~/libs/ui'
1415

1516
import { EditMemberPropertyBtn } from '../../components'
1617
import { EDIT_MODE_QUERY_PARAM, profileEditModes } from '../../config'

src/libs/ui/lib/components/form/form-groups/form-input/input-date-picker/InputDatePicker.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,14 @@ const InputDatePicker: FC<InputDatePickerProps> = (props: InputDatePickerProps)
114114
<DatePicker
115115
renderCustomHeader={renderCustomHeader}
116116
selected={props.date}
117-
onChange={props.onChange}
117+
onChange={(
118+
date: Date | null,
119+
event: React.SyntheticEvent<any> | undefined,
120+
) => {
121+
event?.stopPropagation()
122+
event?.preventDefault()
123+
props.onChange?.(date)
124+
}}
118125
placeholderText={props.placeholder || 'Select a date'}
119126
className={styles.datePickerWrapper}
120127
minDate={props.minDate}

src/libs/ui/lib/components/form/form-groups/form-input/input-select/InputSelect.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import {
22
ChangeEvent,
33
Dispatch,
44
FC,
5+
MouseEvent,
56
MutableRefObject,
67
ReactNode,
78
SetStateAction,
@@ -49,7 +50,12 @@ const InputSelect: FC<InputSelectProps> = (props: InputSelectProps) => {
4950

5051
const toggleMenu: () => void = () => setMenuIsVisible(wasVisible => !wasVisible)
5152

52-
const select: (option: InputSelectOption) => () => void = (option: InputSelectOption) => () => {
53+
const select: (option: InputSelectOption) => (event: MouseEvent<HTMLDivElement>) => void
54+
= (option: InputSelectOption) => (
55+
event: MouseEvent<HTMLDivElement>,
56+
) => {
57+
event.stopPropagation()
58+
event.preventDefault()
5359
props.onChange({
5460
target: { value: option.value },
5561
} as unknown as ChangeEvent<HTMLInputElement>)

0 commit comments

Comments
 (0)