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