import { Button } from "@/components/ui/button";
import {
  SidebarMenu,
  SidebarMenuButton,
  SidebarMenuItem,
} from "@/components/ui/sidebar";
import { hasPermission, Role } from "@/lib/validation/permissions";
import Link from "next/link";
import React from "react";

function NavTeamSection({ userRole }: { userRole: UserRole }) {
  const isAdmin = hasPermission(userRole, Role.ADMIN);

  return (
    <>
      {isAdmin && (
        <SidebarMenu>
          <SidebarMenuItem>
            <SidebarMenuButton asChild>
              <Button
                asChild
                className="hover:bg-primary hover:text-primary-foreground"
              >
                <Link href={"/admin"}>Admin Dashboard</Link>
              </Button>
            </SidebarMenuButton>
          </SidebarMenuItem>
        </SidebarMenu>
      )}
    </>
  );
}

export default NavTeamSection;
