import { useContext } from "react";
import styles from "./AdminPage.module.css";
import IncompleteEvents from "./components/IncompleteEvent/IncompleteEvent";
import PendingMembers from "./components/PendingMembers/PendingMembers";
import { AuthContext } from "../../contexts/Auth/AuthContext";
import { useNavigate } from "react-router";
import RegisterMember from "./components/RegisterMember/RegisterMember";


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;
