Content Production Dashboard: Adding metrics section [MAPS-123]
Purpose
This update adds the metrics section as well as the extraction of the main logic, so we can reuse it in both the Home and Page locations.
Approach
IMP: In this PR the refresh button was removed, it does the same as a navigator refresh. In other apps (Homebase) we removed this type of button for that reason, so I follow the same approach here.
Implemented a metrics dashboard that calculates and displays 5 content production metrics from Contentful entries and scheduled actions:
- Total Published
- Average Time to Publish
- Scheduled, Recently Published
- Needs Update
The metrics use configurable time periods from installation parameters (needsUpdateMonths, recentlyPublishedDays, timeToPublishDays) and are rendered as styled cards.
The MetricsCalculator class performs all calculations in the constructor, and the Dashboard component is reusable across both Page and Home locations.
- Note: Although this class's behavior is limited to the constructor, it provides encapsulation of the calculation logic, ensures consistent state (same timestamp for all metrics), and offers a user-friendly, immutable interface that simplifies usage and testing.
Testing steps
Automated tests added.
With entries and scheduled actions:
Without any entry or scheduled actions:
With negative published percentage:
How the flow works:
https://github.com/user-attachments/assets/61e6fdb3-d6d3-4198-a06e-3637052897aa
Breaking Changes
N/A
Dependencies and/or References
Link to MAPS-123
Deployment
N/A