Skip to content

Commit be9d67f

Browse files
kolaentetechknowlogick
authored andcommitted
Added total count of contributions to heatmap (#7517)
* Added total count of contributions to heatmap Signed-off-by: kolaente <[email protected]> * make css Signed-off-by: kolaente <[email protected]>
1 parent 3cba42c commit be9d67f

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

public/css/index.css

+1
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ footer .ui.left,footer .ui.right{line-height:40px}
200200
#user-heatmap svg:not(:root){overflow:inherit;padding:0!important}
201201
@media only screen and (max-width:1200px){#user-heatmap{display:none}
202202
}
203+
#user-heatmap .total-contributions{text-align:left;font-weight:500;margin-top:0}
203204
.heatmap-color-0{background-color:#f4f4f4}
204205
.heatmap-color-1{background-color:#d7e5db}
205206
.heatmap-color-2{background-color:#adc7ab}

public/js/index.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -2564,7 +2564,8 @@ function initHeatmap(appElementId, heatmapUser, locale) {
25642564
isLoading: true,
25652565
colorRange: [],
25662566
endDate: null,
2567-
values: []
2567+
values: [],
2568+
totalContributions: 0,
25682569
};
25692570
},
25702571

@@ -2587,6 +2588,7 @@ function initHeatmap(appElementId, heatmapUser, locale) {
25872588
$.get(this.suburl + '/api/v1/users/' + userName + '/heatmap', function(chartRawData) {
25882589
const chartData = [];
25892590
for (let i = 0; i < chartRawData.length; i++) {
2591+
self.totalContributions += chartRawData[i].contributions;
25902592
chartData[i] = { date: new Date(chartRawData[i].timestamp * 1000), count: chartRawData[i].contributions };
25912593
}
25922594
self.values = chartData;
@@ -2607,7 +2609,7 @@ function initHeatmap(appElementId, heatmapUser, locale) {
26072609
}
26082610
},
26092611

2610-
template: '<div><div v-show="isLoading"><slot name="loading"></slot></div><calendar-heatmap v-show="!isLoading" :locale="locale" :no-data-text="locale.no_contributions" :tooltip-unit="locale.contributions" :end-date="endDate" :values="values" :range-color="colorRange" />'
2612+
template: '<div><div v-show="isLoading"><slot name="loading"></slot></div><h4 class="total-contributions" v-if="!isLoading"><span v-html="totalContributions"></span> total contributions in the last 12 months</h4><calendar-heatmap v-show="!isLoading" :locale="locale" :no-data-text="locale.no_contributions" :tooltip-unit="locale.contributions" :end-date="endDate" :values="values" :range-color="colorRange" />'
26112613
});
26122614

26132615
new Vue({

public/less/_base.less

+6
Original file line numberDiff line numberDiff line change
@@ -842,6 +842,12 @@ footer {
842842
display: none;
843843
}
844844
}
845+
846+
.total-contributions {
847+
text-align: left;
848+
font-weight: 500;
849+
margin-top: 0;
850+
}
845851
}
846852

847853
.heatmap-color-0 {

0 commit comments

Comments
 (0)