Skip to content

Commit e50b62b

Browse files
committed
add awardedAt date
1 parent fa46579 commit e50b62b

File tree

4 files changed

+28
-2
lines changed

4 files changed

+28
-2
lines changed

src/shared/components/ProfileBadgesPage/index.jsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { Modal } from 'topcoder-react-ui-kit';
66
import IconClose from 'assets/images/tc-edu/icon-close-big.svg';
77
import FallBackAwardIcon from 'assets/images/default-award.svg';
88
import md from 'utils/markdown';
9+
import { format } from 'date-fns';
910
import AwardModal from '../ProfilePage/Awards/AwardModal';
1011

1112
import style from './styles.scss';
@@ -47,6 +48,10 @@ const ProfileBadges = ({ badges, handleParam }) => {
4748
if (description) {
4849
description = md(description);
4950
}
51+
let awardedAt = get(reward, 'awarded_at');
52+
if (awardedAt) {
53+
awardedAt = format(new Date(awardedAt), 'PPP');
54+
}
5055

5156
return (
5257
<div
@@ -58,6 +63,7 @@ const ProfileBadges = ({ badges, handleParam }) => {
5863
title,
5964
description,
6065
imageUrl,
66+
awardedAt,
6167
});
6268
}}
6369
>

src/shared/components/ProfilePage/Awards/AwardModal/index.jsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const AwatarModal = ({
88
modalData,
99
}) => {
1010
const {
11-
title, description, imageUrl,
11+
title, description, imageUrl, awardedAt,
1212
} = modalData;
1313

1414
return (
@@ -25,6 +25,9 @@ const AwatarModal = ({
2525
<div styleName="title">
2626
<span>{title}</span>
2727
</div>
28+
{
29+
awardedAt && <div styleName="awardedAt">{`Awarded on ${awardedAt}`}</div>
30+
}
2831

2932
<div styleName="description">{description}</div>
3033

@@ -41,6 +44,7 @@ AwatarModal.propTypes = {
4144
modalData: PT.shape(
4245
{
4346
title: PT.string,
47+
awardedAt: PT.string,
4448
description: PT.string,
4549
imageUrl: PT.string,
4650
},

src/shared/components/ProfilePage/Awards/AwardModal/styles.scss

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,24 @@
4444
}
4545
}
4646

47+
.awardedAt {
48+
@include roboto-bold;
49+
50+
color: $listing-placeholder-gray;
51+
font-size: 12px;
52+
line-height: 16px;
53+
text-transform: uppercase;
54+
margin-top: 8px;
55+
}
56+
4757
.description {
4858
@include brackets-content;
4959

5060
font-weight: 400;
5161
color: $tco-black;
5262
font-size: 16px;
5363
line-height: 24px;
54-
margin-top: 10px;
64+
margin-top: 16px;
5565
}
5666

5767
@include xs-to-md {

src/shared/components/ProfilePage/Awards/index.jsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import IconClose from 'assets/images/tc-edu/icon-close-big.svg';
55
import _ from 'lodash';
66
import md from 'utils/markdown';
77
import { Link } from 'react-router-dom';
8+
import { format } from 'date-fns';
89

910
import style from './styles.scss';
1011
import AwardBadge from './AwardBadge';
@@ -37,6 +38,10 @@ const Awards = ({ badges, info }) => {
3738
if (description) {
3839
description = md(description);
3940
}
41+
let awardedAt = _.get(reward, 'awarded_at');
42+
if (awardedAt) {
43+
awardedAt = format(new Date(awardedAt), 'PPP');
44+
}
4045

4146
return (
4247
<AwardBadge
@@ -48,6 +53,7 @@ const Awards = ({ badges, info }) => {
4853
title,
4954
description,
5055
imageUrl,
56+
awardedAt,
5157
});
5258
}}
5359
/>

0 commit comments

Comments
 (0)