Skip to content

widget flash card refactor new translation shape l3 fill in cloze with recognition fallback navid shad #86exnxngv#39

Merged
navidshad merged 5 commits into
devfrom
CU-86exnxngv_WidgetFlashCard-refactor-new-translation-shape-L3-fill-in-cloze-with-recognition-fallback_Navid-Shad
May 24, 2026
Merged

widget flash card refactor new translation shape l3 fill in cloze with recognition fallback navid shad #86exnxngv#39
navidshad merged 5 commits into
devfrom
CU-86exnxngv_WidgetFlashCard-refactor-new-translation-shape-L3-fill-in-cloze-with-recognition-fallback_Navid-Shad

Conversation

@navidshad
Copy link
Copy Markdown
Contributor

@navidshad navidshad commented May 24, 2026

🏷️ PR Title: feat(flashcard): modularize card modes, unify flip toggle, and add new translation shape with L3+ fill-in cloze

📋 Summary

This PR introduces several improvements to the flashcard component, including modularization of card modes, a unified flip toggle mechanism, and a new translation shape supporting level 3 and above fill-in cloze interactions. It also refactors the dispatcher to use the :phrase API and extracts card components for better maintainability. Additionally, comprehensive unit tests for cloze logic and card components have been added. Documentation is updated to include semver commit title conventions.

🔗 Related Tasks

  • c316885 - Add semver commit-title convention to CLAUDE.md
  • c0bb1e0 - Unit tests for cloze logic and card components
  • 5b6202e - Refactor dispatcher with :phrase API and extract cards
  • 4249a0c - Modularize card modes and unify flip toggle
  • 62613d4 - New translation shape and L3+ fill-in cloze

📝 Additional Details

These changes improve code modularity and test coverage, enabling easier future enhancements and better user interaction with flashcards. The new translation shape enhances learning flexibility, particularly for advanced cloze exercises.

📜 Commit List

  • c316885 docs(commits): add semver commit-title convention to CLAUDE.md
  • c0bb1e0 test(flashcard): unit tests for cloze logic + card components
  • 5b6202e refactor(flashcard): dispatcher with :phrase API + extracted cards
  • 4249a0c feat(flashcard): modularize card modes + unified flip toggle
  • 62613d4 feat(flashcard): new translation shape + L3+ fill-in cloze

navidshad and others added 5 commits May 24, 2026 18:56
Read the new chunk-aware translation shape and add a fill-in-the-blank
review card at Leitner level 3+, with recognition fallback.

- Stop reading linguistic_data.examples[] / phonetic.ipa (gone after the
  save-schema overhaul); show phrase.translation plus per-chunk
  definitions on the card back, matching what the save modal displays.
  Same fix applied to the bundle PhraseCard list.
- L3+ cloze: blank every confirmed chunk found in the source sentence;
  per-blank Check with green/red feedback, repeatable Recheck, and a
  Clear-wrong action to retry. Falls back to the recognition card when
  there is no chunk or the level is 1-2.
- Wire chunks / Leitner level / source sentence through the review
  session; read boxLevel from the Mongoose _doc fallback and pick chunks
  that actually appear in the sentence.
- Stable layout: fixed card height with internal scroll, and the cloze
  front is split into a flex-grow content area + a fixed-height action
  area so checking never shifts the sentence.
- Expose the Chunk type to the frontend.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Refactor the monolithic flashcard into composables + per-mode pieces and
give every card type one consistent flip control.

- Extract useCardFlip (flip state + reset) and useClozeBlanks (pure
  buildClozeData + reactive cloze state: answers, snapshot check results,
  check/clear) into composables.
- Move the L3+ cloze UI into widget/flashcard/ClozeCard.vue; FlashCard now
  just resolves the mode and renders the right piece.
- Add widget/flashcard/FlashcardFlipToggle.vue: a single Question/Answer
  toggle shown on every card type that indicates the current side and is
  the one consistent way to flip (plus Space). Drops the inconsistent
  body-click-to-flip (recognition flipped on any tap, cloze front didn't).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Finish the modularization: FlashCard becomes a thin dispatcher and the
recognition presentation moves out, so each mode is its own piece.

- Extract widget/flashcard/RecognitionCard.vue (normal + linguistic).
- FlashCard now derives front/back/context/chunks/etc. from a single
  :phrase prop (+ :leitner-level), resolves cloze-vs-recognition, and
  renders the right child under the shared flip toggle. Drops the dead
  unknown-type fallback branch.
- Collapse callers: LeitnerReviewSession and flashcards-[id] go from three
  per-type <WidgetFlashCard> blocks to one `:phrase`/`:leitner-level`,
  removing the cardChunk/cardSentence/isNormalType/isLinguisticType
  plumbing.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- buildClozeData: empty/no-chunk/no-match cases, single + multi blank,
  overlap handling, case-insensitive matching.
- FlashcardFlipToggle, RecognitionCard, ClozeCard, and the FlashCard
  dispatcher (cloze vs recognition selection, no-match fallback).

Per-file `vi.mock('vue', actual)` restores real Vue reactivity, which the
global test setup otherwise stubs out.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Document the Conventional Commits -> semver bump mapping so commit and PR
titles move the intended version part. Mirrors the convention already
enforced by semantic-release in the sibling subturtle-extension-apps repo.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@navidshad
Copy link
Copy Markdown
Contributor Author

@navidshad navidshad changed the title Cu 86exnxngv widget flash card refactor new translation shape l3 fill in cloze with recognition fallback navid shad widget flash card refactor new translation shape l3 fill in cloze with recognition fallback navid shad #86exnxngv May 24, 2026
@navidshad navidshad merged commit b82076d into dev May 24, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant