Skip to content

Commit 0f78040

Browse files
committed
MP-172 - empty profile messages for self view
1 parent ce44c8e commit 0f78040

File tree

10 files changed

+76
-17
lines changed

10 files changed

+76
-17
lines changed

src/apps/profiles/src/components/EmptySection/EmptySection.module.scss

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
@import "@libs/ui/styles/includes";
22

33
.wrap {
4-
background: $black-10;
5-
border-radius: $sp-4;
64
flex: 1 1;
75
width: 100%;
86
height: 100%;
97

8+
.warning {
9+
color: $red-100;
10+
}
11+
}
12+
13+
.publicContent {
14+
background: $black-10;
15+
border-radius: $sp-4;
16+
1017
display: flex;
1118
align-items: center;
1219
justify-content: center;

src/apps/profiles/src/components/EmptySection/EmptySection.tsx

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,42 @@
1-
import { FC, PropsWithChildren } from 'react'
1+
import { FC, ReactNode } from 'react'
22
import classNames from 'classnames'
33

44
import styles from './EmptySection.module.scss'
55

6-
interface EmptySectionProps extends PropsWithChildren {
6+
interface EmptySectionProps {
7+
children?: ReactNode
8+
className?: string
9+
isSelf?: boolean
10+
selfMessage?: string
711
title?: string
812
wide?: boolean
913
}
1014

1115
const EmptySection: FC<EmptySectionProps> = props => (
12-
<div className={classNames(styles.wrap, props.wide && 'm-lg')}>
13-
{props.title && (
14-
<div className='body-medium-bold'>{props.title}</div>
15-
)}
16-
{props.children}
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+
)}
1740
</div>
1841
)
1942

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: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,13 @@ const EducationAndCertifications: FC<EducationAndCertificationsProps> = (props:
7979
/>
8080
))
8181
: (
82-
<EmptySection>
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+
>
8389
I&apos;m still building up my education and certifications here at Topcoder.
8490
</EmptySection>
8591
)}

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: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ const MemberSkillsInfo: FC<MemberSkillsInfoProps> = (props: MemberSkillsInfoProp
8585
<EmptySection
8686
title='Topcoder verifies and tracks skills as our members complete projects and challenges.'
8787
wide
88+
selfMessage='Adding at least five skills will increase your visibility with customers.'
89+
isSelf={canEdit}
8890
>
8991
This member has not yet provided skills, but check back soon as their skills will grow as
9092
they complete project tasks.

src/apps/profiles/src/member-profile/work-expirence/WorkExpirence.module.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@
2222
.contentWrap {
2323
display: flex;
2424
flex-direction: column;
25-
padding-bottom: $sp-4;
25+
padding-bottom: $sp-8;
2626
}
2727
}

src/apps/profiles/src/member-profile/work-expirence/WorkExpirence.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,10 @@ const WorkExpirence: FC<WorkExpirenceProps> = (props: WorkExpirenceProps) => {
7575
<WorkExpirenceCard key={`${work.company}-${work.industry}-${work.position}`} work={work} />
7676
))
7777
: (
78-
<EmptySection>
78+
<EmptySection
79+
selfMessage='Adding experience enhances the professional appearance of your profile.'
80+
isSelf={canEdit}
81+
>
7982
I&apos;m still building up my experience here at Topcoder.
8083
</EmptySection>
8184
)}

0 commit comments

Comments
 (0)