import { useNavigate } from "react-router-dom";
import { useAuth } from "../context/AuthContext";
import AdminPanel from "../components/AdminPanel";
import "./Pages.css";

export default function AdminPage() {
  const { user } = useAuth();
  const navigate = useNavigate();

  if (!user || user.role !== "admin") return null;

  return (
    <div className="page-container page-container-wide">
      <AdminPanel
        currentUser={user}
        onClose={() => navigate("/map")}
        mode="page"
      />
    </div>
  );
}
