Skip to content

Commit

Permalink
refactor: use useSession and next Image
Browse files Browse the repository at this point in the history
  • Loading branch information
Pinx0 committed Nov 7, 2024
1 parent ed45938 commit 90d3ff0
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/components/UserInfo.js → src/components/UserInfo.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
'use client';

import Link from 'next/link';
import { LogIn } from 'lucide-react';
import { authService } from '@/lib/service';
import { useSession } from '@/context/SessionProvider';
import Image from 'next/image';

export default function UserProfile() {
const session = useSession();
const user = session.user;

export default function UserProfile({ user }) {
const handleLogout = async () => {
const response = await authService.signOut();
if (!response.error) {
Expand All @@ -25,7 +32,7 @@ export default function UserProfile({ user }) {
return (
<div className="flex items-center gap-4 px-2">
{user.user_metadata.avatar_url ? (
<img className="w-10 h-10 rounded-full" src={user.user_metadata.avatar_url} alt="Rounded avatar" />
<Image className="w-10 h-10 rounded-full" src={user.user_metadata.avatar_url} alt="Rounded avatar" />
) : (
<div className="relative w-10 h-10 overflow-hidden bg-gray-100 rounded-full dark:bg-gray-600">
<svg
Expand Down

0 comments on commit 90d3ff0

Please sign in to comment.