Fitness: Stride Pro
Stride plans training around your goals. The live session counts down each block, can pause and skip, and shows heart rate against zones on a gauge.
See it live, on any deviceUse the whole app
import { FitnessApp } from '@patine-ui/pro';
<FitnessApp />;
| Prop | Type | Default |
|---|---|---|
initialRoute | 'today' | 'setup' | 'train' | 'workout' | 'session' | 'progress' | 'classes' | 'profile' | 'today' |
demo | 'ready' | 'loading' | 'empty' | 'error' | 'ready' |
insets | { top, bottom } | None |
platform | 'ios' | 'android' | 'web' | Platform.OS |
Screens move the platform's way: on iOS a pushed screen slides in from the trailing edge, on Android they fade through, on the web and between tabs they fade in. Reduce motion turns it off.
Screens
| Screen | What it does |
|---|---|
TodayScreen | RadialChart rings, the planned workout, StatsRow for steps, heart and sleep, the week's streak |
SetupScreen | Steps as progress, goals on a multiple ToggleGroup, a Slider and SegmentedControl for rhythm |
TrainScreen | Programs in a Carousel and workouts filtered with chips |
WorkoutScreen | The plan on Pro's Timeline with numbered markers |
SessionScreen | A countdown per block, Progress for the whole session, a GaugeChart of heart-rate zones, pause and skip |
FitnessProgressScreen | A year HeatmapChart, this week against last, weight with a target band, a RadarChart profile |
ClassesScreen | Pro's EventCalendar of studio classes with booking in a BottomSheet |
FitnessProfileScreen | Badges and a sortable leaderboard Table |
Every screen is exported on its own, takes its data as props, and has sample data as defaults. sessionAt(exercises, elapsed) says which block a session is on and what is left; heartZone(bpm) the zone.
Built with
The free components, from patine-ui:
Avatar · Badge · BottomSheet · Button · Card · Carousel · ChipGroup · DescriptionList · Heading, Text · List, ListItem · Progress · SegmentedControl · Slider · Steps · Table · ToggleGroup
And from Patine Pro:
- App shell and layout PRO
- Bar chart PRO
- Event calendar PRO
- Gauge chart PRO
- Heatmap PRO
- Line chart PRO
- Radar chart PRO
- Radial chart PRO
- Sparkline PRO
- Stats row PRO
- Timeline PRO
Files
fitness/
├── hooks/
│ └── useFitness.ts
├── ClassesScreen.tsx
├── fitness.constants.ts
├── fitness.utils.ts
├── FitnessApp.tsx
├── FitnessProfileScreen.tsx
├── FitnessProgressScreen.tsx
├── index.ts
├── SessionScreen.tsx
├── SetupScreen.tsx
├── TodayScreen.tsx
├── TrainScreen.tsx
└── WorkoutScreen.tsx
It also uses shared/, the theme, money formatting and screen transitions every Pro app shares.
A look at the code
The workout clock and heart-rate zones, from fitness.utils.ts:
/** Seconds as a clock: 75 is "1:15", 3725 is "1:02:05". */
export const clock = (seconds: number) => {
const s = Math.max(0, Math.floor(seconds));
const h = Math.floor(s / 3600);
const m = Math.floor((s % 3600) / 60);
const pad = (n: number) => String(n).padStart(2, '0');
return h ? `${h}:${pad(m)}:${pad(s % 60)}` : `${m}:${pad(s % 60)}`;
};
/** The heart-rate zone for a beat, from a max heart rate: 1 easy to 5 all out. */
export const heartZone = (bpm: number, max = 190) => {
const r = bpm / max;
return r < 0.6 ? 1 : r < 0.7 ? 2 : r < 0.8 ? 3 : r < 0.9 ? 4 : 5;
};