Skip to content

Color handles leaderboards #5236

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Dec 11, 2020
Merged
Show file tree
Hide file tree
Changes from 6 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
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ workflows:
filters:
branches:
only:
- free
- color-handles-leaderboards
# This is alternate dev env for parallel testing
- "build-qa":
context : org-global
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ exports[`Matches shallow shapshot 1`] = `
>
<a
href="undefined/members/undefined/"
style={
Object {
"color": null,
}
}
target="_blank"
/>
<div
Expand Down Expand Up @@ -103,6 +108,11 @@ exports[`Matches shallow shapshot 1`] = `
>
<a
href="undefined/members/undefined/"
style={
Object {
"color": null,
}
}
target="_blank"
/>
<div
Expand Down Expand Up @@ -150,6 +160,11 @@ exports[`Matches shallow shapshot 1`] = `
>
<a
href="undefined/members/undefined/"
style={
Object {
"color": null,
}
}
target="_blank"
/>
<div
Expand Down Expand Up @@ -197,6 +212,11 @@ exports[`Matches shallow shapshot 1`] = `
>
<a
href="undefined/members/undefined/"
style={
Object {
"color": null,
}
}
target="_blank"
/>
<div
Expand Down
2 changes: 1 addition & 1 deletion src/assets/images/default-avatar-photo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ $light-gray: #d4d4d4;
img,
svg {
border-radius: 50%;
border-style: solid;
border-width: 3px;
height: 100%;
width: 100%;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import { Avatar } from 'topcoder-react-ui-kit';
import { config } from 'topcoder-react-utils';
import _ from 'lodash';
import DefaultAvatar from 'assets/images/default-avatar-photo.svg';
import { getRatingColor } from 'utils/tc';


import avatarStyles from '../avatarStyles.scss';
Expand Down Expand Up @@ -68,6 +69,7 @@ export default function LeaderboardTable(props) {
const fulfillment = competitor['tco_leaderboard.fulfillment']
? (parseFloat(competitor['tco_leaderboard.fulfillment']) * 100).toFixed(2).replace(/[.,]00$/, '')
: competitor.fulfillment;
const rating = competitor['member_profile_basic.max_rating'];
return (
<tr key={competitor.rank}>
<td styleName={`${stylesName}.col-rank`}>{competitor.rank}</td>
Expand All @@ -91,11 +93,16 @@ export default function LeaderboardTable(props) {
<div
styleName={`${stylesName}.handle-link`}
onClick={() => onUsernameClick(competitor)}
style={{ color: rating ? getRatingColor(rating) : null }}
>
{competitor['member_profile_basic.handle'] || competitor.handle}
</div>
) : (
<a href={`${window.origin}/members/${competitor['member_profile_basic.handle'] || competitor.handle}/`} target={`${_.includes(window.origin, 'www') ? '_self' : '_blank'}`}>
<a
href={`${window.origin}/members/${competitor['member_profile_basic.handle'] || competitor.handle}/`}
target={`${_.includes(window.origin, 'www') ? '_self' : '_blank'}`}
style={{ color: rating ? getRatingColor(rating) : null }}
>
{competitor['member_profile_basic.handle'] || competitor.handle}
</a>
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@import '~styles/mixins';
$table-cell-padding: 8px;
$table-cell-padding: 2px;
$table-border-color: #d4d4d4;
$table-bg-hover: #f5f5f5;

Expand Down Expand Up @@ -115,13 +115,13 @@ $table-bg-hover: #f5f5f5;

.col-avatar .leaderboard-avatar {
display: inline-block;
height: 40px;
width: 40px;
height: 34px;
width: 34px;
overflow: hidden;

svg {
border: 3px solid rgba(0, 0, 0, 0.05);
border-radius: 50%;
max-width: 100%;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/shared/components/Leaderboard/Podium/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
@include roboto-regular;

line-height: 1.42;
margin: 0 auto 40px auto;
margin: 0 auto 10px auto;
text-align: center;

&::before,
Expand Down
5 changes: 4 additions & 1 deletion src/shared/components/Leaderboard/PodiumSpot/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import { Avatar } from 'topcoder-react-ui-kit';
import { config } from 'topcoder-react-utils';
import _ from 'lodash';
import DefaultAvatar from 'assets/images/default-avatar-photo.svg';
import { getRatingColor } from 'utils/tc';

import avatarStyles from '../avatarStyles.scss';
import defaultStyles from './themes/styles.scss'; // eslint-disable-line
Expand Down Expand Up @@ -110,7 +111,7 @@ export default function PodiumSpot(props) {
const fulfillment = competitor['tco_leaderboard.fulfillment']
? (parseFloat(competitor['tco_leaderboard.fulfillment']) * 100).toFixed(2).replace(/[.,]00$/, '')
: competitor.fulfillment;

const rating = competitor['member_profile_basic.max_rating'];
return (
<div styleName={rootStyle}>
<span styleName={`${stylesName}.leaderboard-avatar`}>
Expand Down Expand Up @@ -159,6 +160,7 @@ export default function PodiumSpot(props) {
<div
styleName={`${stylesName}.handle-link`}
onClick={() => onUsernameClick(competitor)}
style={{ color: rating ? getRatingColor(rating) : null }}
>
{competitor['member_profile_basic.handle'] || competitor.handle}
</div>
Expand All @@ -167,6 +169,7 @@ export default function PodiumSpot(props) {
styleName={`${stylesName}.profile-link`}
href={`${window.origin}/members/${competitor['member_profile_basic.handle'] || competitor.handle}/`}
target={`${_.includes(window.origin, 'www') ? '_self' : '_blank'}`}
style={{ color: rating ? getRatingColor(rating) : null }}
>
{competitor['member_profile_basic.handle'] || competitor.handle}
</a>
Expand Down
31 changes: 18 additions & 13 deletions src/shared/components/Leaderboard/PodiumSpot/themes/tco20.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,24 @@ $podium-border-color: #ededf2;
display: inline-block;
position: relative;
margin-bottom: 12px;
margin-right: 20px;
margin-right: 11px;
overflow: visible;
}

.ranking {
@include roboto-black;

border-radius: 20px;
padding: 3px 9px;
display: inline-block;
display: flex;
padding: 0;
align-items: center;
justify-content: center;
position: absolute;
right: 0;
bottom: -10px;
font-size: 15px;
width: 28px;
height: 28px;
}

.winnings-info span {
Expand Down Expand Up @@ -91,12 +95,13 @@ $podium-border-color: #ededf2;
.handle-link,
a.profile-link {
color: #0d61bf;
font-family: Barlow, sans-serif;
font-family: Roboto, sans-serif;
font-size: 16px;
font-weight: 600;
line-height: 19px;
line-height: 24px;
text-align: left;
text-decoration: underline;
margin-top: 11px;
margin-bottom: 13px;

&:hover {
Expand All @@ -110,37 +115,37 @@ $podium-border-color: #ededf2;
}

.PodiumSpot--first {
background-color: #ffd84d;
background-color: #f4f4f4;

.ranking {
background-color: #2a2a2a;
background-color: #ffd84d;
color: #fff;
}
}

.PodiumSpot--second {
background-color: #d4d4d4;
background-color: #f4f4f4;

.ranking {
background-color: #2a2a2a;
background-color: #746b65;
color: #fff;
}
}

.PodiumSpot--third {
background-color: #f1a87d;
background-color: #f4f4f4;

.ranking {
background-color: #2a2a2a;
background-color: #854e29;
color: #fff;
}
}

.PodiumSpot--fourth {
background-color: #8dccd4;
background-color: #f4f4f4;

.ranking {
background-color: #2a2a2a;
background-color: #1e94a3;
color: #fff;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/shared/containers/tco/Leaderboard/themes/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

.Leaderboard {
padding: 0;
margin: 50px auto;
margin: 40px auto;
max-width: $screen-md;
}

Expand Down
2 changes: 1 addition & 1 deletion src/shared/utils/tc.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export const RATING_COLORS = [{
color: '#616BD5' /* Blue */,
limit: 1500,
}, {
color: '#FCD617' /* Yellow */,
color: '#F2C900' /* Yellow */,
limit: 2200,
}, {
color: '#EF3A3A' /* Red */,
Expand Down