Skip to content

Commit 828ad1f

Browse files
committed
Merge branch 'dev' into onboarding
2 parents b3c0065 + ffee77f commit 828ad1f

File tree

32 files changed

+275
-49
lines changed

32 files changed

+275
-49
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"apexcharts": "^3.36.0",
3333
"axios": "^1.1.2",
3434
"browser-cookies": "^1.2.0",
35+
"city-timezones": "^1.2.1",
3536
"classnames": "^2.3.2",
3637
"contentful": "^9.2.5",
3738
"country-calling-code": "0.0.3",
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
@import "@libs/ui/styles/includes";
2+
3+
.wrap {
4+
flex: 1 1;
5+
width: 100%;
6+
height: 100%;
7+
8+
.warning {
9+
color: $red-100;
10+
}
11+
}
12+
13+
.publicContent {
14+
background: $black-10;
15+
border-radius: $sp-4;
16+
17+
display: flex;
18+
align-items: center;
19+
justify-content: center;
20+
flex-direction: column;
21+
22+
text-align: center;
23+
24+
gap: $sp-8;
25+
padding: $sp-15 $sp-11;
26+
27+
&:global(.m-lg) {
28+
padding: $sp-15 2*$sp-15;
29+
}
30+
31+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import { FC, ReactNode } from 'react'
2+
import classNames from 'classnames'
3+
4+
import styles from './EmptySection.module.scss'
5+
6+
interface EmptySectionProps {
7+
children?: ReactNode
8+
className?: string
9+
isSelf?: boolean
10+
selfMessage?: string
11+
title?: string
12+
wide?: boolean
13+
}
14+
15+
const EmptySection: FC<EmptySectionProps> = props => (
16+
<div
17+
className={
18+
classNames(
19+
props.className,
20+
styles.wrap,
21+
!props.isSelf && props.children && styles.publicContent,
22+
props.wide && 'm-lg',
23+
)
24+
}
25+
>
26+
{props.isSelf
27+
? (
28+
<div className={classNames('body-main', styles.warning)}>
29+
{props.selfMessage}
30+
</div>
31+
)
32+
: (
33+
<>
34+
{props.title && (
35+
<div className='body-medium-bold'>{props.title}</div>
36+
)}
37+
{props.children}
38+
</>
39+
)}
40+
</div>
41+
)
42+
43+
export default EmptySection
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default as EmptySection } from './EmptySection'

src/apps/profiles/src/components/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ export * from './LogoDesignDetailsModal'
1515
export * from './WebDesignDetailsModal'
1616
export * from './DesignF2FDetailsModal'
1717
export * from './EditMemberPropertyBtn'
18+
export * from './EmptySection'

src/apps/profiles/src/lib/helpers.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
import { UserProfile } from '~/libs/core'
2+
3+
declare global {
4+
interface Window { tcUniNav: any }
5+
}
6+
7+
window.tcUniNav = window.tcUniNav || {}
18
/**
29
* Convert number to fixed digits string
310
*/
@@ -6,3 +13,11 @@ export function numberToFixed(value: number | string, digits: number = 2): strin
613

714
return n ? n.toFixed(digits) : '0'
815
}
16+
17+
export function notifyUniNavi(profile: UserProfile): void {
18+
if (window?.tcUniNav) {
19+
window.tcUniNav('update', '*', {
20+
user: { ...profile, photoUrl: profile.photoURL },
21+
})
22+
}
23+
}

src/apps/profiles/src/member-profile/about-me/AboutMe.module.scss

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,8 @@
1717
align-items: center;
1818
justify-content: center;
1919
margin-bottom: $sp-10;
20+
&.emptyDesc {
21+
margin-bottom: 0;
22+
}
2023
}
21-
}
24+
}

src/apps/profiles/src/member-profile/about-me/AboutMe.tsx

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
import { Dispatch, FC, SetStateAction, useEffect, useState } from 'react'
1+
import { Dispatch, FC, SetStateAction, useEffect, useMemo, useState } from 'react'
22
import { useSearchParams } from 'react-router-dom'
33
import { KeyedMutator } from 'swr'
4+
import classNames from 'classnames'
45

56
import { useMemberTraits, UserProfile, UserTraitIds, UserTraits } from '~/libs/core'
67

7-
import { EditMemberPropertyBtn } from '../../components'
8+
import { EditMemberPropertyBtn, EmptySection } from '../../components'
89
import { EDIT_MODE_QUERY_PARAM, profileEditModes } from '../../config'
10+
import { notifyUniNavi } from '../../lib'
911

