@@ -223,6 +223,23 @@ function Certification() {
223
223
224
224
if ( contributor ) {
225
225
// Show success message with contributor info
226
+ // Fetch user's contributions to VigyBag
227
+ const contributionsResponse = await axios . get (
228
+ `https://api.github.com/repos/codervivek5/VigyBag/commits?author=${ contributor . login } `
229
+ ) ;
230
+
231
+ const contributions = contributionsResponse . data || [ ] ;
232
+ const contributionCount = contributions . length ;
233
+ const lastContribution = contributions [ 0 ] ? new Date ( contributions [ 0 ] . commit . author . date ) . toLocaleDateString ( ) : 'N/A' ;
234
+
235
+ // Prepare commits list HTML
236
+ const commitsList = contributions . slice ( 0 , 5 ) . map ( commit => `
237
+ <div class="text-left py-2 border-b border-gray-100 last:border-0">
238
+ <p class="text-sm font-medium text-gray-800 truncate">${ commit . commit . message . split ( '\n' ) [ 0 ] } </p>
239
+ <p class="text-xs text-gray-500">${ new Date ( commit . commit . author . date ) . toLocaleString ( ) } </p>
240
+ </div>
241
+ ` ) . join ( '' ) ;
242
+
226
243
Swal . fire ( {
227
244
title : '✅ Certificate Verified!' ,
228
245
html : `
@@ -233,21 +250,44 @@ function Certification() {
233
250
class="w-20 h-20 rounded-full mx-auto mb-4"
234
251
/>
235
252
<p class="text-lg font-semibold text-gray-800">${ contributor . login } </p>
236
- <p class="text-sm text-gray-600">Contributions: ${ contributor . contributions } </p>
253
+ <p class="text-sm text-gray-600">Total Contributions: ${ contributor . contributions } </p>
254
+
255
+ <div class="mt-4 p-4 bg-gray-50 rounded-lg text-left">
256
+ <h4 class="font-medium text-gray-800 mb-2">VigyBag Contributions:</h4>
257
+ <p class="text-sm text-gray-700">
258
+ <span class="font-medium">${ contributionCount } </span> commits
259
+ ${ lastContribution !== 'N/A' ? `<span class="text-gray-500 text-xs block mt-1">Last contribution: ${ lastContribution } </span>` : '' }
260
+ </p>
261
+
262
+ ${ contributionCount > 0 ? `
263
+ <div class="mt-3 max-h-40 overflow-y-auto border rounded p-2 bg-white">
264
+ <p class="text-xs font-medium text-gray-500 mb-2">Recent Commits:</p>
265
+ ${ commitsList }
266
+ ${ contributionCount > 5 ? `<p class="text-xs text-gray-500 mt-2">+ ${ contributionCount - 5 } more commits</p>` : '' }
267
+ </div>
268
+ ` : '<p class="text-sm text-gray-500 mt-2">No commits found in the main repository.</p>' }
269
+ </div>
270
+
237
271
<div class="mt-4 p-3 bg-green-50 rounded-lg">
238
272
<p class="text-sm text-green-700">This certificate is valid and verified.</p>
239
273
<p class="text-xs text-green-600 mt-1">User ID: ${ contributor . id } </p>
240
274
</div>
241
275
</div>
242
276
` ,
243
- confirmButtonText : 'View Profile' ,
277
+ confirmButtonText : 'View GitHub Profile' ,
244
278
confirmButtonColor : '#10b981' ,
245
279
showCancelButton : true ,
246
280
cancelButtonText : 'Close' ,
247
281
cancelButtonColor : '#6b7280' ,
282
+ showDenyButton : contributionCount > 0 ,
283
+ denyButtonText : 'View All Commits' ,
284
+ denyButtonColor : '#3b82f6' ,
285
+ width : '500px'
248
286
} ) . then ( ( result ) => {
249
287
if ( result . isConfirmed ) {
250
288
window . open ( contributor . html_url , '_blank' ) ;
289
+ } else if ( result . isDenied ) {
290
+ window . open ( `https://github.com/codervivek5/VigyBag/commits?author=${ contributor . login } ` , '_blank' ) ;
251
291
}
252
292
} ) ;
253
293
} else {
0 commit comments