@@ -104,6 +104,55 @@ $(document).ready(function(){
104104 card_footer . className = "card-footer p-2 pt-0 border-0 rounded-0"
105105 card . appendChild ( card_footer )
106106
107+ // Add commit activity graph
108+ $ . ajax ( {
109+ url : `${ base_url } /${ cache_repo } /github/commitActivity/${ sorted [ repo ] [ 'name' ] } .json` ,
110+ type : "GET" ,
111+ dataType : "json" ,
112+ success : function ( commitActivity ) {
113+ // Create a container for the activity graph
114+ let activity_container = document . createElement ( "div" )
115+ activity_container . className = "commit-activity-graph mt-2 mb-2 mx-3"
116+ activity_container . style . cssText = "display: flex; gap: 2px; height: 32px; align-items: flex-end;"
117+
118+ // Find max value for scaling
119+ let maxCommits = Math . max ( ...commitActivity . map ( week => week . total ) )
120+
121+ // Create bars for each week
122+ for ( let week of commitActivity ) {
123+ let bar = document . createElement ( "div" )
124+ let height = maxCommits > 0 ? ( week . total / maxCommits ) * 100 : 0
125+
126+ bar . style . cssText = `
127+ flex: 1;
128+ min-width: 2px;
129+ background-color: ${ week . total === 0 ? 'rgba(255,255,255,0.1)' : 'rgba(64, 196, 99, ' + ( 0.3 + ( height / 100 ) * 0.7 ) + ')' } ;
130+ height: ${ Math . max ( height , 10 ) } %;
131+ border-radius: 1px;
132+ transition: all 0.2s ease;
133+ `
134+ bar . title = `${ week . total } commits this week`
135+
136+ // Add hover effect
137+ bar . addEventListener ( 'mouseenter' , function ( ) {
138+ this . style . backgroundColor = week . total === 0 ? 'rgba(255,255,255,0.2)' : 'rgba(64, 196, 99, 1)'
139+ } )
140+ bar . addEventListener ( 'mouseleave' , function ( ) {
141+ this . style . backgroundColor = week . total === 0 ? 'rgba(255,255,255,0.1)' : 'rgba(64, 196, 99, ' + ( 0.3 + ( height / 100 ) * 0.7 ) + ')'
142+ } )
143+
144+ activity_container . appendChild ( bar )
145+ }
146+
147+ // Insert as first child of card_footer
148+ card_footer . insertBefore ( activity_container , card_footer . firstChild )
149+ } ,
150+ error : function ( ) {
151+ // Silently fail if commit activity data is not available
152+ console . log ( `No commit activity data available for ${ sorted [ repo ] [ 'name' ] } ` )
153+ }
154+ } )
155+
107156 let repo_data_row = document . createElement ( "div" )
108157 repo_data_row . className = "d-flex align-items-center"
109158 card_footer . appendChild ( repo_data_row )
0 commit comments