import { useContext } from "react";
import styles from "./AdminPage.module.css";
import IncompleteEvents from "./components/IncompleteEvent/IncompleteEvent.jsx";
import PendingMembers from "./components/pendingMembers/PendingMembers.jsx";
import { AuthContext } from "../../contexts/auth/AuthContext.js";
import { useNavigate } from "react-router";
import RegisterMember from "./components/registerMember/registerMember.tsx";


function AdminPage() {

    const { user } = useContext(AuthContext);
    const navigate = useNavigate();

    if(!user.isAdmin) navigate("/");

    return (
        <div className={styles.container}>
            <RegisterMember />
            <div className={styles.rightSection}>
                <IncompleteEvents />
                <PendingMembers />
            </div>
        </div>
    );
}

export default AdminPage;
