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
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ const MemberTCAchievements: FC<MemberTCAchievementsProps> = (props: MemberTCAchi
(badge: UserBadge) => /TCO.*Finalist/.test(badge.org_badge.badge_name),
).length || 0, [memberBadges])

const tcoTrips: number = useMemo(() => memberBadges?.rows.filter(
(badge: UserBadge) => /TCO.*Trip Winner/.test(badge.org_badge.badge_name),
).length || 0, [memberBadges])

const isCopilot: boolean
= useMemo(() => !!memberStats?.COPILOT, [memberStats])

Expand All @@ -53,8 +57,8 @@ const MemberTCAchievements: FC<MemberTCAchievementsProps> = (props: MemberTCAchi

<div className={styles.achievementsWrap}>
{
(tcoWins > 0 || tcoQualifications > 0) && (
<TCOWinsBanner tcoWins={tcoWins} tcoQualifications={tcoQualifications} />
(tcoWins > 0 || tcoQualifications > 0 || tcoTrips > 0) && (
<TCOWinsBanner tcoWins={tcoWins} tcoQualifications={tcoQualifications} tcoTrips={tcoTrips} />
)
}
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import styles from './TCOWinsBanner.module.scss'
interface TCOWinsBannerProps {
tcoWins: number
tcoQualifications: number
tcoTrips: number
}

const TCOWinsBanner: FC<TCOWinsBannerProps> = (props: TCOWinsBannerProps) => (
Expand All @@ -13,18 +14,23 @@ const TCOWinsBanner: FC<TCOWinsBannerProps> = (props: TCOWinsBannerProps) => (
<p className='body-large-bold'>Topcoder Open (TCO)</p>
<p className={styles.wins}>
{
props.tcoWins === 1 || props.tcoQualifications === 1 ? (
props.tcoWins === 1 || props.tcoQualifications === 1 || props.tcoTrips === 1 ? (
<></>
) : (
<>
{props.tcoWins || props.tcoQualifications}
{props.tcoWins || props.tcoQualifications || props.tcoTrips}
{' '}
<span>time</span>
</>
)
}
</p>
<p className={styles.champText}>{props.tcoWins ? 'Champion' : 'Finalist'}</p>
<p className={styles.champText}>
{
props.tcoWins
? 'Champion' : (props.tcoQualifications ? 'Finalist' : 'Trip Winner')
}
</p>
<p>
Topcoder Open (TCO) is the ultimate programming tournament,
that earns our winners major prestige in the programming community.
Expand Down