@@ -13,27 +13,30 @@ import {
13
13
DropdownMenuTrigger ,
14
14
} from "@/components/ui/dropdown-menu" ;
15
15
import { signOut } from "next-auth/react" ;
16
+ import { useSession } from "next-auth/react" ;
16
17
17
18
export function UserDropdown ( ) {
19
+ const { data } = useSession ( ) ;
20
+ const name = data ?. user . name ;
21
+ const email = data ?. user . email ;
22
+ const image = data ?. user . image ;
23
+
18
24
return (
19
25
< DropdownMenu >
20
26
< DropdownMenuTrigger asChild >
21
27
< Button variant = "ghost" className = "relative h-8 w-8 rounded-full" >
22
28
< Avatar className = "h-9 w-9" >
23
- < AvatarImage
24
- src = "https://randomuser.me/api/portraits/women/0.jpg"
25
- alt = "avatar"
26
- />
29
+ < AvatarImage src = { image ?? "" } alt = "avatar" />
27
30
< AvatarFallback > SC</ AvatarFallback >
28
31
</ Avatar >
29
32
</ Button >
30
33
</ DropdownMenuTrigger >
31
34
< DropdownMenuContent className = "w-56" align = "end" forceMount >
32
35
< DropdownMenuLabel className = "font-normal" >
33
36
< div className = "flex flex-col space-y-1" >
34
- < p className = "text-sm font-medium leading-none" > shadcn </ p >
37
+ < p className = "text-sm font-medium leading-none" > { name } </ p >
35
38
< p className = "text-xs leading-none text-muted-foreground" >
36
- m@example.com
39
+ { email }
37
40
</ p >
38
41
</ div >
39
42
</ DropdownMenuLabel >
@@ -51,7 +54,6 @@ export function UserDropdown() {
51
54
Settings
52
55
< DropdownMenuShortcut > ⌘S</ DropdownMenuShortcut >
53
56
</ DropdownMenuItem >
54
- < DropdownMenuItem > New Team</ DropdownMenuItem >
55
57
</ DropdownMenuGroup >
56
58
< DropdownMenuSeparator />
57
59
< DropdownMenuItem
0 commit comments