Skip to content

feat: add export/import for study progress data#17

Open
fasuizu-br wants to merge 1 commit intosilvioprog:mainfrom
fasuizu-br:feat/export-import-studies
Open

feat: add export/import for study progress data#17
fasuizu-br wants to merge 1 commit intosilvioprog:mainfrom
fasuizu-br:feat/export-import-studies

Conversation

@fasuizu-br
Copy link
Copy Markdown

Summary

Closes #16

  • Add export/import feature for study progress and spaced repetition data
  • Export generates a versioned JSON backup file (englitune-backup-YYYY-MM-DD.json)
  • Import validates the file format, shows a confirmation dialog before replacing data
  • Toast notifications for success/error feedback

Changes

New files

  • src/lib/studyDataUtils.ts — Pure functions for serialize/deserialize/download/read
  • src/lib/studyDataUtils.test.ts — 12 tests (validation, round-trip, error cases)
  • src/components/Insights/DataActions.tsx — Export/Import buttons with confirmation dialog

Modified files

  • src/hooks/useStudiesStorage.ts — Added replace function for import
  • src/components/Insights/index.tsx — Thread onImport from storage hook
  • src/components/Insights/Tabs/index.tsx — Pass onImport prop
  • src/components/Insights/Tabs/Panels/index.tsx — Pass onImport prop
  • src/components/Insights/Tabs/Panels/Statistics.tsx — Render DataActions in stats tab

Test plan

  • All tests pass (npm test — 26 tests)
  • Build succeeds (npm run build)
  • Lint + Prettier pass (pre-commit hooks)
  • Manual: Export with study data → valid JSON downloaded
  • Manual: Import valid backup → confirmation dialog → data replaced
  • Manual: Import invalid file → error toast shown
  • Manual: Export with no data → error toast shown

Allow users to download their study data as a JSON file and import it
back, enabling backup and transfer between devices. Export serializes
all studies with version metadata; import validates and replaces current
data after user confirmation via dialog.
@fasuizu-br fasuizu-br force-pushed the feat/export-import-studies branch from 680557b to 6e6a10f Compare February 16, 2026 22:19
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.

Add export/import feature for study progress and spaced repetition data

1 participant