File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import Image from 'next/image' ;
12import { Profile } from '@/lib/home/profileService' ;
23import Card from './Card' ;
34import { getRandomProfileIcon } from '@/utils/getRandomProfileIcon' ;
5+
46interface ProfileSectionProps {
57 className ?: string ;
68 profile : Profile | null ;
@@ -9,12 +11,27 @@ interface ProfileSectionProps {
911
1012const ProfileSection = ( { className, profile, uid } : ProfileSectionProps ) => {
1113 const icon = getRandomProfileIcon ( uid ) ;
14+ const avatarUrl = profile ?. avatar_url ;
15+ console . log ( avatarUrl ) ;
16+
1217 return (
1318 < div className = { className } >
1419 < div className = "md:col-span-2" >
1520 < Card className = "flex items-center gap-4" >
1621 < div className = "flex h-16 w-16 items-center justify-center overflow-hidden rounded-full border border-gray-100 bg-purple-100 pt-1" >
17- < span className = "text-3xl" > { icon } </ span >
22+ < span className = "text-3xl" >
23+ { avatarUrl ? (
24+ < Image
25+ src = { avatarUrl }
26+ alt = "profile avatar"
27+ width = { 50 }
28+ height = { 50 }
29+ className = "h-full w-full object-cover"
30+ />
31+ ) : (
32+ < span className = "text-3xl" > { icon } </ span >
33+ ) }
34+ </ span >
1835 </ div >
1936
2037 < div >
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ export interface Profile {
77 email : string ;
88 streakDays : number ;
99 tilCount : number ;
10+ avatar_url : string ;
1011}
1112
1213// 1. 유저 프로필 정보 가져오기
Original file line number Diff line number Diff line change 11import type { NextConfig } from 'next' ;
22
33const nextConfig : NextConfig = {
4- /* config options here */
4+ images : { domains : [ 'avatars.githubusercontent.com' ] } ,
55} ;
66
77export default nextConfig ;
Original file line number Diff line number Diff line change @@ -35,20 +35,19 @@ export const signupWithGithub = async () => {
3535
3636 const info = getAdditionalUserInfo ( result ) ;
3737 const githubUsername = info ?. username ?? null ;
38-
38+ const avatar_url = info ?. profile ?. avatar_url ;
39+ console . log ( info ) ;
3940 const userRef = doc ( db , 'users' , user . uid ) ;
4041 const snap = await getDoc ( userRef ) ;
4142
4243 if ( ! snap . exists ( ) ) {
4344 await setDoc ( userRef , {
44- userId : user . uid ,
4545 nickname : user . displayName ?? githubUsername ?? '익명' ,
4646 email : user . email ?? '' ,
47- provider : 'github.com' ,
48- githubUsername,
4947 createdAt : serverTimestamp ( ) ,
5048 streakDays : 0 ,
5149 tilCount : 0 ,
50+ avatar_url : avatar_url ,
5251 } ) ;
5352 }
5453 return user ;
You can’t perform that action at this time.
0 commit comments