diff --git a/src/shared/data/index.ts b/src/shared/data/index.ts index 34e8d3e..abba7cc 100644 --- a/src/shared/data/index.ts +++ b/src/shared/data/index.ts @@ -73,6 +73,21 @@ export const CATEGORIES: { id: ProgramId | 'all'; label: string }[] = [ { id: 'full-body', label: 'Full Body' }, ] +// ═══════════════════════════════════════════════════════════════════════════ +// POPULAR / RECOMMENDED +// ═══════════════════════════════════════════════════════════════════════════ + +/** Return a shuffled sample of workouts across all programs (one per program per week). */ +export function getPopularWorkouts(count: number = 4) { + // Pick the first workout from each program week to get variety + const picks = Object.values(PROGRAMS).flatMap((program) => + program.weeks.map((week) => week.workouts[0]).filter(Boolean) + ) + // Simple deterministic shuffle based on id to avoid re-renders + const sorted = [...picks].sort((a, b) => a.id.localeCompare(b.id)) + return sorted.slice(0, count) +} + // Legacy exports for backward compatibility (to be removed) export { WORKOUTS } from './workouts' export { FEATURED_COLLECTION_ID } from './collections'