aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections/FlashcardPracticeUI.tsx
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2024-10-08 23:43:43 -0400
committerbobzel <zzzman@gmail.com>2024-10-08 23:43:43 -0400
commitc97d849a56d4642d9eb750beccb748b7d8ac15bd (patch)
tree6c154ba800f355df30d4590f727023927533eaab /src/client/views/collections/FlashcardPracticeUI.tsx
parentca67414c9da685070c1143ce3b771edda2fdc191 (diff)
extended flashcard UI to cardDecks
Diffstat (limited to 'src/client/views/collections/FlashcardPracticeUI.tsx')
-rw-r--r--src/client/views/collections/FlashcardPracticeUI.tsx8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/client/views/collections/FlashcardPracticeUI.tsx b/src/client/views/collections/FlashcardPracticeUI.tsx
index 032a405bf..072a2edef 100644
--- a/src/client/views/collections/FlashcardPracticeUI.tsx
+++ b/src/client/views/collections/FlashcardPracticeUI.tsx
@@ -25,7 +25,7 @@ interface PracticeUIProps {
layoutDoc: Doc;
carouselItems: () => Doc[];
childDocs: Doc[];
- curDoc: () => Doc;
+ curDoc: () => Doc | undefined;
advance: (correct: boolean) => void;
renderDepth: number;
sideBtnWidth: number;
@@ -100,8 +100,8 @@ export class FlashcardPracticeUI extends ObservableReactComponent<PracticeUIProp
this._props.advance?.(val === practiceVal.CORRECT);
};
- return this.practiceMode == practiceMode.PRACTICE ? (
- <div style={{ transform: `scale(${this._props.uiBtnScaleTransform})`, bottom: `${this._props.practiceBtnOffset ?? this._props.sideBtnWidth}px`, height: `${this._props.sideBtnWidth}px`, position: 'absolute', width: `100%` }}>
+ return this.practiceMode == practiceMode.PRACTICE && this._props.curDoc() ? (
+ <div className="FlashcardPracticeUI-practice" style={{ transform: `scale(${this._props.uiBtnScaleTransform})`, bottom: `${this._props.practiceBtnOffset ?? this._props.sideBtnWidth}px`, height: `${this._props.sideBtnWidth}px` }}>
<Tooltip title="Incorrect. View again later.">
<div key="remove" className="FlashcardPracticeUI-remove" onClick={e => setPracticeVal(e, practiceVal.MISSED)}>
<FontAwesomeIcon icon="xmark" color="red" size="1x" />
@@ -119,7 +119,7 @@ export class FlashcardPracticeUI extends ObservableReactComponent<PracticeUIProp
const setColor = (mode: practiceMode) => (StrCast(this.practiceMode) === mode ? 'white' : 'light gray');
const togglePracticeMode = (mode: practiceMode) => this.setPracticeMode(mode === this.practiceMode ? undefined : mode);
- return !this._props.curDoc()?._layout_isFlashcard ? null : (
+ return !this._props.childDocs.some(doc => doc._layout_isFlashcard) ? null : (
<div
className="FlashcardPracticeUI-practiceModes"
style={{