From 7c2912c5d856302a4d2ed0b39aa8fcaff8818fb6 Mon Sep 17 00:00:00 2001 From: kolaente Date: Thu, 18 Jul 2019 14:11:26 +0200 Subject: [PATCH 1/2] Added total count of contributions to heatmap Signed-off-by: kolaente --- public/css/index.css | 1 + public/js/index.js | 6 ++++-- public/less/_base.less | 6 ++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/public/css/index.css b/public/css/index.css index 4a7dfb2824bf0..e50e8249417e7 100644 --- a/public/css/index.css +++ b/public/css/index.css @@ -200,6 +200,7 @@ footer .ui.left,footer .ui.right{line-height:40px} #user-heatmap svg:not(:root){overflow:inherit;padding:0!important} @media only screen and (max-width:1200px){#user-heatmap{display:none} } +#user-heatmap .total-contributions{text-align:left;font-weight:500} .heatmap-color-0{background-color:#f4f4f4} .heatmap-color-1{background-color:#d7e5db} .heatmap-color-2{background-color:#adc7ab} diff --git a/public/js/index.js b/public/js/index.js index d26764fcc7288..afc894ca3b257 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -2564,7 +2564,8 @@ function initHeatmap(appElementId, heatmapUser, locale) { isLoading: true, colorRange: [], endDate: null, - values: [] + values: [], + totalContributions: 0, }; }, @@ -2587,6 +2588,7 @@ function initHeatmap(appElementId, heatmapUser, locale) { $.get(this.suburl + '/api/v1/users/' + userName + '/heatmap', function(chartRawData) { const chartData = []; for (let i = 0; i < chartRawData.length; i++) { + self.totalContributions += chartRawData[i].contributions; chartData[i] = { date: new Date(chartRawData[i].timestamp * 1000), count: chartRawData[i].contributions }; } self.values = chartData; @@ -2607,7 +2609,7 @@ function initHeatmap(appElementId, heatmapUser, locale) { } }, - template: '
' + template: '

total contributions in the last 12 months

' }); new Vue({ diff --git a/public/less/_base.less b/public/less/_base.less index b9d9c88da5f9e..ddf174cf475f3 100644 --- a/public/less/_base.less +++ b/public/less/_base.less @@ -842,6 +842,12 @@ footer { display: none; } } + + .total-contributions { + text-align: left; + font-weight: 500; + margin-top: 0; + } } .heatmap-color-0 { From 3d8bc210cbed006e0b291c56b69b134cc878b5f2 Mon Sep 17 00:00:00 2001 From: kolaente Date: Thu, 18 Jul 2019 14:34:29 +0200 Subject: [PATCH 2/2] make css Signed-off-by: kolaente --- public/css/index.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/css/index.css b/public/css/index.css index e50e8249417e7..96dfcb0e8b7e3 100644 --- a/public/css/index.css +++ b/public/css/index.css @@ -200,7 +200,7 @@ footer .ui.left,footer .ui.right{line-height:40px} #user-heatmap svg:not(:root){overflow:inherit;padding:0!important} @media only screen and (max-width:1200px){#user-heatmap{display:none} } -#user-heatmap .total-contributions{text-align:left;font-weight:500} +#user-heatmap .total-contributions{text-align:left;font-weight:500;margin-top:0} .heatmap-color-0{background-color:#f4f4f4} .heatmap-color-1{background-color:#d7e5db} .heatmap-color-2{background-color:#adc7ab}