Skip to content

Commit 251b35c

Browse files
authored
Merge pull request #719 from topcoder-platform/MP-170_empty-profile-public
MP-170 empty profile public, MP-172 empty self profile -> dev
2 parents 62c2918 + 38a4989 commit 251b35c

File tree

14 files changed

+142
-19
lines changed

14 files changed

+142
-19
lines changed
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/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: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
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'
910

1011
import { ModifyAboutMeModal } from './ModifyAboutMeModal'
@@ -32,6 +33,10 @@ const AboutMe: FC<AboutMeProps> = (props: AboutMeProps) => {
3233
const memberTitleTrait: any
3334
= memberPersonalizationTraits?.[0]?.traits?.data?.find((trait: any) => trait.profileSelfTitle)
3435

36+
const hasEmptyDescription = useMemo(() => (
37+
props.profile && !props.profile.description
38+
), [props.profile])
39+
3540
useEffect(() => {
3641
if (props.authProfile && editMode === profileEditModes.aboutMe) {
3742
setIsEditMode(true)
@@ -66,7 +71,7 @@ const AboutMe: FC<AboutMeProps> = (props: AboutMeProps) => {
6671
{' '}
6772
{props.profile?.firstName || props.profile?.handle}
6873
</p>
69-
<div className={styles.wizzardWrap}>
74+
<div className={classNames(styles.wizzardWrap, hasEmptyDescription && styles.emptyDesc)}>
7075
<p className='body-large'>{memberTitleTrait?.profileSelfTitle}</p>
7176
{
7277
canEdit && (
@@ -76,6 +81,16 @@ const AboutMe: FC<AboutMeProps> = (props: AboutMeProps) => {
7681
)
7782
}
7883
</div>
84+
{hasEmptyDescription && (
85+
<EmptySection
86+
className={styles.empty}
87+
selfMessage={`
88+
Your bio is an opportunity to share your personality
89+
and interests with the community and customers.
90+
`}
91+
isSelf={canEdit}
92+
/>
93+
)}
7994
<p>{props.profile?.description}</p>
8095

8196
{

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: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ 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'
1010

1111
import { ModifyEducationModal } from './ModifyEducationModal'
@@ -71,14 +71,24 @@ const EducationAndCertifications: FC<EducationAndCertificationsProps> = (props:
7171
</div>
7272

7373
<div className={styles.educationContentWrap}>
74-
{
75-
memberEducation?.map((education: UserTrait) => (
74+
{(memberEducation?.length as number) > 0
75+
? memberEducation?.map((education: UserTrait) => (
7676
<EducationCard
7777
key={`${education.schoolCollegeName}-${education.major}`}
7878
education={education}
7979
/>
8080
))
81-
}
81+
: (
82+
<EmptySection
83+
selfMessage={`
84+
Including your education and certifications enhances the strength
85+
of your profile in comparison to others.
86+
`}
87+
isSelf={canEdit}
88+
>
89+
I&apos;m still building up my education and certifications here at Topcoder.
90+
</EmptySection>
91+
)}
8292
</div>
8393

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

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
@import '@libs/ui/styles/includes';
22

33
.educationCard {
4-
margin-bottom: $sp-4;
54
flex: 1;
65

76
.educationCardHeader {

src/apps/profiles/src/member-profile/skills/MemberSkillsInfo.tsx

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import classNames from 'classnames'
55
import { isVerifiedSkill, UserEMSISkill, UserProfile } from '~/libs/core'
66
import { IconOutline } from '~/libs/ui'
77

8-
import { EditMemberPropertyBtn } from '../../components'
8+
import { EditMemberPropertyBtn, EmptySection } from '../../components'
99
import { EDIT_MODE_QUERY_PARAM, profileEditModes } from '../../config'
1010

1111
import { ModifySkillsModal } from './ModifySkillsModal'
@@ -68,8 +68,8 @@ const MemberSkillsInfo: FC<MemberSkillsInfoProps> = (props: MemberSkillsInfoProp
6868
</div>
6969

7070
<div className={styles.skillsWrap}>
71-
{
72-
memberEMSISkills.map((memberEMSISkill: UserEMSISkill) => (
71+
{memberEMSISkills?.length > 0
72+
? memberEMSISkills.map((memberEMSISkill: UserEMSISkill) => (
7373
<div
7474
className={classNames(
7575
styles.skillItem,
@@ -81,7 +81,17 @@ const MemberSkillsInfo: FC<MemberSkillsInfoProps> = (props: MemberSkillsInfoProp
8181
{isVerifiedSkill(memberEMSISkill.skillSources) && <IconOutline.CheckCircleIcon />}
8282
</div>
8383
))
84-
}
84+
: (
85+
<EmptySection
86+
title='Topcoder verifies and tracks skills as our members complete projects and challenges.'
87+
wide
88+
selfMessage='Adding at least five skills will increase your visibility with customers.'
89+
isSelf={canEdit}
90+
>
91+
This member has not yet provided skills, but check back soon as their skills will grow as
92+
they complete project tasks.
93+
</EmptySection>
94+
)}
8595
</div>
8696

8797
{

0 commit comments

Comments
 (0)