import { UserRole } from "../../../core/constants/roles";
import { useAuth } from "../../../core/context/auth_context";
import "./assets/css/styles.css";

// SidebarHeader component displays the header of the sidebar based on the user's role.
export const SidebarHeader = () => {
  const { user } = useAuth(); // Get the current user from the auth context.
  
  if (!user) {
    return null; // If no user is logged in, return null.
  }

  return (
    <div className="sidebar_header">
      <div className="sidebar_header_content">
        <h2>
          {user.role === UserRole.SUPERADMIN ? "Superadmin" : "Admin"} Panel
          {/* Display "Superadmin Panel" if the user is a superadmin, otherwise display "Admin Panel". */}
        </h2>
      </div>
    </div>
  );
};
