Conversation
- Add FL wedge count display in user stats bar - Implement wedge purchase API endpoint (/api/use-wedge) - Add clickable wedge toggle icons for single mode downloads - Add independent wedge toggles for dual mode (audiobook + book) - Update download API to support useWedge parameter - Abort download if wedge purchase fails - Auto-refresh stats after wedge usage - Add utility functions for torrent ID extraction - Refactor search result titles to be clickable links - Remove separate 'View' button for cleaner UI Closes #21
…olt icon - Create reusable WedgeToggleButton component - Support small (icon-only) and large (icon+label) sizes - Replace medal icon with lightning bolt for better symbolism - Update tooltip to 'Use Freeleech Wedge' for clarity - Add cursor-pointer and amber-400 active color - Reduce code duplication across single and dual modes
- Create MobileBottomSheet component combining progress and download - Use single fixed container to avoid stacking conflicts - Separate wedge selector into its own panel (matches progress style) - Remove DualDownloadButton from mobile flow - Elements stack naturally with proper spacing - Progress shows during steps 1-2, wedges show when both selected - Cleaner mobile UX with consistent panel styling
Replace horizontal layout with 2x2 grid featuring a vertical divider down the center, improving visual separation between upload/ratio stats and download/FL wedge stats on mobile devices
Blur the search input field when the form is submitted to automatically dismiss the mobile keyboard, improving the mobile user experience by clearing screen space for search results
When search results load in dual mode on mobile, automatically scroll to the books section so users can immediately see results without manual scrolling. Also scroll to audiobooks section when a book is selected to maintain the two-step flow
…eet overlap Increase bottom padding from pb-32 to pb-40 to ensure both selected items are fully visible above the mobile bottom sheet
Add a subtle gray external link icon next to torrent titles to make it more clear that they are clickable links that open in a new tab
Move author and VIP badge inside the link to increase clickable area. Move external link icon to end of line and adjust spacing for better visual balance
- Add freeleech indicator using MAM's official freedownload.gif - Move VIP badge before title (previously after) - Download and use local badge assets instead of remote URLs - Parse 'free' field from MAM API response - Display order: [VIP] [Freeleech] Title - Update PropTypes and test fixtures
- Don't show wedge toggle in single mode if torrent is freeleech - Hide wedge toggles in dual mode for freeleech items - Hide entire wedge panel if both selected items are freeleech - Pass selected items to MobileBottomSheet to check freeleech status - Prevents wasting FL wedges on already-freeleech torrents
- Remove anchor tag wrapping entire title/author line - Make only the external link icon clickable for MAM link - Add stopPropagation to prevent conflicts with selectable items - Improves dual-fetch UX: easier to select items without accidentally clicking link - Especially helpful on mobile where title line was hard to tap
- Install @vitest/coverage-v8 for code coverage reporting - Configure coverage thresholds (60% for lines, functions, branches, statements) - Exclude UI components and focus on API routes and utilities - Generate HTML, LCOV, JSON, and text coverage reports - Current coverage: 63% overall, 87% for src/lib utilities - Add npm run test:coverage command
- Set "type": "module" in package.json - Eliminates MODULE_TYPELESS_PACKAGE_JSON warning - Improves performance by avoiding CommonJS reparsing
- Change test command to test:coverage to generate coverage reports - Explicitly specify lcov.info file for Codecov upload - Use fail_ci_if_error instead of continue-on-error for clarity - Now actually generates coverage data for Codecov badge
- Change test command to test:coverage to generate coverage reports - Explicitly specify lcov.info file for Codecov upload - Ensures coverage reports are uploaded on main branch pushes - Consistent with PR checks workflow
- Reorder mobile layout: FL wedge (left) | ratio (center) | download (right) - Use justify-between to spread elements across full width on mobile - Center ratio text with flex-1 and text-center - Desktop layout unchanged: wedge + download together, ratio below - Improves mobile UX with better visual balance
- Change gap from gap-2 to gap-2 md:gap-3 - Mobile keeps gap-2, desktop uses gap-3 (12px) - Provides more breathing room between controls on larger screens
Instead of extracting torrentId from downloadUrl in the backend, pass it directly from the frontend where it's already available. This simplifies the API and removes the need for URL parsing.
Add bustStatsCache function to invalidate cached user stats when torrents are added, ensuring stats are refreshed to reflect new downloads. Only bust cache on successful downloads, not on failures.
Add test coverage for FL wedge purchase functionality including: - Input validation (missing/invalid torrentId) - Successful wedge purchases - Various error conditions (API failures, expired tokens, invalid responses) - Edge cases (numeric torrentId, invalid JSON responses)
When FL wedge is enabled or torrent is already freeleech, ratio impact now shows 'Same' instead of negative impact. For dual downloads, only non-freeleech items are included in ratio calculations.
- Add comprehensive test suite for user-stats route (22 tests) - Cache hit/miss scenarios - Token expiration detection (403 & HTML responses) - Invalid JSON handling - Missing data field defaults - Cache cleanup for >100 entries - All error paths covered - Add MessageBanner component tests (8 tests) - All message types (error, success, info) - CSS class application and styling - Icon rendering verification - Enhance add route tests (6 new wedge integration tests) - Successful wedge purchase flow - Failed wedge purchase error handling - Cache busting behavior - Error propagation with wedgeFailed flag - Expand utilities tests - maskToken edge cases (tokens 6-10 chars, non-string types) - validateMamToken regex branch coverage - generateTimestamp unit test - Add search route test for missing/null fields - Add use-wedge test for missing error message fallback - Install React Testing Library dependencies - @testing-library/react - @testing-library/jest-dom - @vitejs/plugin-react - jsdom - Update Vitest config - Add React plugin support - Change environment to jsdom - Include .jsx test files Coverage improvements: - Statements: 75.57% → 95.43% - Branches: 72.15% → 94.09% - Lines: 77.33% → 98.56% - Total tests: 154 → 194 (40 new tests) - All tests passing ✓
Codecov Report✅ All modified and coverable lines are covered by tests.
... and 2 files with indirect coverage changes 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds comprehensive Freeleech (FL) wedge support to Scurry, allowing users to purchase FL wedges for torrents before downloading. This significantly improves ratio management by making torrents freeleech, so downloads don't count against your ratio.
Closes #21
Features Added
🎯 Core FL Wedge Functionality
/api/use-wedgeendpoint for purchasing FL wedges from MAM🎨 UI Enhancements
WedgeToggleButtoncomponent with lightning bolt icon📱 Mobile Improvements
🖥️ Desktop Improvements
🧪 Test Coverage
__tests__/user-stats.test.mjs(22 tests)__tests__/message-banner.test.jsx(8 tests)__tests__/use-wedge.test.mjs(11 tests)🔧 Infrastructure
Technical Details
New API Endpoints
POST /api/use-wedge- Purchase FL wedge for a torrentCache Management
Error Handling
Ratio Calculations
calculateNewRatio()andcalculateRatioDiff()account for FL wedgesTesting
All tests pass with excellent coverage:
Run tests locally:
Breaking Changes
None - this is a purely additive feature.
Screenshots
(Would include screenshots of the FL wedge UI in actual PR)
Checklist