PIRX Docs
Dashboard

Daily Impact Card

Source: components/home/daily-impact-card.tsx


What You See

A card that appears when you select a date on the Calendar or view today's activities on the Dashboard. Each activity from that day gets its own row. Running activities show distance, pace, and average heart rate on the left, with a route map thumbnail on the right if GPS data exists. Cross-training activities (cycling, swimming, strength, etc.) show a sport-specific icon in an amber circle, the sport name, duration, and heart rate. Below the summary is the projection impact: how much time this activity added or saved on your projection (for example '-3s on projection'). Cross-training activities show their sport-specific delta instead (like '+5W on FTP'). Tapping the expand arrow reveals detailed metric tiles (pace, HR, distance for runs; duration, HR, calories for cross-training), a before-and-after projection comparison, a driver attribution breakdown showing which drivers each activity targeted most, and a 'Simulate This Run' button that opens the Zone Predictor for that specific activity.

Tap-to-Expand Hand Icon (One-Time)

A small hand/finger-tap icon overlays the map (or gradient placeholder) on every collapsed activity card the first time you visit. It tells you the whole card is tappable, not just the chevron. The moment you tap any activity card to expand it, the icon disappears from every card on the page and is permanently retired across future sessions. PIRX records that you have learned the gesture in browser localStorage under pirx-activity-tap-educated, so the icon never returns on later visits — clearing site data resets it.

How the Numbers Work

Each activity's projection delta is the difference between your projected time before and after that activity was processed by the pipeline. A negative delta (shown as minus seconds) means the activity made your projection faster. Driver attribution shows the percentage each driver was impacted: for example, a long easy run might show 'Aerobic Base 60 percent, Load Consistency 25 percent, Running Economy 15 percent.' Cross-training activities show their sport-specific projection delta (like watts gained on cycling FTP) when available.

Cross-Training Expanded View

Cross-training activities (cycling, swimming, strength, etc.) have an enhanced expanded view that running activities do not:

  • Enhanced metric tiles: Cycling shows Duration, Distance, Avg HR, Max HR, Avg Power, TSS, Avg Speed, and Elevation (when data available). Swimming shows Duration, Distance, Avg HR, Max HR, and Calories. Strength shows Duration, Avg HR, Max HR, and Calories. The tile grid dynamically adjusts from 3 to 4 columns based on available data.
  • HR line chart: A zone-colored SVG time-series chart showing heart rate over the activity duration. Each line segment is colored by the HR zone it falls into (Z1-Z5), using the activity's max HR to determine zone thresholds (Z1 below 60 percent, Z2 60-70 percent, Z3 70-80 percent, Z4 80-90 percent, Z5 above 90 percent). Only appears when the activity has HR sample data (downsampled to approximately 120 points at ingestion).
  • Zone summary table: Displayed below the HR chart. Shows zones Z5 through Z1 (highest first) with a colored dot, proportional bar, percentage of total time, and duration in MM'SS format. Only appears when HR zone data exists.

Running activities continue to show their existing layout: Pace, Avg HR, and Distance tiles plus a route map thumbnail.

Step by Step

The calendar page or dashboard calls GET /activities/date-impact with the selected date and current event. The backend returns an array of DailyImpactItem objects, each containing: the activity details (type, distance, duration, pace, heart rate, max HR, GPS polyline, sport category, optional sport projection delta, HR samples, power metrics, TSS, speed), classification (easy, threshold, long_run, race, cross-training), projection before and after values, the delta in seconds, driver deltas (an array of objects with name, display_name, and delta_seconds for each of the five drivers), and a has_impact flag. The component renders each item as an ImpactRow. Running activities show distance, pace, and a route map via the RouteMapThumbnail component (Leaflet map decoding the summary polyline). Cross-training activities use a sport-icon lookup map and show CrossTrainingMetricTiles (duration, distance, HR, max HR, power, TSS, speed, elevation depending on sport type), followed by an HRLineChart (zone-colored SVG) and ZoneSummaryTable when HR data exists. HR samples are fetched via a dedicated query to avoid loading large JSONB into other activity queries. Driver attribution is calculated client-side: each driver's absolute delta is divided by the total absolute deltas to get a percentage, sorted largest first. The 'Simulate This Run' button calls the parent's onSimulate callback which opens the Zone Forecast tab in single-activity mode.

On this page