Skip to content

Commit 0581c0e

Browse files
committed
refactored code
1 parent ddf3779 commit 0581c0e

File tree

7 files changed

+16
-26
lines changed

7 files changed

+16
-26
lines changed

src/shared/components/challenge-listing/ChallengeCard/MatchScore/index.jsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ export default function MatchScore({ score }) {
1010
{score}% match
1111
</DevelopmentTrackEventTag>
1212
</div>
13-
// <span styleName="match-score">
14-
// {score}% match
15-
// </span>
1613
);
1714
}
1815

src/shared/components/challenge-listing/ChallengeCard/MatchScore/style.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22

33
.matchScoreTag {
44
margin-right: 4px;
5+
margin-bottom: 4px;
56
display: inline-block;
67
}

src/shared/components/challenge-listing/NoChallengeCard/index.jsx

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
/**
2-
* Component for rendering a Review Opportunity and associated Challenge
3-
* information. Will be contained within a Bucket.
4-
*/
51
import React from 'react';
62

73
import './style.scss';
@@ -21,10 +17,4 @@ function NoChallengeCard() {
2117
);
2218
}
2319

24-
NoChallengeCard.defaultProps = {
25-
};
26-
27-
NoChallengeCard.propTypes = {
28-
};
29-
3020
export default NoChallengeCard;

src/shared/components/challenge-listing/NoChallengeCard/style.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,6 @@
2121
text-align: center;
2222
padding-bottom: 26px;
2323
padding-top: 10px;
24+
line-height: 22px;
25+
color: $tc-gray-60;
2426
}

src/shared/components/challenge-listing/Tags.jsx

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@ export default function Tags({
3434
</div>
3535
);
3636

37+
const tagRedirectLink = (item) => {
38+
if (challengesUrl && item.indexOf('+') !== 0) {
39+
return `${challengesUrl}?filter[tags][0]=${
40+
encodeURIComponent(item)}`;
41+
}
42+
return null;
43+
};
44+
3745
const renderVerifiedTag = item => (
3846
<div styleName="recommended-challenge-tooltip">
3947
<Tooltip
@@ -45,8 +53,7 @@ export default function Tags({
4553
onClick={() => onClick(item.trim())}
4654
key={item}
4755
role="button"
48-
to={(challengesUrl && item.indexOf('+') !== 0) ? `${challengesUrl}?filter[tags][0]=${
49-
encodeURIComponent(item)}` : null}
56+
to={tagRedirectLink(item)}
5057
>
5158
<VerifiedIcon styleName="verified-tag" />
5259
<span styleName={cn({ 'verified-tag-text': recommended })}>{item}</span>
@@ -69,8 +76,7 @@ export default function Tags({
6976
onClick={() => onClick(item.trim())}
7077
key={item}
7178
role="button"
72-
to={(challengesUrl && item.indexOf('+') !== 0) ? `${challengesUrl}?filter[tags][0]=${
73-
encodeURIComponent(item)}` : null}
79+
to={tagRedirectLink(item)}
7480
>
7581
<span>{item}</span>
7682
</Tag>
@@ -113,8 +119,7 @@ export default function Tags({
113119
onClick={() => onClick(item.trim())}
114120
key={item}
115121
role="button"
116-
to={(challengesUrl && item.indexOf('+') !== 0) ? `${challengesUrl}?filter[tags][0]=${
117-
encodeURIComponent(item)}` : null}
122+
to={tagRedirectLink(item)}
118123
>
119124
<span>{item}</span>
120125
</Tag>
@@ -130,8 +135,7 @@ export default function Tags({
130135
onClick={() => onClick(item.trim())}
131136
key={item}
132137
role="button"
133-
to={(challengesUrl && item.indexOf('+') !== 0) ? `${challengesUrl}?filter[tags][0]=${
134-
encodeURIComponent(item)}` : null}
138+
to={tagRedirectLink(item)}
135139
>
136140
<span>{item}</span>
137141
</Tag>

src/shared/components/challenge-listing/index.jsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,6 @@ export default function ChallengeListing(props) {
166166

167167
return (
168168
<div styleName="ChallengeFiltersExample" id="challengeFilterContainer">
169-
{/* <ChallengeSearchBar
170-
setFilterState={props.setFilterState}
171-
/> */}
172-
173169
<div styleName="tc-content-wrapper">
174170
<div styleName={desktop ? 'sidebar-container-desktop' : 'sidebar-container-mobile'}>
175171
<Sidebar

src/shared/utils/challenge-listing/sort.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ export default {
101101
name: 'Review start date',
102102
},
103103
[SORTS.BEST_MATCH]: {
104-
func: (a, b) => calculateScore(b.matchScore) - calculateScore(a.matchScore),
104+
func: (a, b) => calculateScore(b.jaccard_index) - calculateScore(a.jaccard_index),
105105
name: 'Best Match',
106106
},
107107
};

0 commit comments

Comments
 (0)