# Release Notes - BetterLearn v2.3.0

This release introduces the **Interactive AI Flashcards Generator** with a built-in **Leitner Spaced Repetition** study algorithm, bringing structured active recall capabilities to the platform.

---

## 🎴 Feature Highlights

### 1. AI-Powered Generation
- Users can create customized flashcard decks from any topic or pasted text.
- Supports difficulty settings (Easy, Medium, Hard) and deck sizes ranging from 5 to 30 cards.
- Powered by Google Gemini (`gemini-2.0-flash`) for fast and structured card generation.

### 2. Active Recall & Leitner Spaced Repetition System
- **Browse Mode**: View all deck cards in a list, with quick box status indicators.
- **Study Mode**: Interactive study sessions featuring a 3D card-flipping animation using `framer-motion`.
- **Spaced Repetition**: Rating buttons (Hard, Medium, Easy) reschedule cards based on the Leitner algorithm:
  - 🔴 **Hard**: Returns card to Box 1 (due immediately).
  - 🟡 **Medium**: Keeps card in the current Box.
  - 🟢 **Easy**: Promotes card to next Box (extends next review interval by up to 14 days).

### 3. Credit Integration
- Deducts 1 credit per flashcard deck generated, integrated seamlessly with the platform's credit checks.

---

## 📂 File Changes

### New Files
- `lib/models/FlashcardDeck.ts` — MongoDB Schema for flashcard decks & Leitner states
- `lib/flashcard-generator.ts` — Gemini AI flashcard generation module
- `app/api/flashcards/generate/route.ts` — API route to generate cards & deduct credits
- `app/api/flashcards/route.ts` — API route to list all user decks & calculate due cards count
- `app/api/flashcards/[deckId]/route.ts` — API route for deck CRUD operations (GET/PUT/DELETE)
- `app/api/flashcards/[deckId]/study/route.ts` — API route to save Leitner study progress
- `app/(preview)/dashboard/flashcards/page.tsx` — Decks library dashboard UI
- `app/(preview)/dashboard/flashcards/generate/page.tsx` — Generation form UI
- `app/(preview)/dashboard/flashcards/[deckId]/page.tsx` — Interactive study UI with 3D flip card
- `app/api/admin/flashcards/route.ts` — API route for admin flashcard decks listing
- `app/api/admin/flashcards/[deckId]/route.ts` — API route for admin flashcard deck deletion
- `app/admin/flashcards/page.tsx` — Admin panel interface for flashcard decks list and deletion

### Modified Files
- `components/features/dashboard/dashboard-sidebar.tsx` — Added top-level Flashcards navigation item
- `components/common/mobile-dock.tsx` — Added mobile active route tracking for `/dashboard/flashcards`
- `components/admin/admin-sidebar.tsx` — Added submenu link under the Quiz section

---

## ⚙️ Upgrade & Setup Instructions

### Database Update
The new MongoDB collection `flashcard_decks` will be automatically initialized on the first user interaction. No manual migrations are required.

### Environment Setup
Ensure your `.env` contains a valid Google Gemini API key:
```env
GOOGLE_GENERATIVE_AI_API_KEY=your_gemini_api_key
```

### Installation
If not already installed, verify that `framer-motion` is available:
```bash
npm install
```
