Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/apps/profiles/src/member-profile/about-me/AboutMe.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { EditMemberPropertyBtn, EmptySection } from '../../components'
import { EDIT_MODE_QUERY_PARAM, profileEditModes } from '../../config'

import { ModifyAboutMeModal } from './ModifyAboutMeModal'
import MemberRatingCard from './MemberRatingCard/MemberRatingCard'
import styles from './AboutMe.module.scss'

interface AboutMeProps {
Expand Down Expand Up @@ -71,6 +72,9 @@ const AboutMe: FC<AboutMeProps> = (props: AboutMeProps) => {
{' '}
{props.profile?.firstName || props.profile?.handle}
</p>

<MemberRatingCard profile={props.profile} />

<div className={classNames(styles.wizzardWrap, hasEmptyDescription && styles.emptyDesc)}>
<p className='body-large'>{memberTitleTrait?.profileSelfTitle}</p>
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
@import '@libs/ui/styles/includes';

.container {
background-color: $tc-white;
padding: $sp-3;
margin: $sp-4 0;
border-radius: 16px;
width: 100%;

.innerWrap {
background-image: linear-gradient(90deg, #05456D, #0A7AC0);
color: $tc-white;
border-radius: 10px;
display: flex;
justify-content: space-between;
padding: $sp-4;

.valueWrap {
display: flex;
flex-direction: column;
align-items: center;

.value {
font-size: 26px;
font-weight: 500;
font-family: $font-barlow-condensed;
line-height: 28px;
}

.name {
font-size: 12px;
line-height: 18px;
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/* eslint-disable jsx-a11y/anchor-is-valid */
import { FC, useMemo } from 'react'

import { useMemberStats, UserProfile, UserStats } from '~/libs/core'

import styles from './MemberRatingCard.module.scss'

interface MemberRatingCardProps {
profile: UserProfile
}

const MemberRatingCard: FC<MemberRatingCardProps> = (props: MemberRatingCardProps) => {
const memberStats: UserStats | undefined = useMemberStats(props.profile.handle)

const maxPercentile: number = useMemo(() => {
let memberPercentile: number = 0
if (memberStats?.DATA_SCIENCE) {
memberPercentile = memberStats.DATA_SCIENCE.MARATHON_MATCH?.rank?.percentile || 0
if ((memberStats.DATA_SCIENCE.SRM?.rank?.percentile || 0) > memberPercentile) {
memberPercentile = memberStats.DATA_SCIENCE.SRM.rank?.percentile || 0
}
}

if (memberStats?.DEVELOP) {
memberStats.DEVELOP.subTracks.forEach((subTrack: any) => {
const subPercentile = subTrack.rank.percentile || subTrack.rank.overallPercentile || 0
if (subPercentile > memberPercentile) {
memberPercentile = subPercentile
}
})
}

return memberPercentile
}, [memberStats])

return memberStats?.maxRating?.rating ? (
<div className={styles.container}>
<div className={styles.innerWrap}>
<div className={styles.valueWrap}>
<p className={styles.value}>{memberStats?.maxRating?.rating}</p>
<p className={styles.name}>Rating</p>
</div>
<div className={styles.valueWrap}>
<p className={styles.value}>
{Number(maxPercentile)
.toFixed(2)}
</p>
<p className={styles.name}>Percentile</p>
</div>
<div className='body-small-medium'>
<a href='#' className={styles.link}>What is this?</a>
</div>
</div>
</div>
) : <></>
}

export default MemberRatingCard
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as MemberRatingCard } from './MemberRatingCard'
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@
.profileInfoLeft {
display: flex;
flex-direction: column;
margin-top: -60px;

@include ltelg {
margin-top: 0;
}

.skillsWrap {
display: flex;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ $error-line-height: 14px;

&.input-error {
border-color: $red-100;
margin-bottom: 0;
margin-bottom: 0 !important;
color: $red-100;

.label {
Expand Down