import { esc } from './sanitize.js';
export function renderCmsCategoryList(categories) {
if (!categories || categories.length === 0) {
return '
No categories yet
';
}
return categories.map(function(c) {
return '' +
'' +
'' +
esc(c.name) +
'' +
'' + c.content_count + '' +
'' +
'
';
}).join('');
}
export function renderCmsContentEmpty() {
return '' +
'' +
'No content yet. Click "New Content" to get started.' +
'
';
}
export function renderCmsContentRow(item) {
var statusBadge = item.published
? 'Published'
: 'Draft';
var typeLabel = item.content_type === 'quiz' ? 'Quiz'
: item.content_type === 'pearl' ? 'Pearl'
: item.content_type === 'presentation' ? 'Slides'
: 'Article';
var qBadge = item.question_count > 0
? ' ' + item.question_count + 'Q'
: '';
var date = item.updated_at ? new Date(item.updated_at).toLocaleDateString() : '';
return '' +
'' + esc(item.title) + qBadge +
'
' + esc(item.subject || '') + '' +
'' +
'' + esc(item.category_name || 'Uncategorized') + '' +
'' + typeLabel + '' +
'' + statusBadge + '' +
'' + date + '' +
'' +
'
';
}
export function renderQuestionBlockShell(existingQ, qNum) {
var qBadgeStyle = 'background:linear-gradient(135deg,var(--blue),var(--purple));color:white;' +
'font-size:12px;font-weight:700;padding:3px 10px;border-radius:6px;';
var qTextStyle = 'width:100%;font-size:14px;font-weight:500;padding:10px;' +
'border:1.5px solid var(--g300);border-radius:8px;box-sizing:border-box;' +
'margin-bottom:8px;resize:vertical;font-family:inherit;';
var qExplStyle = 'width:100%;font-size:12px;padding:6px 10px;border:1px solid var(--g300);' +
'border-radius:6px;box-sizing:border-box;resize:vertical;font-family:inherit;';
return '' +
'
' +
'Q' + qNum + '' +
'' +
'' +
'
' +
'
' +
'
' +
'' +
'' +
'' +
'
' +
'' +
'' +
'' +
'' +
'' +
'
';
}
export function renderOptionRowShell(opt) {
var optTextStyle = 'width:100%;font-size:13px;padding:6px 10px;border:1.5px solid var(--g300);' +
'border-radius:6px;box-sizing:border-box;';
var optExplStyle = 'flex:1;font-size:12px;padding:6px 10px;border:1px solid var(--g300);' +
'border-radius:6px;color:var(--g600);';
return '' +
'' +
'' +
'' +
'
' +
'' +
'';
}
function selectedQuestionType(existingQ, type) {
return existingQ && existingQ.question_type === type ? ' selected' : '';
}