Skip to content

Commit a0ecaa5

Browse files
committed
fixed generating flashcard blank screen bug
1 parent c5deea1 commit a0ecaa5

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

src/pages/FlashcardsViewer.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,9 @@ function FlashcardsViewer() {
148148
<button
149149
onClick={() => handleGenerateFlashcards()}
150150
disabled={
151-
!note.content.trim() ||
151+
!note?.content.trim() ||
152152
isGenerating ||
153-
note.content.trim().split(/\s+/).length < 70
153+
note?.content.trim().split(/\s+/).length < 70
154154
}
155155
className="group btn-primary btn-icon whitespace-nowrap"
156156
>
@@ -162,7 +162,7 @@ function FlashcardsViewer() {
162162
<span>Regenerate Flashcards</span>
163163

164164
{/* Tooltip inside the button */}
165-
{!isGenerating && note.content.trim().split(/\s+/).length < 70 && (
165+
{!isGenerating && note?.content.trim().split(/\s+/).length < 70 && (
166166
<div className="absolute left-1/2 -top-10 transform -translate-x-1/2 bg-black text-white text-xs rounded py-1 px-2 opacity-0 group-hover:opacity-100 transition-opacity whitespace-nowrap pointer-events-none">
167167
Requires at least 70 words
168168
</div>

src/pages/NotesPage.jsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,9 @@ function NotesPage() {
206206

207207
// if (userData.usagesLeft <= 0 && nextReset - new Date() >= 0) {
208208
toast.success(
209-
`Summary generated! ${userData.usagesLeft - 1} credits remaining.`
209+
`Summary generated! ${
210+
userData.usagesLeft == -1 ? "4" : userData.usagesLeft - 1
211+
} credits remaining.`
210212
);
211213
} catch (error) {
212214
// no more usages left

0 commit comments

Comments
 (0)