Hydration for Exercise Planner

Hydration for Exercise Planner

Enter Your Details

Your personalized hydration plan will appear here.

Drink another ${plan.pre[1].amount}.

During-Exercise Hydration

💧

${plan.during.time}

Aim for ${plan.during.amount} to maintain performance.

Post-Exercise Rehydration

${plan.post.time}

Replenish with ${plan.post.amount} of fluid to aid recovery.

`; } function downloadPlanPDF() { const { jsPDF } = window.jspdf; const doc = new jsPDF({ unit: 'pt', format: 'a4' }); const docWidth = doc.internal.pageSize.getWidth(); const margin = 40; let currentY = margin; // Header doc.setFont('helvetica', 'bold'); doc.setFontSize(22); doc.setTextColor(79, 70, 229); doc.text('Personalized Hydration Plan', margin, currentY); currentY += 25; doc.setFont('helvetica', 'normal'); doc.setFontSize(10); doc.setTextColor(108, 117, 125); doc.text(`Plan Generated: ${new Date().toLocaleDateString('en-US')}`, margin, currentY); currentY += 40; const addSectionHeader = (title, color = [33, 37, 41]) => { doc.setFont('helvetica', 'bold'); doc.setFontSize(14); doc.setTextColor(color[0], color[1], color[2]); doc.text(title, margin, currentY); currentY += 15; doc.setDrawColor(222, 226, 230); doc.line(margin, currentY, docWidth - margin, currentY); currentY += 25; }; // Profile Section addSectionHeader('Your Profile & Activity'); doc.setFont('helvetica', 'normal'); doc.setFontSize(12); const profileData = [ ['Body Weight:', `${lastPlan.inputs.weight} lbs`], ['Workout Temperature:', `${lastPlan.inputs.temperature} °F`], ['Exercise Duration:', `${lastPlan.inputs.duration} minutes`], ['Exercise Intensity:', lastPlan.inputs.intensity] ]; profileData.forEach(item => { doc.text(item[0], margin, currentY); doc.text(item[1], margin + 150, currentY); currentY += 20; }); currentY += 20; // Plan Sections const drawPlanItem = (time, amount) => { doc.setFont('helvetica', 'bold'); doc.setFontSize(12); doc.text(time, margin + 20, currentY); doc.setFont('helvetica', 'normal'); doc.text(`Drink ${amount}`, margin + 200, currentY); currentY += 25; }; addSectionHeader('Pre-Exercise Plan', [79, 70, 229]); drawPlanItem(lastPlan.pre[0].time, lastPlan.pre[0].amount); drawPlanItem(lastPlan.pre[1].time, lastPlan.pre[1].amount); currentY += 10; addSectionHeader('During-Exercise Plan', [22, 163, 74]); drawPlanItem(lastPlan.during.time, lastPlan.during.amount); currentY += 10; addSectionHeader('Post-Exercise Plan', [37, 99, 235]); drawPlanItem(lastPlan.post.time, lastPlan.post.amount); currentY += 20; // General Tips addSectionHeader('General Hydration Tips'); doc.setFont('helvetica', 'normal'); doc.setFontSize(10); const tips = [ '- Sip, don\'t chug. Drink fluids steadily throughout the day.', '- For workouts over 60 minutes, consider a sports drink with electrolytes.', '- Monitor your urine color; pale straw or lemonade color is a good sign of hydration.', '- The most accurate way to measure post-exercise needs is to weigh yourself before and after. Drink 16-24 oz for every pound lost.' ]; tips.forEach(tip => { doc.text(tip, margin, currentY); currentY += 18; }); // Footer const pageHeight = doc.internal.pageSize.getHeight(); doc.setDrawColor(222, 226, 230); doc.line(margin, pageHeight - 30, docWidth - margin, pageHeight - 30); doc.setFontSize(8); doc.setTextColor(108, 117, 125); doc.text('This plan is a guideline based on general recommendations. Individual needs may vary.', docWidth / 2, pageHeight - 20, { align: 'center' }); doc.save('Hydration-for-Exercise-Plan.pdf'); }
Scroll to Top