@@ -87,37 +87,62 @@ function fetchRepos(force = false) {
8787 } ) ;
8888}
8989
90- function updateRepos ( data ) {
90+ function updateRepos ( data ) {
9191 const repoContainer = document . querySelector ( ".repo-container" ) ;
92+
93+ // Define custom fallback icons
94+ const defaultIcons = {
95+ "sandbox" : "assets/img/icons/sandbox.png" ,
96+ "udgam2k23app" : "assets/img/icons/udgam.jfif" ,
97+ "devcans.github.io" : "assets/img/icon.png" , // already your website repo
98+ "default" : "assets/img/default-icon.png"
99+ } ;
100+
92101 data . forEach ( ( val ) => {
93102 // Creating Repo card
94- let repoItem = createElement ( "div" , { class : "col-md-6 col-lg-4 repo-item" } ) ;
95- let box = createElement ( "div" , { class : "box" } ) ;
96- let icon = createElement ( "div" , { class : "icon" } ) ;
97-
103+ let repoItem = createElement ( "div" , { class : "col-md-6 col-lg-4 repo-item" } ) ;
104+ let box = createElement ( "div" , { class : "box" } ) ;
105+ let icon = createElement ( "div" , { class : "icon" } ) ;
106+
98107 // Fetching image for repository
99108 let iconImg = val . name . split ( "-" ) [ 0 ] . toLowerCase ( ) ;
100109 let imgSource = "" ;
101110
102111 if ( iconImg === "website" ) {
103112 // For devcans website repo
104- imgSource = "assets/img/icon.png"
113+ imgSource = "assets/img/icon.png" ;
105114 } else {
106115 if ( iconImg === "web" ) {
107116 iconImg = "html" ;
108117 }
109118 imgSource = `https://raw.githubusercontent.com/github/explore/80688e429a7d4ef2fca1e82350fe8e3517d3494d/topics/${ iconImg } /${ iconImg } .png` ;
110119 }
111- icon . appendChild ( createElement ( "img" , { src : imgSource , class : "icon" , style : "background: #FCEEF3;" } ) ) ;
120+
121+ // Choose fallback based on repo name or default
122+ let fallback = defaultIcons [ val . name . toLowerCase ( ) ] || defaultIcons [ "default" ] ;
123+
124+ // Append icon with fallback handler
125+ icon . appendChild (
126+ createElement ( "img" , {
127+ src : imgSource ,
128+ class : "icon" ,
129+ style : "background: #FCEEF3;" ,
130+ onerror : `this.onerror=null; this.src='${ fallback } ';`
131+ } )
132+ ) ;
133+
112134 box . appendChild ( icon ) ;
113- let h3 = createElement ( "h3" , { class : "title" } ) ;
135+
136+ let h3 = createElement ( "h3" , { class : "title" } ) ;
114137 h3 . innerHTML = `
115138 <a href="${ val . html_url } " target="_blank">${ val . name . replaceAll ( "-" , " " ) . toUpperCase ( ) } </a>
116139 ` ;
117140 box . appendChild ( h3 ) ;
118- let p = createElement ( "p" , { class : "description" } ) ;
141+
142+ let p = createElement ( "p" , { class : "description" } ) ;
119143 p . innerHTML = val . description ;
120144 box . appendChild ( p ) ;
145+
121146 repoItem . appendChild ( box ) ;
122147 repoContainer . appendChild ( repoItem ) ;
123148 } ) ;
@@ -129,7 +154,7 @@ function updateRepos(data){
129154 let text = button . childNodes [ 3 ] . textContent ;
130155
131156 text == "Show More" ? text = "Show Less" : text = "Show More" ;
132-
157+
133158 button . childNodes [ 3 ] . textContent = text ;
134159 button . childNodes [ 5 ] . classList . toggle ( "more-btn-inactive" ) ;
135160
@@ -141,6 +166,7 @@ function updateRepos(data){
141166 } ) ;
142167}
143168
169+
144170function fetchTeam ( force = false ) {
145171 fetch ( "./assets/js/members.json" )
146172 . then (
0 commit comments