Peer Mentor Stats Screen
Component Detail
Description
The primary statistics screen shown to peer mentors displaying their own aggregated totals for the selected time window. Shows session count, total hours contributed, and pending reimbursement amounts where applicable. Refreshes automatically on navigation via Riverpod AsyncNotifier.
stats-screen-peer-mentor
Summaries
The Peer Mentor Stats Screen gives mentors immediate, at-a-glance visibility into their contribution history and pending reimbursements, directly supporting mentor retention and satisfaction. When mentors can easily verify their hours and compensation status without contacting support, it reduces administrative overhead and builds trust in the platform. Offering flexible time window filtering empowers mentors to understand their own trends, reinforcing engagement. This screen is a key part of the value proposition delivered to peer mentors and directly influences their continued participation, which is critical to the program's scalability and cost-effectiveness.
This is a medium-complexity mobile screen with four direct component dependencies: the time window selector, stats summary cards, activity chart widget, and the stats notifier (Riverpod AsyncNotifier). All four dependencies must be completed and stable before this screen can be fully integrated and tested. The automatic refresh-on-navigation behavior requires careful coordination with the navigation stack and state management layer. Testing should cover loading, error, and empty states explicitly, as well as time window switching with live data.
Plan for UI/UX review cycles given this screen's high visibility to end users. Dependencies on the reimbursement data model mean any schema changes to reimbursement amounts could require screen updates.
The Peer Mentor Stats Screen is a Flutter widget that composes multiple sub-widgets — `TimeWindowSelector`, `StatsSummaryCards`, and `ActivityChartWidget` — driven by a Riverpod `AsyncNotifier` (`StatsNotifier`) that handles data fetching and state management. The `build(BuildContext)` method conditionally renders loading, error, or empty state widgets based on the notifier's async state. `onTimeWindowChanged(TimeWindow)` dispatches a new filter to the notifier, triggering a re-fetch. `onRefresh()` supports pull-to-refresh or navigation-triggered refresh via Riverpod's `ref.invalidate()` or equivalent.
The screen consumes the `activity` and `reimbursement` data models. Auto-refresh on screen focus should be implemented using a `WidgetsBindingObserver` or a Riverpod `ref.listenSelf` pattern. Ensure the error state includes actionable messaging. Keep business logic out of the widget — delegate all aggregation to the notifier or a dedicated repository layer.
Responsibilities
- Render peer mentor's own session and hour totals
- Display pending reimbursement amounts
- Trigger data refresh on screen focus
- Present time window selector for filtering
Interfaces
build(BuildContext context)
onTimeWindowChanged(TimeWindow window)
onRefresh()
showLoadingState()
showErrorState(String message)
showEmptyState()
Relationships
Dependencies (4)
Components this component depends on
Related Data Entities (3)
Data entities managed by this component