"use client" import { useState } from "react"; import { Button } from "@nextui-org/button"; import { Skeleton } from "@nextui-org/skeleton"; import { Tooltip } from "@nextui-org/tooltip"; import Link from "next/link"; import { HiChevronDown, HiIdentification, HiLogout, HiViewGridAdd, HiAdjustments, HiExclamation } from "react-icons/hi"; import Image from "next/image"; import { motion } from 'framer-motion'; import cn from "@/utils/cn"; import { BsDiscord } from "react-icons/bs"; const State = { Idle: 0, Loading: 1, Failure: 2 }; interface Props { state?: number; message?: string; className?: string; btnClassname?: string; user: User | null; } interface User { username: string; avatar: string; id: string; } export default function LoginButton({ state = State.Idle, message, className, btnClassname, user, }: Props) { const [menu, setMenu] = useState(false); function Icon() { if (state === State.Idle) return ; if (state === State.Failure) return ; return null; } if (user) { const UserButton = ( ); const UserDropdown = ( ); return (
{UserButton} {menu && (
{UserDropdown}
)}
); } return (
); }