Sleep-Inducing Supplement Recommender

Answer a few questions to find supplements that may support your sleep goals.

Important Medical Disclaimer

This tool is for educational purposes only and does not constitute medical advice. Supplements can have significant effects and may interact with medications. Always consult a qualified healthcare professional before starting any new supplement, especially if you are pregnant, nursing, have a medical condition, or are taking medication.

1. What is your primary sleep challenge?

2. Are any of these other factors relevant? (Optional)

Considerations:

${sup.considerations}

`; }); const resultsHTML = `

Your Potential Supplement Matches

${supplementsHTML}
`; resultsContainer.innerHTML = resultsHTML; resultsContainer.classList.remove('hidden'); document.getElementById('download-pdf-btn').addEventListener('click', downloadPdf); resultsContainer.scrollIntoView({ behavior: 'smooth' }); } function downloadPdf() { if (!recommendationData) return; const { jsPDF } = window.jspdf; const doc = new jsPDF(); // Header doc.setFontSize(22); doc.setFont('helvetica', 'bold'); doc.text('Sleep Supplement Guide', 105, 20, { align: 'center' }); // User Input Summary const primaryIssueText = recommendationData.primaryIssueText; doc.setFontSize(12); doc.text(`Primary Challenge: ${primaryIssueText}`, 14, 35); // Table of Recommendations const tableData = recommendationData.supplements.map(s => [s.name, s.desc, s.considerations]); doc.autoTable({ startY: 45, head: [['Supplement', 'Description', 'Considerations']], body: tableData, theme: 'grid', headStyles: { fillColor: [79, 70, 229] }, // Indigo columnStyles: { 1: { cellWidth: 70 }, 2: { cellWidth: 70 } } }); let finalY = doc.autoTable.previous.finalY; // Disclaimer if (finalY > 240) { doc.addPage(); finalY = 20; } doc.setFontSize(12); doc.setFont('helvetica', 'bold'); doc.setTextColor(239, 68, 68); // Red doc.text('Important Medical Disclaimer', 14, finalY + 15); doc.setFontSize(10); doc.setTextColor(0, 0, 0); // Black const disclaimerText = doc.splitTextToSize("This tool is for educational purposes only and does not constitute medical advice. Always consult a qualified healthcare professional before starting any new supplement.", 180); doc.text(disclaimerText, 14, finalY + 22); doc.save('Sleep-Supplement-Guide.pdf'); } // --- EVENT LISTENERS --- generateBtn.addEventListener('click', generateRecommendations); });
Scroll to Top