Self-Reflection Writing Tool

Self-Reflection Writing Tool

A guided journey to deeper insights.

Your Completed Reflection

Your final reflection will be displayed here.

What area of your life would you like to reflect on today?

Personal Growth

Career & Work

Relationships

Future Aspirations

Answer These Prompts

Please select a focus area first.

Review and Refine

Your answers have been combined below. Feel free to edit, add transitions, and write a concluding thought to complete your reflection.

Please select a focus area first.

'; return; } questionsContainer.innerHTML = ''; questionsData[selectedFocus].forEach((q, index) => { const questionEl = document.createElement('div'); questionEl.innerHTML = ` `; questionsContainer.appendChild(questionEl); }); } function compileAnswers() { const answers = document.querySelectorAll('.question-answer'); let combinedText = `Reflection on: ${selectedFocus.replace(/([A-Z])/g, ' $1').replace(/^./, str => str.toUpperCase())}\n\n`; answers.forEach((answerEl, index) => { const questionText = questionsData[selectedFocus][index]; combinedText += `Q: ${questionText}\nA: ${answerEl.value.trim()}\n\n`; }); finalReflectionText.value = combinedText; } function finalizeAndShow() { const finalContent = finalReflectionText.value.trim(); if (finalContent) { reflectionOutputContent.innerText = finalContent; downloadPdfBtn.classList.remove('hidden'); } else { reflectionOutputContent.innerHTML = '

Your final reflection will be displayed here.

'; downloadPdfBtn.classList.add('hidden'); } showTab(0); // Go to Dashboard } function downloadPdf() { const { jsPDF } = window.jspdf; const text = reflectionOutputContent.innerText; const pdf = new jsPDF({ orientation: 'portrait', unit: 'in', format: 'letter' }); const pdfWidth = pdf.internal.pageSize.getWidth(); const margin = 0.75; const contentWidth = pdfWidth - (margin * 2); pdf.setFontSize(12); pdf.setFont('times', 'normal'); pdf.text(`My Self-Reflection`, margin, margin); const secondaryColor = getComputedStyle(document.documentElement).getPropertyValue('--secondary-color').trim(); pdf.setDrawColor(secondaryColor); pdf.line(margin, margin + 0.1, pdfWidth - margin, margin + 0.1); const lines = pdf.splitTextToSize(text, contentWidth); pdf.text(lines, margin, margin + 0.5); pdf.save('My_Self_Reflection.pdf'); } // --- Event Listeners --- tabs.forEach((tab, index) => { tab.addEventListener('click', () => { // Prevent jumping ahead if certain conditions aren't met if (index === 2 && !selectedFocus) return; // Need focus area for questions if (index === 3 && document.querySelectorAll('.question-answer').length === 0) return; // Need questions showTab(index); }); }); nextBtn.addEventListener('click', () => { if (currentTabIndex < totalInputTabs - 1) { if (currentTabIndex === 1 && !selectedFocus) { const focusTitle = document.querySelector('#focusArea h2'); if (focusTitle && !focusTitle.dataset.error) { focusTitle.dataset.error = true; const originalColor = focusTitle.style.color; focusTitle.style.color = 'red'; focusTitle.style.transition = 'color 0.3s'; setTimeout(() => { focusTitle.style.color = originalColor; delete focusTitle.dataset.error; }, 2000); } return; } if (currentTabIndex === 2) { compileAnswers(); } showTab(currentTabIndex + 1); } else if (currentTabIndex === 3) { finalizeAndShow(); } }); prevBtn.addEventListener('click', () => { if (currentTabIndex > 1) { showTab(currentTabIndex - 1); } }); focusOptionsContainer.addEventListener('click', handleFocusSelection); downloadPdfBtn.addEventListener('click', downloadPdf); // --- Initial State --- showTab(currentTabIndex); });
Scroll to Top