diff --git a/src/client/src/core/Menu.jsx b/src/client/src/core/Menu.jsx index 28aec107a06bcc3ce9d5b9c1c681ea761783eff6..4fb9aad1cf5175ec7d1d3c3ef3ad758bf5b45eb9 100644 --- a/src/client/src/core/Menu.jsx +++ b/src/client/src/core/Menu.jsx @@ -14,7 +14,9 @@ function Menu() { return ( - + + KU-Quiz + diff --git a/src/client/src/quiz/Problems.jsx b/src/client/src/quiz/Problems.jsx index 1b177bee7aa615077faef4df464a4070004f22ce..d3436a69c106285f3c64c0a2935b3a9eb7ad1746 100644 --- a/src/client/src/quiz/Problems.jsx +++ b/src/client/src/quiz/Problems.jsx @@ -1,138 +1,18 @@ -// import React, { useState, useEffect } from 'react' -// import { Link, Redirect } from 'react-router-dom'; -// import Timer from 'react-compound-timer'; // 타이머쓰기위해 import - -// function Problems() { - -// let Time = 0 -// if (JSON.parse(localStorage.getItem("Set")) === null) { -// Time = 30010 -// } -// else { -// Time = Number(JSON.parse(localStorage.getItem("Set"))[0].Time) -// } - - -// const [question, setQuestion] = useState({ -// ...localQnA[0] -// }) -// const [selected, setSelected] = useState("") //선택한 답을 보여줄 것 - -// const [timeout, settimeout] = useState(false) -// //for each 사용하기 -// let Solutions = [] //빈 배열 -// console.log(localQnA) - -// localQnA.forEach((element) => { -// Solutions.push(Number(element.A)) -// }); -// useEffect(() => { -// for (let i = 1; i <= Solutions.length; i++) { -// Answers.push(0) -// localStorage.setItem('Answers', JSON.stringify(Answers)) -// localStorage.setItem("Solutions", JSON.stringify(Solutions)) -// } -// // eslint-disable-next-line -// }, []) - - - -// function handleQuestion() { -// setQuestion({ ...localQnA[question.N] }) -// setSelected("") //페이지 넘어가면 selected 초기화 -// } - -// let handleChange = (ev) => { -// setSelected(ev.target.value) //selected값 변경 -// Answers[question.N - 1] = Number(ev.target.id) + 1 -// localStorage.setItem('Answers', JSON.stringify(Answers)) -// } -// return ( -// <> -//
-//
해석학 2 (이연주 교수)
-//
- -//
-//
문제 진척도 {question.N}/{localQnA.length}
-// -// alert('시간이 초과되었습니다.'), -// }, -// { -// time: 0, -// callback: () => settimeout(true), - -// } -// ]} -// > -// {() => ( -// <> -// : / 30 : 00 -// )} -// {/* npm i react-compound-timer */} -// -// {(question.N - 1 === localQnA.length - 1) -// ? -// -// -// : -// } -// - - -//
-// Quiz{question.N}.{question.Q} -//
-//
-//
-// {question.Choose.map((a, index) => -//
-// -// -//
-// )} -//
-// Your Answer : -// {selected} {/* 선택한 값 보여줌 */} - -//
- -//
-//
-//
-//
-//
-// {timeout ? : ''} -// -// ) - - -// // return ( -// //
-// // ) -// } - - -// export default Problems - - import React, { useEffect, useState } from "react"; -import { Link, useParams } from 'react-router-dom'; +import { Link, useParams, Redirect } from 'react-router-dom'; import Card from "react-bootstrap/Card"; import Button from "react-bootstrap/Button"; import { listByUserId } from "./api-quiz"; import authHelpers from "../auth/auth-helpers"; +import Timer from 'react-compound-timer'; function Problems({ problem, number, onUpdate, onRemove }) { + let Time = 0 + + const [timeout, settimeout] = useState(false) const { userId } = useParams(); - const [quizzes, setQuizzes] = useState([]); + const [quizzes, setQuizzes] = useState([{title : ""}]); const jwt = authHelpers.isAuthenticated(); @@ -144,7 +24,7 @@ function Problems({ problem, number, onUpdate, onRemove }) { if (data.error) { console.log(data.error); } else { - // console.log(data); + console.log(data); setQuizzes(data); } }); @@ -155,7 +35,69 @@ function Problems({ problem, number, onUpdate, onRemove }) { }, [userId]); return ( -
{console.log(quizzes)})
+ <> +
+ {console.log("quizzes=", quizzes[0])} +
+
{quizzes}
+
+ +
+
문제 진척도
+ + alert('시간이 초과되었습니다.'), + }, + { + time: 0, + callback: () => settimeout(true), + + } + ]} + > + {() => ( + <> + : / 30 : 00 + )} + {/* npm i react-compound-timer */} + + 버튼자리 + {/* {(question.N - 1 === localQnA.length - 1) + ? + + + : } */} + + + +
+ Quiz +
+
+
+ 보기자리 + {/* {question.Choose.map((a, index) => +
+ + +
+ )} */} +
+ Your Answer : + selected
+
+
+
+
+
+ {timeout ? : ''} +
+ //
// {quizzes.map((quiz, i) => {