Pomodoro Technique Session Log & Reflection

Pomodoro Session Log & Reflection

Log New Session

Log for Date:

Your logged sessions for the selected date will appear here.

About the Pomodoro Technique

The Pomodoro Technique is a time management method developed by Francesco Cirillo. It uses a timer to break down work into intervals, traditionally 25 minutes in length, separated by short breaks. Each interval is known as a pomodoro, from the Italian word for 'tomato'.

The Core Steps:

  1. Choose a task you want to work on.
  2. Set a timer for 25 minutes (one "Pomodoro").
  3. Work on the task with undivided focus until the timer rings.
  4. Take a short break (around 5 minutes).
  5. After four Pomodoros, take a longer break (15-30 minutes).

How to Use This Log

This tool is not a timer, but a log to track and reflect on your sessions. After completing one or more Pomodoros for a task, use the form on the "Session Log" tab to record your progress, note any distractions, and reflect on your focus and productivity. This practice helps you identify patterns and improve your work habits over time.

No sessions logged for this date.

`; return; } entriesForDate.forEach((entry) => { const entryDiv = document.createElement('div'); entryDiv.className = 'ptsl-log-entry'; entryDiv.dataset.id = entry.id; // Sanitize output by creating text nodes const createTextNode = (text) => document.createTextNode(text || ''); const header = document.createElement('div'); header.className = 'ptsl-entry-header'; const titleDiv = document.createElement('div'); const titleH4 = document.createElement('h4'); titleH4.appendChild(createTextNode(entry.taskName)); const pomsP = document.createElement('p'); pomsP.className = 'ptsl-entry-poms'; pomsP.appendChild(createTextNode(`${entry.pomodoros} Pomodoro(s)`)); titleDiv.appendChild(titleH4); titleDiv.appendChild(pomsP); const deleteBtn = document.createElement('button'); deleteBtn.type = 'button'; deleteBtn.className = 'ptsl-btn-delete'; deleteBtn.textContent = 'Delete'; deleteBtn.onclick = () => deleteSession(entry.id); header.appendChild(titleDiv); header.appendChild(deleteBtn); const bodyDiv = document.createElement('div'); bodyDiv.className = 'ptsl-entry-body'; const distractionsP = document.createElement('p'); const distractionsStrong = document.createElement('strong'); distractionsStrong.textContent = 'Distractions: '; distractionsP.appendChild(distractionsStrong); distractionsP.appendChild(createTextNode(entry.distractions)); const reflectionP = document.createElement('p'); const reflectionStrong = document.createElement('strong'); reflectionStrong.textContent = 'Reflection: '; reflectionP.appendChild(reflectionStrong); reflectionP.appendChild(createTextNode(entry.reflection)); bodyDiv.appendChild(distractionsP); bodyDiv.appendChild(reflectionP); entryDiv.appendChild(header); entryDiv.appendChild(bodyDiv); logEntriesContainer.appendChild(entryDiv); }); } function addSession() { const taskName = taskNameInput.value.trim(); const pomodoros = parseInt(pomodorosInput.value, 10); if (!taskName) { alert('Please enter a task name.'); return; } if (isNaN(pomodoros) || pomodoros < 1) { alert('Please enter a valid number of Pomodoros (1 or more).'); return; } const newSession = { id: Date.now(), date: logDateInput.value, taskName: taskName, pomodoros: pomodoros, distractions: distractionsInput.value.trim(), reflection: reflectionInput.value.trim(), }; sessionLog.push(newSession); saveToStorage(); renderLogEntries(); // Reset form taskNameInput.value = ''; pomodorosInput.value = '1'; distractionsInput.value = ''; reflectionInput.value = ''; } function deleteSession(id) { if (confirm('Are you sure you want to delete this session log?')) { sessionLog = sessionLog.filter(entry => entry.id !== id); saveToStorage(); renderLogEntries(); } } // --- PDF DOWNLOAD --- async function downloadPdf() { if (typeof jspdf === 'undefined' || typeof html2canvas === 'undefined') { alert('PDF libraries are still loading. Please try again.'); return; } const entriesForDate = sessionLog.filter(entry => entry.date === logDateInput.value); if (entriesForDate.length === 0) { alert('There are no log entries for this date to download.'); return; } const { jsPDF } = jspdf; const pdf = new jsPDF({ orientation: 'p', unit: 'pt', format: 'a4' }); // Create a temporary, printable version of the log const tempPrintDiv = document.createElement('div'); const header = document.createElement('div'); header.className = 'ptsl-pdf-header'; header.innerHTML = `

Pomodoro Log: ${logDateInput.value}

`; tempPrintDiv.appendChild(header); const originalContent = logEntriesContainer.cloneNode(true); // Remove delete buttons for PDF originalContent.querySelectorAll('.ptsl-btn-delete').forEach(btn => btn.remove()); tempPrintDiv.appendChild(originalContent); // Hide original container and show temp for rendering printableArea.style.display = 'none'; document.body.appendChild(tempPrintDiv); try { const canvas = await html2canvas(tempPrintDiv, { scale: 2 }); const imgData = canvas.toDataURL('image/png'); const pdfWidth = pdf.internal.pageSize.getWidth(); const imgProps = pdf.getImageProperties(imgData); const pdfHeight = (imgProps.height * pdfWidth) / imgProps.width; pdf.addImage(imgData, 'PNG', 0, 0, pdfWidth, pdfHeight); pdf.save(`Pomodoro_Log_${logDateInput.value}.pdf`); } catch (err) { console.error("PDF generation failed:", err); alert("An error occurred during PDF creation."); } finally { // Cleanup document.body.removeChild(tempPrintDiv); printableArea.style.display = 'block'; } } // --- INITIALIZATION --- function getTodayDateString() { const today = new Date(); const year = today.getFullYear(); const month = String(today.getMonth() + 1).padStart(2, '0'); const day = String(today.getDate()).padStart(2, '0'); return `${year}-${month}-${day}`; } function attachEventListeners() { if (saveSessionBtn) saveSessionBtn.addEventListener('click', addSession); if (logDateInput) logDateInput.addEventListener('change', renderLogEntries); if (pdfDownloadBtn) pdfDownloadBtn.addEventListener('click', downloadPdf); } function initialize() { if (!logDateInput) { console.error("Critical element 'logDateInput' not found."); return; } logDateInput.value = getTodayDateString(); loadFromStorage(); attachEventListeners(); renderLogEntries(); updatePtslNavButtons(); } // --- START THE APP --- initialize();
Scroll to Top