@@ -28,8 +28,10 @@ <h1 class="text-3xl font-bold mb-6 text-center">Contributors</h1>
2828
2929 async function fetchContributors ( ) {
3030 const response = await fetch ( '/api/v2/contributors' ) ;
31- const contributors = await response . json ( ) ;
32- return contributors ;
31+ if ( ! response . ok ) {
32+ throw new Error ( 'Failed to fetch contributors' ) ;
33+ }
34+ return response . json ( ) ;
3335 }
3436
3537 // Function to render issues into the table
@@ -41,9 +43,10 @@ <h1 class="text-3xl font-bold mb-6 text-center">Contributors</h1>
4143 const listItem = document . createElement ( 'li' ) ;
4244 listItem . classList . add ( 'flex' , 'justify-center' ) ;
4345 listItem . innerHTML = `<a target="_blank" href="https://github.com/${ contributor . userName } ">
44- <div class="flex flex-col justify-center">
46+ <div class="flex flex-col justify-center items-center ">
4547 <img class="rounded-full h-32 w-32 bg-slate-600 p-0.5 grow" src="${ contributor . avatarUrl } " alt="Avatar of ${ contributor . userName } ">
46- <span class="text-center">${ contributor . userName } </span>
48+ <span class="text-center mt-2 font-medium">${ contributor . userName } </span>
49+ <span class="text-center text-sm text-gray-500">${ contributor . contributions } Contributions</span>
4750 </div>
4851 </a>
4952` ;
@@ -55,14 +58,14 @@ <h1 class="text-3xl font-bold mb-6 text-center">Contributors</h1>
5558 document . addEventListener ( 'DOMContentLoaded' , async ( ) => {
5659 const loadingElement = document . getElementById ( 'loading' ) ;
5760 const listElement = document . getElementById ( 'contributors-list' ) ;
58- let contributors = [ ] ;
5961 try {
60- contributors = await fetchContributors ( ) ;
62+ const contributors = await fetchContributors ( ) ;
6163 renderContributors ( contributors ) ;
6264 loadingElement . classList . add ( 'hidden' ) ;
6365 listElement . classList . remove ( 'hidden' ) ;
6466 } catch ( error ) {
6567 loadingElement . textContent = 'Failed to load data. Please try again later.' ;
68+ console . error ( error ) ;
6669 }
6770 } ) ;
6871</ script >
0 commit comments