- Add rules_engine.py with quantitative rules for all 8 workout types - Add quality gate retry loop in generate_single_workout() - Expand calibrate_structure_rules to all 120 combinations (8 types × 5 goals × 3 sections) - Wire WeeklySplitPattern DB records into _pick_weekly_split() - Enforce movement patterns from WorkoutStructureRule in exercise selection - Add straight-set strength support (single main lift, 4-6 rounds) - Add modality consistency check for duration-dominant workout types - Add InjuryStep component to onboarding and preferences - Add sibling exercise exclusion in regenerate and preview_day endpoints - Display generator warnings on dashboard - Expand fix_rep_durations, fix_exercise_flags, fix_movement_pattern_typo - Add audit_exercise_data and check_rules_drift management commands - Add Next.js frontend with dashboard, onboarding, preferences, history pages - Add generator app with ML-powered workout generation pipeline - 96 new tests across 7 test modules Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
74 lines
2.1 KiB
TypeScript
74 lines
2.1 KiB
TypeScript
"use client";
|
|
|
|
interface WeekPickerProps {
|
|
selectedMonday: string;
|
|
onChange: (monday: string) => void;
|
|
}
|
|
|
|
function getMondayDate(dateStr: string): Date {
|
|
const [y, m, d] = dateStr.split("-").map(Number);
|
|
return new Date(y, m - 1, d);
|
|
}
|
|
|
|
function formatDate(date: Date): string {
|
|
const yyyy = date.getFullYear();
|
|
const mm = String(date.getMonth() + 1).padStart(2, "0");
|
|
const dd = String(date.getDate()).padStart(2, "0");
|
|
return `${yyyy}-${mm}-${dd}`;
|
|
}
|
|
|
|
function formatWeekLabel(dateStr: string): string {
|
|
const date = getMondayDate(dateStr);
|
|
return date.toLocaleDateString("en-US", {
|
|
month: "short",
|
|
day: "numeric",
|
|
year: "numeric",
|
|
});
|
|
}
|
|
|
|
function ChevronLeft() {
|
|
return (
|
|
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
|
<path d="M15 18l-6-6 6-6" />
|
|
</svg>
|
|
);
|
|
}
|
|
|
|
function ChevronRight() {
|
|
return (
|
|
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
|
<path d="M9 18l6-6-6-6" />
|
|
</svg>
|
|
);
|
|
}
|
|
|
|
export function WeekPicker({ selectedMonday, onChange }: WeekPickerProps) {
|
|
const shiftWeek = (offset: number) => {
|
|
const date = getMondayDate(selectedMonday);
|
|
date.setDate(date.getDate() + offset * 7);
|
|
onChange(formatDate(date));
|
|
};
|
|
|
|
return (
|
|
<div className="flex items-center gap-3">
|
|
<button
|
|
onClick={() => shiftWeek(-1)}
|
|
className="p-1.5 rounded-lg text-zinc-400 hover:text-zinc-100 hover:bg-zinc-800 transition-colors"
|
|
aria-label="Previous week"
|
|
>
|
|
<ChevronLeft />
|
|
</button>
|
|
<span className="text-sm font-medium text-zinc-200 min-w-[160px] text-center">
|
|
Week of {formatWeekLabel(selectedMonday)}
|
|
</span>
|
|
<button
|
|
onClick={() => shiftWeek(1)}
|
|
className="p-1.5 rounded-lg text-zinc-400 hover:text-zinc-100 hover:bg-zinc-800 transition-colors"
|
|
aria-label="Next week"
|
|
>
|
|
<ChevronRight />
|
|
</button>
|
|
</div>
|
|
);
|
|
}
|