From 4a902594869e9cee3ab8a9b40d62dde8518b7e48 Mon Sep 17 00:00:00 2001 From: Simone Torrisi Date: Tue, 14 May 2019 18:33:35 +0200 Subject: [PATCH 1/6] Reduced score renderer opacity --- src/styles/_ScoreRenderer.scss | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/styles/_ScoreRenderer.scss b/src/styles/_ScoreRenderer.scss index c3349ed6e..16caa6d74 100644 --- a/src/styles/_ScoreRenderer.scss +++ b/src/styles/_ScoreRenderer.scss @@ -7,7 +7,7 @@ } .ScoreRenderer__domain { display: flex; - width: 300px; + width: 400px; } .ScoreRenderer__domain__section { padding: 10px; @@ -20,5 +20,6 @@ } } .ant-tooltip-inner { - width: 300px !important; + background-color: rgba(0, 0, 0, 0.9); + width: 400px !important; } From 958550b92907015a6832b743f76dadb32d07417a Mon Sep 17 00:00:00 2001 From: Simone Torrisi Date: Tue, 14 May 2019 18:33:47 +0200 Subject: [PATCH 2/6] Added suffix and unit to scores --- src/components/Navigation/Ui/ScoreRenderer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Navigation/Ui/ScoreRenderer.js b/src/components/Navigation/Ui/ScoreRenderer.js index 5694e9b7b..d6f39be92 100644 --- a/src/components/Navigation/Ui/ScoreRenderer.js +++ b/src/components/Navigation/Ui/ScoreRenderer.js @@ -49,7 +49,7 @@ class ScoreRenderer extends Component { const color = this.getColor(score[name], maxScores[name] || 100, ['#d6af22', '#2cbe4e']) return (

- {label}: {score[name]} + {label}: {score[name]}/100 points

) } From 111a28bae97eaaae7410caced7f4faa0aafb8026 Mon Sep 17 00:00:00 2001 From: Simone Torrisi Date: Tue, 14 May 2019 18:37:18 +0200 Subject: [PATCH 3/6] functional component for unit rendering --- src/components/Navigation/Ui/ScoreRenderer.js | 19 ++++++++++++++++--- src/styles/_ScoreRenderer.scss | 3 +++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/components/Navigation/Ui/ScoreRenderer.js b/src/components/Navigation/Ui/ScoreRenderer.js index d6f39be92..fccca243a 100644 --- a/src/components/Navigation/Ui/ScoreRenderer.js +++ b/src/components/Navigation/Ui/ScoreRenderer.js @@ -49,7 +49,8 @@ class ScoreRenderer extends Component { const color = this.getColor(score[name], maxScores[name] || 100, ['#d6af22', '#2cbe4e']) return (

- {label}: {score[name]}/100 points + {label}: {score[name]} + {this.renderUnit()}

) } @@ -82,17 +83,29 @@ class ScoreRenderer extends Component { return (
-

{`Effective: ${isNumber(effective.total) ? effective.total : effective}`}

+

+ {`Effective: ${isNumber(effective.total) ? effective.total : effective}`} + {this.renderUnit()} +

{this.renderScore(effective)}
-

{`Tools: ${isNumber(tools.total) ? tools.total : tools}`}

+

+ {`Tools: ${isNumber(tools.total) ? tools.total : tools}`} + {this.renderUnit()} +

{this.renderScore(tools)}
) } + renderUnit = () => ( + + / 100 points + + ) + render() { const { domain, scores } = this.props if (!domain && !scores) return null diff --git a/src/styles/_ScoreRenderer.scss b/src/styles/_ScoreRenderer.scss index 16caa6d74..9a103b3ff 100644 --- a/src/styles/_ScoreRenderer.scss +++ b/src/styles/_ScoreRenderer.scss @@ -18,6 +18,9 @@ padding: 0; } } + .unit { + font-size: 12px; + } } .ant-tooltip-inner { background-color: rgba(0, 0, 0, 0.9); From 1f288db123c2386860bccfae6ad37da90bf1b9ba Mon Sep 17 00:00:00 2001 From: Simone Torrisi Date: Wed, 15 May 2019 18:38:53 +0200 Subject: [PATCH 4/6] Add link to documentation --- src/components/Navigation/Ui/ScoreRenderer.js | 18 +++++++++++++++++- src/styles/_ScoreRenderer.scss | 9 +++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/components/Navigation/Ui/ScoreRenderer.js b/src/components/Navigation/Ui/ScoreRenderer.js index fccca243a..7a847ec81 100644 --- a/src/components/Navigation/Ui/ScoreRenderer.js +++ b/src/components/Navigation/Ui/ScoreRenderer.js @@ -72,10 +72,15 @@ class ScoreRenderer extends Component {

Licensed

{this.renderScores(licensedScore, licensedToolScore)} + {this.renderScoreInfo()} ) } else { - return
{this.renderScores(get(domain, 'score'), get(domain, 'toolScore'))}
+ return ( +
+ {this.renderScores(get(domain, 'score'), get(domain, 'toolScore'))} {this.renderScoreInfo()} +
+ ) } } @@ -106,6 +111,17 @@ class ScoreRenderer extends Component { ) + renderScoreInfo = () => ( +
+ + What does these scores mean? + +
+ ) + render() { const { domain, scores } = this.props if (!domain && !scores) return null diff --git a/src/styles/_ScoreRenderer.scss b/src/styles/_ScoreRenderer.scss index 9a103b3ff..b12c1550c 100644 --- a/src/styles/_ScoreRenderer.scss +++ b/src/styles/_ScoreRenderer.scss @@ -5,6 +5,15 @@ color: white; font-size: 16px; } + .ScoreInfo { + font-size: 12px; + text-decoration: underline; + width: 100%; + text-align: right; + a { + color: white; + } + } .ScoreRenderer__domain { display: flex; width: 400px; From f96dcebd137b060bbea2c1efd9eb692af32985b2 Mon Sep 17 00:00:00 2001 From: Simone Torrisi Date: Mon, 20 May 2019 15:31:13 +0200 Subject: [PATCH 5/6] Fix score renderer tests --- .../Navigation/Ui/__tests__/ScoreRenderer.test.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/components/Navigation/Ui/__tests__/ScoreRenderer.test.js b/src/components/Navigation/Ui/__tests__/ScoreRenderer.test.js index 49605469e..7d5c17c8d 100644 --- a/src/components/Navigation/Ui/__tests__/ScoreRenderer.test.js +++ b/src/components/Navigation/Ui/__tests__/ScoreRenderer.test.js @@ -48,11 +48,21 @@ describe('ScoreRenderer', () => { expect(resultScores).toEqual(
-

Effective: 0

+

+ Effective: 0 + + / 100 points + +

{instance.renderScore(licensedScore)}
-

Tools: 0

+

+ Tools: 0 + + / 100 points + +

{instance.renderScore(licensedToolScore)}
From 6bdd53e163206cc17a4803588ac28dc13c268442 Mon Sep 17 00:00:00 2001 From: Simone Torrisi Date: Mon, 3 Jun 2019 16:41:36 +0200 Subject: [PATCH 6/6] Pr fixes --- src/components/Navigation/Ui/ScoreRenderer.js | 8 ++------ .../Navigation/Ui/__tests__/ScoreRenderer.test.js | 10 ++-------- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/src/components/Navigation/Ui/ScoreRenderer.js b/src/components/Navigation/Ui/ScoreRenderer.js index 7a847ec81..ea05232b3 100644 --- a/src/components/Navigation/Ui/ScoreRenderer.js +++ b/src/components/Navigation/Ui/ScoreRenderer.js @@ -105,11 +105,7 @@ class ScoreRenderer extends Component { ) } - renderUnit = () => ( - - / 100 points - - ) + renderUnit = () => /100 renderScoreInfo = () => (
@@ -117,7 +113,7 @@ class ScoreRenderer extends Component { href="https://github.com/clearlydefined/license-score/blob/master/ClearlyLicensedMetrics.md#clearlylicensed-scoring-formula" target="_blank" > - What does these scores mean? + Scoring Formula
) diff --git a/src/components/Navigation/Ui/__tests__/ScoreRenderer.test.js b/src/components/Navigation/Ui/__tests__/ScoreRenderer.test.js index 7d5c17c8d..6f3728d64 100644 --- a/src/components/Navigation/Ui/__tests__/ScoreRenderer.test.js +++ b/src/components/Navigation/Ui/__tests__/ScoreRenderer.test.js @@ -49,19 +49,13 @@ describe('ScoreRenderer', () => {

- Effective: 0 - - / 100 points - + Effective: 0/100

{instance.renderScore(licensedScore)}

- Tools: 0 - - / 100 points - + Tools: 0/100

{instance.renderScore(licensedToolScore)}