|
|
@@ -1,11 +1,28 @@ |
|
|
|
import React, { useState } from "react"; |
|
|
|
import React, { useEffect, useState } from "react"; |
|
|
|
import styles from './Revise.module.scss'; |
|
|
|
|
|
|
|
import { Question } from "./question/Question"; |
|
|
|
import { Summary } from "./summary/Summary"; |
|
|
|
import { recollectionQuestions } from "../../services/recollectionquestions"; |
|
|
|
import { MongoShelfWord } from "../../shared/models/shelf"; |
|
|
|
|
|
|
|
|
|
|
|
interface WordWithShelfId extends MongoShelfWord { |
|
|
|
shelfId: string |
|
|
|
} |
|
|
|
|
|
|
|
export const Revise: React.FC = () => { |
|
|
|
const [progressState, setProgressState] = useState<'INTRO' | 'QUESTION' | 'END'>('QUESTION'); |
|
|
|
const [questions, setQuestions] = useState<Array<WordWithShelfId>>([]); |
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
recollectionQuestions().then((response: any) => { |
|
|
|
setQuestions(response.data); |
|
|
|
}, (e) => { |
|
|
|
window.alert("Failed to get questions"); |
|
|
|
console.log(e); |
|
|
|
}); |
|
|
|
}) |
|
|
|
|
|
|
|
return <section className={styles.revisePage}> |
|
|
|
{ progressState === 'QUESTION' && <div> |
|
|
|