File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -125,9 +125,18 @@ export default function ContestDiscussion({ contestId }: ContestDiscussionProps)
125125 </ div >
126126 ) : (
127127 < div className = "space-y-4" >
128- { comments . map ( ( comment ) => (
128+ { comments . map ( ( comment ) => {
129+ const getAvatarSrc = ( author : any ) => {
130+ if ( author . avatar ?. startsWith ( 'http' ) ) return author . avatar ;
131+ if ( author . profile_key && author . avatar ) {
132+ return `https://cdn.discordapp.com/avatars/${ author . profile_key } /${ author . avatar } .png` ;
133+ }
134+ return "/img/discord-avatar.png" ;
135+ } ;
136+
137+ return (
129138 < div key = { comment . comment_id } className = "bg-neutral-900/30 p-5 rounded-2xl border border-neutral-800/50 flex gap-4 relative group" >
130- < img src = { comment . author . avatar || "/img/discord-avatar.png" } alt = { comment . author . username } className = "w-10 h-10 rounded-full object-cover shrink-0" />
139+ < img src = { getAvatarSrc ( comment . author ) } alt = { comment . author . username } className = "w-10 h-10 rounded-full object-cover shrink-0" />
131140 < div className = "flex-1 min-w-0" >
132141 < div className = "flex items-center justify-between mb-1" >
133142 < div className = "flex items-center gap-2 truncate" >
@@ -208,7 +217,8 @@ export default function ContestDiscussion({ contestId }: ContestDiscussionProps)
208217 ) }
209218 </ div >
210219 </ div >
211- ) ) }
220+ ) ;
221+ } ) }
212222 </ div >
213223 ) }
214224 </ div >
You can’t perform that action at this time.
0 commit comments