import * as React from 'react';
import { Remove as RemoveIcon, Add as AddIcon } from '@mui/icons-material';
import {
Card,CardContent,Avatar,Checkbox,List,Tooltip,Fade,
ListItem,ListItemButton,ListItemIcon,ListItemText,
Box,LinearProgress,
} from '@mui/material'
import { deepPurple } from '@mui/material/colors';
import { useDispatch, useSelector } from 'react-redux';
import { setResponse } from '../../../Slices/cleaverSlice';
function LinearProgressWithLabel(props) {
return (
);
}
function CheckboxexHeader(prop) {
return (
{prop.group}
);
}
function CheckboxesGroup(props) {
let { quiz, id : index } = props;
let resp = useSelector((state) => state.cleaver.responses)
const [checkA, setCheckA] = React.useState(resp[index]? resp[index].A : 0);
const [checkB, setCheckB] = React.useState(resp[index]? resp[index].B : 0);
const dispatch = useDispatch()
const changeA = (event) => {
let { id, checked } = event.target
if(parseInt( checkB ) !== parseInt(id) && checked ){
setCheckA(parseInt( id ))
let temp = {
[index]: {
A:id,
B: resp[index] ? resp[index].B : 0
}
}
dispatch(setResponse(temp))
}
};
const changeB = (event) => {
let { id, checked } = event.target
if(parseInt( checkA ) !== parseInt( id ) && checked){
setCheckB(parseInt( id ))
let temp = {
[index]: {
B:id,
A: resp[index] ? resp[index].A : 0
}
}
dispatch(setResponse(temp))
}
};
return (
{quiz.map((value) => {
const labelId = `checkbox-list-label-${value.id}`;
return (
);
})}
);
}
export function Question({quiz, index, current, progress}) {
let { instrucciondepregunta, respuestas,id } = quiz
let checked = index === current;
return (
);
}