Decisions Made
${data.decisions.length > 0 ? `
${data.decisions.map(item => `- ${item}
`).join('')}
` : '
No decisions were identified.
'}
`;
summaryOutput.innerHTML = html;
};
/**
* Generates and triggers the download of a PDF summary.
*/
const generatePDF = () => {
const text = meetingNotesInput.value.trim();
if (!text) {
alert("Cannot generate PDF, no notes found.");
return;
}
const lines = text.split('\n');
const actionItems = [];
const decisions = [];
const summary = lines.filter(line => line.trim() !== '').slice(0, 3).join(' ');
lines.forEach(line => {
const lowerLine = line.trim().toLowerCase();
if (ACTION_ITEM_KEYWORDS.some(keyword => lowerLine.startsWith(keyword))) {
actionItems.push([line.trim()]); // Wrap in array for autoTable
}
if (DECISION_KEYWORDS.some(keyword => lowerLine.startsWith(keyword))) {
decisions.push([line.trim()]); // Wrap in array for autoTable
}
});
const { jsPDF } = jspdf;
const doc = new jsPDF();
let lastY = 25;
// --- PDF Content ---
doc.setFontSize(20);
doc.setTextColor('#1f2937'); // gray-800
doc.text('Meeting Notes Summary', 105, 20, { align: 'center' });
doc.setFontSize(14);
doc.setFont(undefined, 'bold');
doc.text('Summary', 14, lastY + 10);
doc.setFontSize(11);
doc.setFont(undefined, 'normal');
const summaryText = doc.splitTextToSize(summary, 180);
doc.text(summaryText, 14, lastY + 18);
lastY += 18 + (summaryText.length * 5);
if (actionItems.length > 0) {
doc.autoTable({
startY: lastY + 5,
head: [['Action Items']],
body: actionItems,
theme: 'grid',
headStyles: { fillColor: '#4f46e5' } // indigo-600
});
lastY = doc.autoTable.previous.finalY;
}
if (decisions.length > 0) {
doc.autoTable({
startY: lastY + 10,
head: [['Decisions Made']],
body: decisions,
theme: 'grid',
headStyles: { fillColor: '#16a34a' } // green-600
});
}
doc.save('Meeting-Summary.pdf');
};
// --- Initial Setup ---
const setupInitialData = () => {
meetingNotesInput.value = `Q3 Marketing Campaign Kick-off
Project Phoenix is on track. We discussed the main objectives for the upcoming quarter.
The primary goal is to increase user engagement by 15%.
Decision: We have approved the budget of $25,000 for social media advertising.
Agreed: The campaign will launch on September 1st.
Action Item: Sarah to finalize the ad creatives by next Friday.
TODO: Mark needs to coordinate with the sales team to align messaging.
Assign to John: Prepare the analytics dashboard to track campaign performance.
`;
};
// --- Event Listeners ---
summarizeBtn.addEventListener('click', processNotes);
downloadPdfBtn.addEventListener('click', generatePDF);
// --- Initial Call ---
setupInitialData();
});