-
-
Notifications
You must be signed in to change notification settings - Fork 353
Feature/trophies #1052
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/trophies #1052
Conversation
This allows us to show for which sets the user achieved new PRs
This allows us to use the trophy translations from the server.
97ec78f to
4563c58
Compare
4563c58 to
352a4b1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds a trophies feature to display user-earned trophies for workout achievements. The implementation includes trophy models, a repository for fetching trophy data, UI widgets to display trophies on the dashboard and in a dedicated screen, and integration with workout logs to show personal record indicators.
Changes:
- Added trophy data models (Trophy, UserTrophy, UserTrophyProgression, ContextData) with JSON serialization
- Implemented TrophyRepository and TrophyStateNotifier using Riverpod for state management
- Created UI widgets for displaying trophies on the dashboard and in a dedicated trophies screen
- Integrated trophy indicators with workout logs to highlight personal records
Reviewed changes
Copilot reviewed 55 out of 55 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| lib/models/trophies/*.dart | Trophy domain models with JSON serialization |
| lib/providers/trophies.dart | Trophy repository and state management using Riverpod |
| lib/widgets/trophies/*.dart | Trophy UI components for overview and dashboard |
| lib/widgets/dashboard/widgets/trophies.dart | Dashboard widget showing recent trophies |
| lib/widgets/routines/logs/*.dart | Integration of trophy/PR indicators in workout logs |
| lib/screens/trophy_screen.dart | Dedicated screen for viewing all trophies |
| lib/providers/base_provider.dart | Added language parameter support to fetch methods |
| lib/main.dart | Integrated Riverpod providers with existing Provider-based architecture |
| test/trophies/*.dart | Unit and widget tests for trophy functionality |
Comments suppressed due to low confidence (2)
lib/providers/base_provider.dart:68
- The
languageparameter is accepted but never passed togetDefaultHeaders(). The language should be passed asgetDefaultHeaders(includeAuth: true, language: language)to include the Accept-Language header in the request.
Future<dynamic> fetch(Uri uri, {String? language}) async {
// Send the request
final response = await client.get(
uri,
headers: getDefaultHeaders(includeAuth: true),
);
lib/widgets/routines/logs/exercises_expansion_card.dart:84
- The null assertion operator
!is used twice. Consider using a single null-safe access pattern liketopSet?.weightUnitObj?.namewith proper null handling to improve code clarity.
final topSetWeightUnit = topSet?.weightUnitObj != null
? getServerStringTranslation(topSet!.weightUnitObj!.name, context)
: '';
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
# Conflicts: # lib/providers/base_provider.dart # lib/providers/gym_state.dart # lib/providers/gym_state.g.dart # lib/widgets/routines/gym_mode/log_page.dart # test/core/settings_test.mocks.dart # test/exercises/contribute_exercise_image_test.mocks.dart # test/gallery/gallery_form_test.mocks.dart # test/gallery/gallery_screen_test.mocks.dart # test/measurements/measurement_provider_test.mocks.dart # test/nutrition/nutritional_plan_screen_test.mocks.dart # test/nutrition/nutritional_plans_screen_test.mocks.dart # test/routine/gym_mode/gym_mode_test.mocks.dart # test/routine/routine_screen_test.mocks.dart # test/routine/routines_provider_test.mocks.dart # test/routine/routines_screen_test.mocks.dart # test/user/provider_test.mocks.dart # test/weight/weight_provider_test.mocks.dart # test/widgets/routines/gym_mode/log_page_test.dart
# Conflicts: # lib/main.dart # lib/screens/dashboard.dart
Proposed Changes
Shows user earned trophies
Related Issue(s)
Closes #994