Files
soroban-abacus-flashcards/apps/web
Thomas Hallock 2a7d67db58 feat: implement lazy loading for worksheet preview with cursor pagination
Add efficient lazy loading for large worksheets with animated page indicators:

**Lazy Loading & Pagination**
- Implement range-based and cursor-based pagination in API
- Only generate SVG for visible pages (3 initially, more on scroll)
- Use IntersectionObserver to detect when pages enter viewport
- Fetch pages in batches as user scrolls through worksheet
- Support up to 2000 problems (100 pages × 20 problems/page)

**API Changes**
- Update /api/create/worksheets/preview to accept pagination params
- Support cursor-based: ?cursor=3&limit=5 (GraphQL style)
- Support range-based: ?startPage=3&endPage=7 (traditional)
- Return metadata: totalPages, startPage, endPage, nextCursor

**Generation Logic**
- Modified generateWorksheetPreview() to accept startPage/endPage
- Generate all problems deterministically (required for seed)
- Generate all Typst sources (lightweight)
- Only compile requested page range to SVG (expensive)

**UI Improvements**
- Add page count options: 1, 2, 3, 4, 10, 25, 50, 100 pages
- Show loading spinner () while fetching pages
- Add NumberFlow for smooth animated page number transitions
- Fix page indicator flickering with hysteresis (0.6 threshold)

**Performance**
- 100-page worksheet: ~30s load → ~1s initial + lazy loading
- Only generates 3 pages initially instead of all 100
- Smooth scrolling with preloaded adjacent pages

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-11 18:21:51 -06:00
..
2025-11-11 11:44:40 -06:00
2025-11-11 11:44:40 -06:00

Test deployment - Mon Nov 3 16:31:57 CST 2025