Mindfulness-Based Productivity Tracker

Mindfulness-Based Productivity Tracker

New Session Log

Pre-Session Check-in

Work Log

Sleep Context (Previous Night)

Post-Session Reflection

Recent Session Logs

DateIntentionPre-AwarenessFocusPresenceWanderedPost-FeelingActions

Note: Log data is stored in your browser's LocalStorage.

Dashboard Filters

Well-Being Averages (Selected Period)

  • No data in selected range.

Log work sessions and select a date range to view the dashboard.

Key Insights & Gentle Reminders

  • No data to analyze.

Analysis Period: ${analysisStartDate} to ${analysisEndDate}

`; const avgSummaryContent = document.getElementById('mbpt-average-summary-list').outerHTML; if(avgSummaryContent) pdfHTML += `

Well-Being Averages (Selected Period)

${avgSummaryContent}`; const chartsToInclude = [ {instance: mbptChartInstances['mbpt-awareness-chart'], title: "Mindful Awareness (Pre-Session)"}, {instance: mbptChartInstances['mbpt-focus-chart'], title: "Focus Level (In-Session)"}, {instance: mbptChartInstances['mbpt-presence-chart'], title: "Presence Level (In-Session)"}, {instance: mbptChartInstances['mbpt-wandering-chart'], title: "Mind Wandering Count"}, {instance: mbptChartInstances['mbpt-sleep-chart'], title: "Sleep Quality & Hours"} ]; chartsToInclude.forEach(chartInfo => { if(chartInfo.instance){ try { pdfHTML += `

${chartInfo.title}

`; } catch (e) { console.error("Error converting chart to image for PDF: ", chartInfo.title, e); } } }); const insightsContent = document.getElementById('mbpt-insights-list').outerHTML; if(insightsContent) pdfHTML += `

Key Insights & Gentle Reminders

${insightsContent}
`; const filteredLogsForPDF = mbptSessionLogs.filter(log => { const logDateOnly = log.datetime.toISOString().split('T')[0]; return logDateOnly >= analysisStartDate && logDateOnly <= analysisEndDate; }); if (filteredLogsForPDF.length > 0 && confirm("Include detailed session logs in PDF? This can make the PDF long.")) { pdfHTML += `

Detailed Session Logs (${analysisStartDate} to ${analysisEndDate})

`; pdfHTML += ``; filteredLogsForPDF.forEach(log => { pdfHTML += ``; }); pdfHTML += `
DateIntentionPre-AwareFocusPresenceWanderedSleep(H)Sleep(Q)Post-FeelingNotes
${log.datetime.toLocaleString([],{dateStyle:'short',timeStyle:'short'})}${log.intention.substring(0,20)}...${log.preAwareness} ${log.focusLevel}${log.presenceLevel}${log.mindWandering} ${log.sleepHours.toFixed(1)}${log.sleepQuality}${log.postFeeling} ${log.generalNotes.substring(0,30)}${log.generalNotes.length > 30 ? '...' : ''}
`; } const pdfContainer = document.getElementById('mbpt-report-content-for-pdf'); pdfContainer.innerHTML = pdfHTML; const opt = { margin: [0.5, 0.4, 0.5, 0.4], filename: `Mindful_Productivity_Report_${analysisStartDate}_to_${analysisEndDate}.pdf`, image: { type: 'jpeg', quality: 0.98 }, html2canvas: { scale: 2, useCORS: true, logging: false, scrollX:0, scrollY: -window.scrollY, windowWidth: pdfContainer.scrollWidth + 100 }, jsPDF: { unit: 'in', format: 'letter', orientation: 'portrait' }, pagebreak: { mode: ['avoid-all', 'css', 'legacy'] } }; html2pdf().from(pdfContainer).set(opt).save().then(() => { pdfContainer.innerHTML = ''; }).catch(err => { console.error("Error generating PDF:", err); pdfContainer.innerHTML = ''; alert("An error occurred while generating the PDF. Check console for details."); }); }
Scroll to Top