Content Pillars
${(contentStrategy.pillars && contentStrategy.pillars.length > 0) ? contentStrategy.pillars.map(p => `- ${p}
`).join('') : '- Not provided
'}
Sample Weekly Schedule
- Monday:
- ${contentStrategy.schedule?.Monday || 'N/A'}
- Tuesday:
- ${contentStrategy.schedule?.Tuesday || 'N/A'}
- Wednesday:
- ${contentStrategy.schedule?.Wednesday || 'N/A'}
- Thursday:
- ${contentStrategy.schedule?.Thursday || 'N/A'}
- Friday:
- ${contentStrategy.schedule?.Friday || 'N/A'}
`;
elements.reviewContent.innerHTML = html;
}
function downloadPdf() {
const { jsPDF } = window.jspdf;
const doc = new jsPDF();
doc.setFont('helvetica', 'bold');
doc.setFontSize(22);
doc.text('Content Strategy Plan', doc.internal.pageSize.getWidth() / 2, 20, { align: 'center' });
let currentY = 35;
const margin = 14;
const maxWidth = doc.internal.pageSize.getWidth() - margin * 2;
function addSection(title, text) {
if (currentY > 260) doc.addPage();
doc.setFont('helvetica', 'bold');
doc.setFontSize(14);
doc.text(title, margin, currentY);
currentY += 7;
doc.setFont('helvetica', 'normal');
doc.setFontSize(12);
const splitText = doc.splitTextToSize(text, maxWidth);
doc.text(splitText, margin, currentY);
currentY += (splitText.length * 7) + 10;
}
addSection('Target Audience', contentStrategy.audience || 'Not provided');
addSection('Content Goals', contentStrategy.goals || 'Not provided');
doc.setFont('helvetica', 'bold');
doc.setFontSize(14);
doc.text('Content Pillars', margin, currentY);
currentY += 7;
doc.setFont('helvetica', 'normal');
doc.setFontSize(12);
(contentStrategy.pillars && contentStrategy.pillars.length > 0 ? contentStrategy.pillars : ['Not provided']).forEach(p => {
doc.text(`• ${p}`, margin, currentY);
currentY += 7;
});
currentY += 5;
doc.autoTable({
startY: currentY,
head: [['Day', 'Content Idea']],
body: Object.entries(contentStrategy.schedule || {}).map(([day, idea]) => [day, idea || 'N/A']),
theme: 'grid',
headStyles: { fillColor: [79, 70, 229] }
});
doc.save('content-strategy-plan.pdf');
}
// --- Event Listeners ---
elements.btnNext.addEventListener('click', () => {
saveStepData();
if (currentStep < totalSteps) {
currentStep++;
if (currentStep === totalSteps) {
populateReview();
}
updateUI();
}
});
elements.btnPrev.addEventListener('click', () => {
if (currentStep > 1) {
currentStep--;
updateUI();
}
});
elements.stepIndicators.forEach(indicator => {
indicator.addEventListener('click', (e) => {
const targetStep = parseInt(e.target.dataset.step);
// Only allow jumping to previous steps or the next available step
if (targetStep <= currentStep) {
saveStepData();
currentStep = targetStep;
updateUI();
}
});
});
elements.btnDownloadPdf.addEventListener('click', downloadPdf);
// --- Initial Load ---
updateUI();
});