Skip to content

Commit 98d2901

Browse files
committed
MP-235 add TCO finalist
1 parent 2cf0990 commit 98d2901

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

src/apps/profiles/src/member-profile/tc-achievements/MemberTCAchievements.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,25 @@ const MemberTCAchievements: FC<MemberTCAchievementsProps> = (props: MemberTCAchi
2929
(badge: UserBadge) => /TCO.*Champion/.test(badge.org_badge.badge_name),
3030
).length || 0, [memberBadges])
3131

32+
const tcoQualifications: number = useMemo(() => memberBadges?.rows.filter(
33+
(badge: UserBadge) => /TCO.*Finalist/.test(badge.org_badge.badge_name),
34+
).length || 0, [memberBadges])
35+
3236
const isCopilot: boolean
3337
= useMemo(() => !!memberStats?.COPILOT, [memberStats])
3438

3539
// function handleOpenTCAchievements(): void {
3640
// console.log('handleOpenTCAchievements')
3741
// }
3842

39-
return memberStats?.wins || tcoWins ? (
43+
return memberStats?.wins || tcoWins || tcoQualifications ? (
4044
<div className={styles.container}>
4145
<p className='body-large-medium'>Achievements @ Topcoder</p>
4246

4347
<div className={styles.achievementsWrap}>
4448
{
45-
tcoWins > 0 && (
46-
<TCOWinsBanner tcoWins={tcoWins} />
49+
(tcoWins > 0 || tcoQualifications > 0) && (
50+
<TCOWinsBanner tcoWins={tcoWins} tcoQualifications={tcoQualifications} />
4751
)
4852
}
4953
{

src/apps/profiles/src/member-profile/tc-achievements/TCOWinsBanner/TCOWinsBanner.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,26 @@ import styles from './TCOWinsBanner.module.scss'
44

55
interface TCOWinsBannerProps {
66
tcoWins: number
7+
tcoQualifications: number
78
}
89

910
const TCOWinsBanner: FC<TCOWinsBannerProps> = (props: TCOWinsBannerProps) => (
1011
<div className={styles.container}>
1112
<p className='body-large-bold'>Topcoder Open (TCO)</p>
1213
<p className={styles.wins}>
1314
{
14-
props.tcoWins === 1 ? (
15+
props.tcoWins === 1 || props.tcoQualifications === 1 ? (
1516
<></>
1617
) : (
1718
<>
18-
{props.tcoWins}
19+
{props.tcoWins || props.tcoQualifications}
1920
{' '}
2021
<span>times</span>
2122
</>
2223
)
2324
}
2425
</p>
25-
<p className={styles.champText}>Champion</p>
26+
<p className={styles.champText}>{props.tcoWins ? 'Champion' : 'Finalist'}</p>
2627
<p className={styles.text}>
2728
Topcoder Open (TCO) is the ultimate programming tournament,
2829
that earns our winners major prestige in the programming community.

0 commit comments

Comments
 (0)