Target override storage functions allow users to customize specific workout targets for any day in the Rippler program. Instead of following the default program prescription, users can set custom weights, reps, or sets for individual exercises on specific days.
The target override if found, or null if no override exists
Use this function before displaying a workout to check if any exercises have custom targets.
Example
import { getTargetOverride } from '@/lib/storage';// Check if first exercise on Week 1 Monday has an overrideconst override = await getTargetOverride(1, 'Monday', 0);if (override) { console.log('Custom targets found:'); if (override.weight) console.log(`Weight: ${override.weight}`); if (override.reps) console.log(`Reps: ${override.reps}`); if (override.sets) console.log(`Sets: ${override.sets}`);} else { console.log('Using default program targets');}
Source Code ReferenceSee implementation at lib/storage.ts:171-182
export interface TargetOverride { week: number; // Program week (1-16) day: string; // Day name (e.g., "Monday") exerciseIndex: number; // Zero-based exercise index in the day weight?: number | string; // Custom weight (optional) reps?: number | string; // Custom reps (optional) sets?: number | string; // Custom sets (optional)}
All target fields (weight, reps, sets) are optional. This allows you to override just one parameter while keeping the others at their default values.
import { saveTargetOverride } from '@/lib/storage';async function applyDeloadWeek(week: number, days: string[]) { const deloadPercentage = 0.6; // 60% of normal weight for (const day of days) { // Assuming 4 exercises per day for (let i = 0; i < 4; i++) { await saveTargetOverride({ week, day, exerciseIndex: i, weight: `${deloadPercentage * 100}%` // Store as percentage }); } }}// Usage - apply deload to week 8await applyDeloadWeek(8, ['Monday', 'Wednesday', 'Friday']);
Exercise indices are zero-based and correspond to the order of exercises in the workout day array.
const exercises = [ { tier: 'T1', exercise: 'Squat', ... }, // index 0 { tier: 'T2', exercise: 'Romanian DL', ... }, // index 1 { tier: 'T3a', exercise: 'Leg Press', ... } // index 2];// Override the second exerciseawait saveTargetOverride({ week: 1, day: 'Monday', exerciseIndex: 1, // Romanian DL weight: 185});
Preserve program structure
Overrides should adjust intensity, not fundamentally change the program structure.
// Good - reasonable adjustmentawait saveTargetOverride({ week: 1, day: 'Monday', exerciseIndex: 0, weight: 225 // Reduced from 245 due to fatigue});// Be careful - major changes might break periodizationawait saveTargetOverride({ week: 1, day: 'Monday', exerciseIndex: 0, sets: 10 // Default is 3-5, this is very different});
Document why overrides were applied
Consider adding a notes system to track why overrides were made.
// Extended TargetOverride with notes (custom implementation)interface ExtendedOverride extends TargetOverride { notes?: string;}await saveTargetOverride({ week: 3, day: 'Friday', exerciseIndex: 0, weight: 185, notes: 'Reduced due to lower back tightness'});