@@ -47,7 +47,7 @@ async function fetchStatistics(type, value) {
4747 return data ;
4848}
4949
50- async function loadAndRender ( type , value ) {
50+ async function loadAndRender ( type , value , label ) {
5151 try {
5252 // fetch stats
5353 const modalEl = document . getElementById ( "loadingModal" ) ;
@@ -57,7 +57,7 @@ async function loadAndRender(type, value) {
5757 modal . hide ( ) ;
5858
5959 // render stats
60- renderSummary ( stats ) ;
60+ renderSummary ( stats , label ) ;
6161 buildAuthorsChart ( stats . authors_statistics . authors ) ;
6262 buildAuthorsStackedChart ( stats . authors_statistics . authors ) ;
6363 buildHourByAuthorChart ( stats . historical_statistics . hour_of_day ) ;
@@ -72,7 +72,7 @@ async function loadAndRender(type, value) {
7272 }
7373}
7474
75- function renderSummary ( stats ) {
75+ function renderSummary ( stats , rangeLabel ) {
7676 const s = stats . commits_summary ;
7777 if ( ! s ) return ;
7878
@@ -81,6 +81,7 @@ function renderSummary(stats) {
8181
8282 summaryEl . innerHTML = `
8383 <div>
84+ <strong>Statistics for:</strong> ${ rangeLabel . toLowerCase ( ) } <br>
8485 <strong>Total number of authors:</strong> ${ s . total_number_authors } <br>
8586 <strong>Total number of commits:</strong> ${ s . total_number_commit } <br>
8687 <strong>Date of the first commit:</strong> ${ s . date_first_commit } <br>
@@ -470,15 +471,16 @@ document.addEventListener("DOMContentLoaded", () => {
470471 const menu = document . getElementById ( "rangeMenu" ) ;
471472 const btn = document . getElementById ( "rangeDropdownBtn" ) ;
472473
473- loadAndRender ( "months" , 1 ) ;
474+ loadAndRender ( "months" , 1 , "Last month" ) ;
474475
475476 menu . addEventListener ( "click" , ( e ) => {
476477 const item = e . target . closest ( ".dropdown-item" ) ;
477478 if ( ! item ) return ;
478479 e . preventDefault ( ) ;
479480 const type = item . dataset . type ;
480481 const value = item . dataset . value ;
482+ const label = item . textContent . trim ( ) ;
481483 btn . textContent = item . textContent . trim ( ) ;
482- loadAndRender ( type , value ) ;
484+ loadAndRender ( type , value , label ) ;
483485 } ) ;
484486} ) ;
0 commit comments