Description:
The Problem List currently supports filtering by text search and tag selection, but there is no way to filter problems by difficulty rating. For competitive programmers, filtering by rating range (e.g., 800–1200) is essential for targeted practice sessions.
Feature Requirements:
- Add a set of rating range chip buttons near the existing tag filter bar (e.g.,
[800-1000], [1000-1200], [1200-1400], [1400-1800], [1800+]).
- Tapping a chip selects it (highlighted with the neon gradient). Tapping again deselects it.
- The rating filter should work in combination with the existing text search and tag filter.
- Problems with a
nil rating should be excluded when a rating range is active.
- When no rating range is selected, all problems are displayed (preserving current behavior).
Steps to Implement:
- Add a
@State private var selectedRatingRange property in ProblemListView.
- Create rating chip UI components below the tag filter bar, following the same visual style as the existing tag chips.
- Update
ProblemFilterEngine.filter() in CForge/Domain/ProblemFilterEngine.swift to accept an optional rating range parameter.
- Update
ProblemListViewModel.filterProblems() in CForge/ViewModels/ProblemListViewModel.swift to pass the rating range through.
- Wire the UI state to trigger filtering via the existing
.task(id:) pattern.
Key Files:
| File |
Change |
CForge/Domain/ProblemFilterEngine.swift |
Add rating range filtering logic |
CForge/ViewModels/ProblemListViewModel.swift |
Update filterProblems() method signature |
CForge/Views/Problem/ProblemListView.swift |
Add rating chip UI and state management |
Expected Outcome:
- Users can filter problems by selecting a rating range chip.
- The filter integrates seamlessly with the existing search and tag filters.
- The UI is consistent with the app's neon dark theme.
Description:
The Problem List currently supports filtering by text search and tag selection, but there is no way to filter problems by difficulty rating. For competitive programmers, filtering by rating range (e.g., 800–1200) is essential for targeted practice sessions.
Feature Requirements:
[800-1000],[1000-1200],[1200-1400],[1400-1800],[1800+]).nilrating should be excluded when a rating range is active.Steps to Implement:
@State private var selectedRatingRangeproperty inProblemListView.ProblemFilterEngine.filter()inCForge/Domain/ProblemFilterEngine.swiftto accept an optional rating range parameter.ProblemListViewModel.filterProblems()inCForge/ViewModels/ProblemListViewModel.swiftto pass the rating range through..task(id:)pattern.Key Files:
CForge/Domain/ProblemFilterEngine.swiftCForge/ViewModels/ProblemListViewModel.swiftfilterProblems()method signatureCForge/Views/Problem/ProblemListView.swiftExpected Outcome: