critical priority low complexity frontend pending frontend specialist Tier 1

Acceptance Criteria

PeerMentorCardWidget renders mentor name, availability status chip, certification status badge, and assigned member count for all fixture data permutations
Availability status chip displays three states — active (green-tinted token), paused (amber-tinted token), unavailable (muted/grey token) — with distinct colors for each state
Certification status badge displays three states — current, expiring (within 30 days), expired — with distinct visual treatments (e.g., expiring = warning color, expired = error color)
Assigned member count is displayed as a numeric indicator (e.g., '4 members') and shows '0 members' gracefully when the count is zero
The card's background color or left border accent visually distinguishes it from ContactCardWidget when both appear in the same scrollable list
The widget accepts a typed PeerMentor data model and does not use dynamic/Object parameters
Widget is stateless and derives all display state from the passed data model
Tapping the card triggers an onTap callback passed from the parent — navigation is not handled inside the widget
Widget renders correctly with null-safe Dart — no null pointer exceptions for any supported field combination

Technical Requirements

frameworks
Flutter
flutter_test
data models
PeerMentor
AvailabilityStatus
CertificationStatus
performance requirements
Widget must be const-constructible where possible to enable widget tree optimization in long lists
No async operations inside the widget — all data passed synchronously via constructor
security requirements
Do not display raw database IDs or internal identifiers on the card face
Certification expiry date display must not reveal the mentor's personal schedule details beyond the status category
ui components
Chip widget for availability status
Badge/Container widget for certification status
Numeric indicator for assigned member count
Card or Container with distinct background token color
InkWell with onTap callback

Execution Context

Execution Tier
Tier 1

Tier 1 - 540 tasks

Can start after Tier 0 completes

Implementation Notes

Define an enum or sealed class for AvailabilityStatus (active, paused, unavailable) and CertificationStatus (current, expiring, expired) if not already present in the domain layer. Map each enum value to a design token color inside a helper method or extension, keeping color logic out of the widget's build method. For the certification 'expiring' state, compute whether a given expiry DateTime falls within 30 days of DateTime.now() in the data layer or a ViewModel — the widget itself should only receive the enum, not raw dates. Use a left-side colored border (Container with BoxDecoration borderRadius + border) or a subtly different card surface token to differentiate from ContactCardWidget without making the UI feel inconsistent.

Follow the same structural layout conventions as ContactCardWidget (padding, typography scale) to ensure visual coherence while still being distinguishable at a glance.

Testing Requirements

Write flutter_test widget tests covering: (1) rendering each availability status (active, paused, unavailable) and asserting the correct chip label and color token is applied; (2) rendering each certification status (current, expiring, expired) and asserting badge label and color; (3) zero assigned members shows '0 members' text without errors; (4) onTap callback fires when card is tapped; (5) visual distinction from ContactCardWidget — assert that the background color/decoration of PeerMentorCardWidget differs from ContactCardWidget when both are rendered in the same test tree. Use fixture data from task-001 mock data. No e2e tests required.

Component
Peer Mentor Card Widget
ui low
Epic Risks (2)
medium impact medium prob technical

Design token color values used in role badges, certification status indicators, and availability chips may not meet the WCAG 2.2 AA contrast ratio of 4.5:1 when rendered against card backgrounds, requiring rework after accessibility review and potentially blocking acceptance sign-off.

Mitigation & Contingency

Mitigation: Run the contrast-ratio-validator on every new token combination during widget development. Enforce the CI accessibility lint runner on all PRs touching visualization components, and validate against the contrast-safe-color-palette before finalizing card designs.

Contingency: If contrast failures are found late, adjust token values in the design token theme centrally — since all widgets consume design tokens rather than hardcoded colors, all affected widgets will be corrected by a single token update without per-widget changes.

low impact medium prob dependency

The ContactViewSwitcher is required for Barnekreftforeningen but must not appear for other organizations. If the organization labels provider does not yet expose a reliable feature flag for this widget, it may render universally or be conditionally hidden in an inconsistent way, breaking the role-specific layout contract.

Mitigation & Contingency

Mitigation: Implement view switcher visibility as a constructor parameter on ContactListScreen injected from a provider, defaulting to hidden. Document the integration point for the org labels provider so the flag can be wired without changing the widget's API.

Contingency: If org labels integration is delayed beyond this epic, use a feature flag constant keyed to the Barnekreftforeningen organization ID as a temporary gate, with a tracked issue to replace it with the runtime labels provider before general release.