diff --git a/playwright-report/index.html b/playwright-report/index.html index aa4c3eb..23f306d 100644 --- a/playwright-report/index.html +++ b/playwright-report/index.html @@ -82,4 +82,4 @@ Error generating stack: `+n.message+`
- \ No newline at end of file + \ No newline at end of file diff --git a/server/test.db b/server/test.db index e74a3de..7109c5a 100644 Binary files a/server/test.db and b/server/test.db differ diff --git a/src/components/Plans.tsx b/src/components/Plans.tsx index ecc308f..1059f6f 100644 --- a/src/components/Plans.tsx +++ b/src/components/Plans.tsx @@ -44,6 +44,24 @@ const Plans: React.FC = ({ lang }) => { const [newExType, setNewExType] = useState(ExerciseType.STRENGTH); const [newExBwPercentage, setNewExBwPercentage] = useState('100'); + // Preparation Modal State + const [showPlanPrep, setShowPlanPrep] = useState(null); + + const handleStart = (plan: WorkoutPlan) => { + if (plan.description && plan.description.trim().length > 0) { + setShowPlanPrep(plan); + } else { + startSession(plan, currentUser?.profile?.weight); + } + }; + + const confirmPlanStart = () => { + if (showPlanPrep) { + startSession(showPlanPrep, currentUser?.profile?.weight); + setShowPlanPrep(null); + } + }; + useEffect(() => { const loadData = async () => { refreshData(); @@ -377,6 +395,8 @@ const Plans: React.FC = ({ lang }) => { ); } + + return (
@@ -425,7 +445,7 @@ const Plans: React.FC = ({ lang }) => { {plan.steps.length} {t('exercises_count', lang)}
+ + {/* Preparation Modal */} + {showPlanPrep && ( +
+
+

{showPlanPrep.name}

+
+
{t('prep_title', lang)}
+ {showPlanPrep.description || t('prep_no_instructions', lang)} +
+
+ + +
+
+
+ )}
); }; diff --git a/tests/rest-timer.spec.ts b/tests/rest-timer.spec.ts index 0ff5702..ae244cc 100644 --- a/tests/rest-timer.spec.ts +++ b/tests/rest-timer.spec.ts @@ -187,6 +187,13 @@ test.describe('Rest Timer', () => { // Start the plan. await page.getByRole('button', { name: 'Start' }).click(); + // Expect Preparation Modal + const modal = page.locator('.fixed.inset-0.z-50'); + await expect(modal).toBeVisible(); + await expect(modal.getByText('Ready to go')).toBeVisible(); + // Click Start in the modal (ensure we click the button inside the modal) + await modal.getByRole('button', { name: 'Start' }).click(); + // Timer Update: Click FAB const fab = page.locator('.fixed.bottom-24.right-6'); await fab.click(); diff --git a/tests/workout-management.spec.ts b/tests/workout-management.spec.ts index 474c348..e10ff9d 100644 --- a/tests/workout-management.spec.ts +++ b/tests/workout-management.spec.ts @@ -196,6 +196,13 @@ test.describe('II. Workout Management', () => { .last(); await card.getByRole('button', { name: 'Start' }).click(); + // Expect Preparation Modal + const modal = page.locator('.fixed.inset-0.z-50'); + await expect(modal).toBeVisible(); + await expect(modal.getByText('Ready to go')).toBeVisible(); + // Click Start in the modal (ensure we click the button inside the modal) + await modal.getByRole('button', { name: 'Start' }).click(); + await expect(page.getByText('Startable Plan', { exact: false })).toBeVisible(); await expect(page.getByRole('button', { name: 'Finish' })).toBeVisible(); });