import { QuizzWithId } from "@rahoot/common/types/game" import Button from "@rahoot/web/components/Button" import clsx from "clsx" import { useState } from "react" import toast from "react-hot-toast" type Props = { quizzList: QuizzWithId[] onSelect: (_id: string) => void onManage?: () => void onMedia?: () => void } const SelectQuizz = ({ quizzList, onSelect, onManage, onMedia }: Props) => { const [selected, setSelected] = useState(null) const handleSelect = (id: string) => () => { if (selected === id) { setSelected(null) } else { setSelected(id) } } const handleSubmit = () => { if (!selected) { toast.error("Please select a quizz") return } onSelect(selected) } return (

Select a quizz

{onMedia && ( )} {onManage && ( )}
{quizzList.map((quizz) => ( ))}
) } export default SelectQuizz