Closed reneefromhold closed 1 month ago
The changes in this pull request involve modifications to the BasicPointsForBadges
component and its associated story file. New properties for customization, including pointsLabelColor
, progressBarFillColor
, and customField
, are added to the Live
export in the story file. Additionally, adjustments are made to the activities
array, updating existing keys and types, and introducing a new activity. The component's state management and rendering logic are refined, particularly in handling badge awards and points calculation.
File | Change Summary |
---|---|
src/components/container/BasicPointsForBadges/BasicPointsForBadges.stories.tsx |
- Added properties: pointsLabelColor , progressBarFillColor , customField to Live export. - Updated activity key from "FitbitSleepData" to "SleepData". - Updated dailyDataType from DailyDataType.FitbitSleepMinutes to DailyDataType.SleepMinutes . - Added new activity: key: "CustomField", type: "custom", points: 25, customField: "PersonalGoal" . |
src/components/container/BasicPointsForBadges/BasicPointsForBadges.tsx |
- Updated state management for badges and points calculation. - Changed Title component's color prop to direct assignment. - Corrected conditional rendering for LoadingIndicator . |
src/helpers/BasicPointsAndBadges/CustomActivity.ts |
- Changed logic in awardCustomActivityPoints to set pointsAwarded directly to newPoints . - Added interface CustomActivity . |
package.json |
- Version updated from 2.40.0 to 2.40.1-BasicBadgeVB.0 . |
sequenceDiagram
participant User
participant BasicPointsForBadges
participant BadgeManager
User->>BasicPointsForBadges: Trigger badge award
BasicPointsForBadges->>BadgeManager: Check for new badges
BadgeManager-->>BasicPointsForBadges: Return badge status
alt New badges awarded
BasicPointsForBadges->>BasicPointsForBadges: Wait for few seconds
BasicPointsForBadges->>User: Open application view for awarding badges
else No new badges
BasicPointsForBadges->>BasicPointsForBadges: Set currentState.badges
end
BasicPointsForBadges->>BasicPointsForBadges: Calculate newPointTotal
BasicPointsForBadges->>User: Render updated points and badges
Objective | Addressed | Explanation |
---|---|---|
Configure component against a custom field (324) | ✅ | |
Ensure points are awarded correctly based on custom field activities (324) | ✅ | |
Restrict earning of points to avoid multiple awards in a day (324) | ❌ | No mechanism implemented to limit point earning. |
@greinard When you have a minute, your concerns should all be addressed. Also, note the update to the calculation for custom type. See issue #324 for discussion
Overview
Fixes 1) Title color property was not working 2) Added comments near where the awards url is opened. This came up while developing in Live mode and downstream repos 3) Updated the custom activity to update the custom field with recalculated points. Was previously adding recalculated points to the custom field. Fixes #324
Security
REMINDER: All file contents are public.
Describe briefly what security risks you considered, why they don't apply, or how they've been mitigated.
Checklist
Testing
Documentation
Consider "Squash and merge" as needed to keep the commit history reasonable on
main
.Reviewers
Assign to the appropriate reviewer(s). Minimally, a second set of eyes is needed ensure no non-public information is published. Consider also including:
Summary by CodeRabbit
Summary by CodeRabbit
New Features
Bug Fixes
Refactor
Chores