1012
import { ModifyAboutMeModal } from './ModifyAboutMeModal'
1113
import styles from './AboutMe.module.scss'
@@ -32,6 +34,10 @@ const AboutMe: FC<AboutMeProps> = (props: AboutMeProps) => {
3234
const memberTitleTrait: any
3335
= memberPersonalizationTraits?.[0]?.traits?.data?.find((trait: any) => trait.profileSelfTitle)
3436

37+
const hasEmptyDescription = useMemo(() => (
38+
props.profile && !props.profile.description
39+
), [props.profile])
40+
3541
useEffect(() => {
3642
if (props.authProfile && editMode === profileEditModes.aboutMe) {
3743
setIsEditMode(true)
@@ -54,6 +60,7 @@ const AboutMe: FC<AboutMeProps> = (props: AboutMeProps) => {
5460
setIsEditMode(false)
5561
mutateTraits()
5662
props.refreshProfile(props.profile.handle)
63+
notifyUniNavi(props.profile)
5764
}, 1000)
5865
}
5966

@@ -66,7 +73,7 @@ const AboutMe: FC<AboutMeProps> = (props: AboutMeProps) => {
6673
{' '}
6774
{props.profile?.firstName || props.profile?.handle}
6875
</p>
69-
<div className={styles.wizzardWrap}>
76+
<div className={classNames(styles.wizzardWrap, hasEmptyDescription && styles.emptyDesc)}>
7077
<p className='body-large'>{memberTitleTrait?.profileSelfTitle}</p>
7178
{
7279
canEdit && (
@@ -76,6 +83,16 @@ const AboutMe: FC<AboutMeProps> = (props: AboutMeProps) => {
7683
)
7784
}
7885
</div>
86+
{hasEmptyDescription && (
87+
<EmptySection
88+
className={styles.empty}
89+
selfMessage={`
90+
Your bio is an opportunity to share your personality
91+
and interests with the community and customers.
92+
`}
93+
isSelf={canEdit}
94+
/>
95+
)}
7996
<p>{props.profile?.description}</p>
8097

8198
{

src/apps/profiles/src/member-profile/education-and-certifications/EducationAndCertifications.module.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,6 @@
2222
.educationContentWrap {
2323
display: flex;
2424
flex-direction: column;
25+
padding-bottom: $sp-8;
2526
}
2627
}

src/apps/profiles/src/member-profile/education-and-certifications/EducationAndCertifications.tsx

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ import { KeyedMutator } from 'swr'
55
import { useMemberTraits, UserProfile, UserTrait, UserTraitIds, UserTraits } from '~/libs/core'
66

77
import { EDIT_MODE_QUERY_PARAM, profileEditModes } from '../../config'
8-
import { EditMemberPropertyBtn } from '../../components'
8+
import { EditMemberPropertyBtn, EmptySection } from '../../components'
99
import { MemberTCAInfo } from '../tca-info'
10+
import { notifyUniNavi } from '../../lib'
1011

1112
import { ModifyEducationModal } from './ModifyEducationModal'
1213
import { EducationCard } from './EducationCard'
@@ -54,6 +55,7 @@ const EducationAndCertifications: FC<EducationAndCertificationsProps> = (props:
5455
setTimeout(() => {
5556
setIsEditMode(false)
5657
mutateTraits()
58+
notifyUniNavi(props.profile)
5759
}, 1000)
5860
}
5961

@@ -71,14 +73,24 @@ const EducationAndCertifications: FC<EducationAndCertificationsProps> = (props:
7173
</div>
7274

7375
<div className={styles.educationContentWrap}>
74-
{
75-
memberEducation?.map((education: UserTrait) => (
76+
{(memberEducation?.length as number) > 0
77+
? memberEducation?.map((education: UserTrait) => (
7678
<EducationCard
7779
key={`${education.schoolCollegeName}-${education.major}`}
7880
education={education}
7981
/>
8082
))
81-
}
83+
: (
84+
<EmptySection
85+
selfMessage={`
86+
Including your education and certifications enhances the strength
87+
of your profile in comparison to others.
88+
`}
89+
isSelf={canEdit}
90+
>
91+
I&apos;m still building up my education and certifications here at Topcoder.
92+
</EmptySection>
93+
)}
8294
</div>
8395

8496
<MemberTCAInfo profile={props.profile} />

0 commit comments

Comments
 (0)