import { useRouter } from "next/router"; import { useEffect, useState } from "react"; import { getExos, getTags } from "../../requests/requests.exos.js"; import { createParcours } from "../../requests/requests.room.js"; import { isBrowser } from "../../utils/utils.js"; import Layout from "../Layout.js"; import SelectExo from "../pdf_gen/selectExo.jsx"; import styles from "../../styles/room/createParcours.module.scss"; import Input from "../Input.jsx"; import { IoMdArrowRoundBack } from "react-icons/io"; import Link from "next/link"; import Back from "./back.jsx"; export default function CreateParcours({ roomCode, user }) { const [empty, setEmpty] = useState(false); const [exosList, setExos] = useState([]); const router = useRouter(); const [tags, setTags] = useState(); const[errors, setErrors] = useState({}) useEffect(() => { if (!user.owner) { router.push("/room/" + roomCode, undefined, { shallow: true, }); } }, []); const [options, setOptions] = useState({ name: "", timer: 10, success_condition: 10, }); return ( <> {exosList && (

Nouveau parcours

{ setOptions({ ...options, name: e.target.value }); }} /> {errors.name && errors.name.map((e) => { return

{e}

; })} { setOptions({ ...options, timer: parseInt(e.target.value) }); }} /> {errors.timer && errors.timer.map((e) => { return

{e}

; })} { setOptions({ ...options, success_condition: parseInt(e.target.value), }); }} /> {errors.success_condition && errors.success_condition.map((e) => { return

{e}

; })}
)}
); }