Mindfulness & Stress Management for Students
Find your calm and focus.
Guided Box Breathing
Ready?
5-4-3-2-1 Grounding Technique
This technique helps you stay present during moments of anxiety or stress.
My Mindfulness Journal
Past Entries
Your saved entries will appear here.
Your saved entries will appear here.
'; return; } journalEntries.slice().reverse().forEach(entry => { const entryEl = document.createElement('div'); entryEl.className = 'p-3 border-l-4 border-indigo-200 bg-gray-50 rounded'; entryEl.innerHTML = `${new Date(entry.date).toLocaleString()}
${entry.text}
`; journalEntriesContainer.appendChild(entryEl); }); }; saveEntryBtn.addEventListener('click', () => { const text = journalInput.value.trim(); if (!text) { showMessage('Please write something in your journal entry.', 'error'); return; } journalEntries.push({ text: text, date: new Date().toISOString() }); journalInput.value = ''; saveJournal(); renderJournal(); showMessage('Journal entry saved!', 'success'); }); // --- PDF Export --- pdfBtn.addEventListener('click', () => { if (journalEntries.length === 0) { showMessage('No journal entries to download.', 'error'); return; } const { jsPDF } = window.jspdf; const doc = new jsPDF(); doc.setFontSize(18); doc.text('My Mindfulness Journal', 105, 20, { align: 'center' }); const tableData = journalEntries.map(entry => [ new Date(entry.date).toLocaleDateString(), entry.text ]); doc.autoTable({ startY: 30, head: [['Date', 'Entry']], body: tableData, headStyles: { fillColor: [79, 70, 229] }, columnStyles: { 1: { cellWidth: 'auto' } } }); doc.save('mindfulness-journal.pdf'); }); // --- Utility --- const showMessage = (message, type = 'success') => { messageBox.textContent = message; messageBox.className = `message-box ${type} show`; setTimeout(() => { messageBox.classList.remove('show'); }, 3000); }; // Initial Load loadJournal(); });