"use client";

import { IoPersonOutline } from "react-icons/io5";
import { IconButtonLink } from "@/components/IconButton";
import { useAuth } from "./AuthContext";

export function AccountButton() {
  const { isAuthenticated, isLoading } = useAuth();

  if (isLoading) return null;

  const href = isAuthenticated ? "/account" : "/account/login";

  return (
    <IconButtonLink href={href} aria-label="My account">
      <IoPersonOutline />
    </IconButtonLink>
  );
}
