fix: add missing getPopularWorkouts export to data layer
The workout complete screen imports getPopularWorkouts to show recommended workouts, but the function was never implemented. Added it to the data index — picks the first workout from each program week for variety across categories and levels.
This commit is contained in:
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user