Class: FlashcardApp

FlashcardApp() → {React.Component}

FlashcardApp - A functional React component for managing flashcards. It includes functionalities like adding, editing, deleting flashcards, flipping cards, filtering, and interacting with AI for flashcard generation.

Constructor

new FlashcardApp() → {React.Component}

Source:
Returns:
A component for flashcard management and interaction.
Type
React.Component

Methods

(static) callYourCloudFunctionToGenerateFlashcards(numFlashcards, topicName, imageFile) → {Array}

Calls a cloud function to generate flashcards using GPT and an image.
Parameters:
Name Type Description
numFlashcards number Number of flashcards to generate.
topicName string The topic for the flashcards.
imageFile string The image file in base64 format.
Source:
Returns:
An array of generated flashcards.
Type
Array

(static) confirmDelete()

Confirms the deletion of a selected flashcard.
Source:

(static) handleAIClick()

Opens the AI dialog for generating flashcards.
Source:

(static) handleAddFlashcard()

Handles the addition of a new flashcard.
Source:

(static) handleButtonClick(status)

Handles button clicks for changing the status of a flashcard.
Parameters:
Name Type Description
status string The status to be set for the selected card.
Source:

(static) handleCancelImage()

Cancels the selected image and resets the image state.
Source:

(static) handleCloseDialog()

Closes the AI dialog and resets related states.
Source:

(static) handleDeleteClick(card)

Opens the delete dialog and sets the selected card for deletion.
Parameters:
Name Type Description
card Object The card to be deleted.
Source:

(static) handleEditClick(card)

Opens the edit dialog and sets the selected card for editing.
Parameters:
Name Type Description
card Object The card to be edited.
Source:

(static) handleFilterChange(event)

Handles changes in the filter options.
Parameters:
Name Type Description
event Event The event object from the filter checkbox.
Source:

(static) handleGenerateFlashcards()

Generates flashcards using AI based on the provided description and image.
Source:

(static) handleImageUpload(event)

Handles the image upload event and sets the image for AI generation.
Parameters:
Name Type Description
event Event The event object from the file input.
Source:

(static) handleNextCard()

Navigates to the next flashcard.
Source:

(static) handlePrevCard()

Navigates to the previous flashcard.
Source:

(static) handleSendComment()

Handles the action of sending a comment.
Source:

(static) handleStatusChange(setId, flashcardId, newStatus)

Updates the status of a flashcard.
Parameters:
Name Type Description
setId string The ID of the flashcard set.
flashcardId string The ID of the flashcard.
newStatus string The new status to be set.
Source:

(static) handleUpdateFlashcard()

Updates the selected flashcard with new term and definition.
Source:

(static) parseGPTResponse(rawResponse) → {Array}

Parses the response from GPT into a usable format.
Parameters:
Name Type Description
rawResponse string The raw response string from GPT.
Source:
Returns:
An array of parsed flashcards.
Type
Array

(static) selectCard(card)

Selects a card for viewing or editing.
Parameters:
Name Type Description
card Object The card to be selected.
Source:

(static) toggleFlip()

Toggles the flip state of the flashcard, showing either term or definition.
Source:

(static) useEffect()

useEffect hook for fetching flashcards, comments, and user image when the component mounts.
Source: