-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Score Rendering improvements #713
Merged
geneh
merged 10 commits into
clearlydefined:master
from
WebYourMind:webyourmind/issue-652
Jun 3, 2019
Merged
Changes from 7 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
4a90259
Reduced score renderer opacity
storrisi 958550b
Added suffix and unit to scores
storrisi 111a28b
functional component for unit rendering
storrisi 59016f9
Merge branch 'master' into webyourmind/issue-652
storrisi 1f288db
Add link to documentation
storrisi f96dceb
Fix score renderer tests
storrisi affbab6
Merge branch 'master' into webyourmind/issue-652
dabutvin b7ae285
Merge branch 'master' into webyourmind/issue-652
storrisi 6bdd53e
Pr fixes
storrisi b684f53
Merge branch 'master' into webyourmind/issue-652
geneh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,6 +50,7 @@ class ScoreRenderer extends Component { | |
return ( | ||
<p style={{ color }}> | ||
{label}: {score[name]} | ||
{this.renderUnit()} | ||
</p> | ||
) | ||
} | ||
|
@@ -71,28 +72,56 @@ class ScoreRenderer extends Component { | |
|
||
<h2>Licensed</h2> | ||
{this.renderScores(licensedScore, licensedToolScore)} | ||
{this.renderScoreInfo()} | ||
</div> | ||
) | ||
} else { | ||
return <div className="ScoreRenderer">{this.renderScores(get(domain, 'score'), get(domain, 'toolScore'))}</div> | ||
return ( | ||
<div className="ScoreRenderer"> | ||
{this.renderScores(get(domain, 'score'), get(domain, 'toolScore'))} {this.renderScoreInfo()} | ||
</div> | ||
) | ||
} | ||
} | ||
|
||
renderScores(effective, tools) { | ||
return ( | ||
<div className="ScoreRenderer__domain"> | ||
<div className="ScoreRenderer__domain__section"> | ||
<h2>{`Effective: ${isNumber(effective.total) ? effective.total : effective}`}</h2> | ||
<h2> | ||
{`Effective: ${isNumber(effective.total) ? effective.total : effective}`} | ||
{this.renderUnit()} | ||
</h2> | ||
{this.renderScore(effective)} | ||
</div> | ||
<div className="ScoreRenderer__domain__section"> | ||
<h2>{`Tools: ${isNumber(tools.total) ? tools.total : tools}`}</h2> | ||
<h2> | ||
{`Tools: ${isNumber(tools.total) ? tools.total : tools}`} | ||
{this.renderUnit()} | ||
</h2> | ||
{this.renderScore(tools)} | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
renderUnit = () => ( | ||
<span> | ||
/ 100 <span className="unit">points</span> | ||
</span> | ||
) | ||
|
||
renderScoreInfo = () => ( | ||
<div className="ScoreInfo"> | ||
<a | ||
href="https://github.com/clearlydefined/license-score/blob/master/ClearlyLicensedMetrics.md#clearlylicensed-scoring-formula" | ||
target="_blank" | ||
> | ||
What does these scores mean? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's change it to "Scoring formula" |
||
</a> | ||
</div> | ||
) | ||
|
||
render() { | ||
const { domain, scores } = this.props | ||
if (!domain && !scores) return null | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's drop "points" everywhere and make sure the spacing around the slash is even.