Constructor
new QuizComponent() → {React.Component}
- Source:
Returns:
A component for managing quizzes.
- Type
- React.Component
Methods
(static) callYourCloudFunctionToGenerateQuestions(numQuestions, topicName, difficulty, definition) → {Promise.<Array>}
Calls a cloud function to generate quiz questions using AI, based on user inputs.
Parameters:
Name | Type | Description |
---|---|---|
numQuestions |
number | The number of questions to generate. |
topicName |
string | The topic name for the quiz questions. |
difficulty |
string | The difficulty level for the quiz questions. |
definition |
string | The definition to be used for generating questions. |
- Source:
Returns:
A promise that resolves to an array of generated questions.
- Type
- Promise.<Array>
(static) confirmDelete()
Deletes a quiz question from the database and updates the state.
- Source:
(static) confirmResumeQuiz()
Resumes the quiz after confirmation and navigates to the quiz page.
- Source:
(static) getFlashcardsData()
Generates quiz questions based on flashcard data and adds them to the database.
- Source:
(static) handleAddQuestion()
Adds a new quiz question to the database and updates the state.
- Source:
(static) handleCancelImage()
Cancels the selected image upload and resets related states.
- Source:
(static) handleChoiceChange(value, index)
Updates the choice text in a specific index of the choices array.
Parameters:
Name | Type | Description |
---|---|---|
value |
string | The updated text of the choice. |
index |
number | The index of the choice in the choices array. |
- Source:
(static) handleCorrectChoiceChange(e)
Sets the index of the correct choice based on the user's selection.
Parameters:
Name | Type | Description |
---|---|---|
e |
Event | The event object, containing the selected choice index. |
- Source:
(static) handleDeleteQuestion()
Sets up the deletion of a quiz question by opening a confirmation dialog.
- Source:
(static) handleGenerateAIQuestion()
Handles the generation of quiz questions using AI based on user inputs and updates the state.
- Source:
(static) handleImageUpload(event)
Handles the image upload for question generation and sets the image state.
Parameters:
Name | Type | Description |
---|---|---|
event |
Event | The event object associated with the image upload. |
- Source:
(static) handleNextCard()
Navigates to the next question in the quiz for review.
- Source:
(static) handleOpenGenerateAI()
Opens the dialog for generating quiz questions using AI and sets initial states.
- Source:
(static) handleResumeQuiz()
Opens a dialog to confirm resuming a paused quiz.
- Source:
(static) handleShowQuestion()
Navigates to the previous question in the quiz for review.
- Source:
(static) handleUpdateQuestion()
Updates the details of an existing quiz question in the database and refreshes the component's state.
- Source:
(static) parseGPTResponse(rawResponse) → {Array}
Parses the raw response from the GPT API to extract quiz questions.
Parameters:
Name | Type | Description |
---|---|---|
rawResponse |
string | The raw response string from the GPT API. |
- Source:
Returns:
An array of parsed questions.
- Type
- Array
(static) renderOptions() → {React.Component}
Renders options for AI or Flashcard-based quiz question generation based on the selected tab.
- Source:
Returns:
The rendered component for the selected tab.
- Type
- React.Component
(static) resetEditDialog()
Resets the state values related to the edit dialog.
- Source:
(static) startQuiz()
Navigates to the quiz page to start the quiz and clears any saved quiz progress.
- Source: