export function lectureFeedback(form: FormTs) {
// Lecture Feedback Form - Quick post-lecture assessment
// Demonstrates: EmojiRating, StarRating, RatingScale (likert), Slider, SuggestionChips
// ============================================
// HEADER
// ============================================
form.addRow(row => {
row.addTextPanel('header', {
label: 'Lecture Feedback',
computedValue: () => 'Quick feedback to help improve your learning experience',
customStyles: {
backgroundColor: '#059669',
color: 'white',
padding: '20px',
borderRadius: '12px',
textAlign: 'center'
}
});
});
// ============================================
// SECTION 1: Quick Overall Rating
// ============================================
const overallSection = form.addSubform('overall', {
title: 'Overall Impression'
});
overallSection.addRow(row => {
row.addEmojiRating('quickRating', {
label: 'How was this lecture overall?',
preset: 'satisfaction',
size: 'lg',
alignment: 'center'
});
});
// ============================================
// SECTION 2: Content Quality
// ============================================
const contentSection = form.addSubform('content', {
title: 'Content'
});
contentSection.addRow(row => {
row.addStarRating('contentQuality', {
label: 'Content quality and relevance',
maxStars: 5,
size: 'lg',
alignment: 'center'
});
});
contentSection.addRow(row => {
row.addStarRating('clarity', {
label: 'How clearly was the material explained?',
maxStars: 5,
size: 'md',
alignment: 'center'
}, '1fr');
row.addStarRating('examples', {
label: 'Quality of examples and illustrations',
maxStars: 5,
size: 'md',
alignment: 'center'
}, '1fr');
});
contentSection.addRow(row => {
row.addSuggestionChips('contentStrengths', {
label: 'What worked well? (select up to 3)',
suggestions: [
{ id: 'organized', name: 'Well organized' },
{ id: 'relevant', name: 'Relevant examples' },
{ id: 'visuals', name: 'Good visuals' },
{ id: 'depth', name: 'Good depth' },
{ id: 'practical', name: 'Practical focus' },
{ id: 'interesting', name: 'Interesting topic' },
{ id: 'clear', name: 'Clear explanations' },
{ id: 'connections', name: 'Connected concepts' }
],
max: 3,
alignment: 'center'
});
});
// ============================================
// SECTION 3: Instructor Delivery
// ============================================
const instructorSection = form.addSubform('instructor', {
title: 'Instructor'
});
instructorSection.addRow(row => {
row.addStarRating('instructorRating', {
label: 'Instructor performance',
maxStars: 5,
size: 'lg',
alignment: 'center'
});
});
instructorSection.addRow(row => {
row.addMatrixQuestion('instructorAspects', {
label: 'Rate the instructor on:',
rows: [
{ id: 'enthusiasm', label: 'Enthusiasm & energy' },
{ id: 'knowledge', label: 'Subject knowledge' },
{ id: 'communication', label: 'Communication skills' },
{ id: 'responsiveness', label: 'Responsive to questions' }
],
columns: [
{ id: 'weak', label: 'Weak' },
{ id: 'fair', label: 'Fair' },
{ id: 'good', label: 'Good' },
{ id: 'excellent', label: 'Excellent' }
],
fullWidth: true
});
});
// ============================================
// SECTION 4: Pace & Difficulty
// ============================================
const paceSection = form.addSubform('pace', {
title: 'Pace & Difficulty'
});
paceSection.addRow(row => {
row.addRatingScale('paceRating', {
label: 'How was the pace of the lecture?',
preset: 'custom',
min: 1,
max: 5,
lowLabel: 'Too slow',
highLabel: 'Too fast',
alignment: 'center'
});
});
paceSection.addRow(row => {
row.addTextPanel('paceNote', {
computedValue: () => {
const pace = paceSection.ratingScale('paceRating')?.value();
if (pace === 1 || pace === 2) return 'Could we move faster?';
if (pace === 4 || pace === 5) return 'Need more time to absorb the material?';
if (pace === 3) return 'Great - the pace seems right!';
return '';
},
customStyles: () => {
const pace = paceSection.ratingScale('paceRating')?.value();
if (pace === 3) return { color: '#059669', fontStyle: 'italic', textAlign: 'center' };
if (pace !== null && pace !== undefined) return { color: '#6b7280', fontStyle: 'italic', textAlign: 'center' };
return { display: 'none' };
},
isVisible: () => paceSection.ratingScale('paceRating')?.value() !== null
});
});
paceSection.addSpacer({ height: '12px' });
paceSection.addRow(row => {
row.addSlider('difficultyLevel', {
label: 'How difficult was the material?',
min: 1,
max: 5,
step: 1,
defaultValue: 3,
showValue: true
});
});
paceSection.addRow(row => {
row.addTextPanel('difficultyLabel', {
computedValue: () => {
const level = paceSection.slider('difficultyLevel')?.value();
const labels = ['', 'Very Easy', 'Easy', 'Just Right', 'Challenging', 'Very Difficult'];
return labels[level || 0] || '';
},
customStyles: {
textAlign: 'center',
fontSize: '14px',
color: '#6b7280',
marginTop: '-8px'
}
});
});
// ============================================
// SECTION 5: Engagement
// ============================================
const engagementSection = form.addSubform('engagement', {
title: 'Engagement'
});
engagementSection.addRow(row => {
row.addRadioButton('attentionLevel', {
label: 'How engaged were you during the lecture?',
options: [
{ id: 'fully', name: 'Fully engaged throughout' },
{ id: 'mostly', name: 'Engaged most of the time' },
{ id: 'sometimes', name: 'Sometimes distracted' },
{ id: 'struggled', name: 'Struggled to stay engaged' }
],
orientation: 'vertical'
});
});
engagementSection.addRow(row => {
row.addCheckboxList('distractionReasons', {
label: 'What made it hard to stay engaged?',
options: [
{ id: 'too-long', name: 'Lecture too long' },
{ id: 'monotone', name: 'Monotone delivery' },
{ id: 'confusing', name: 'Confusing content' },
{ id: 'no-breaks', name: 'No breaks' },
{ id: 'not-relevant', name: 'Not relevant to me' },
{ id: 'tired', name: 'Personal fatigue' }
],
orientation: 'vertical',
isVisible: () => {
const attention = engagementSection.radioButton('attentionLevel')?.value();
return attention === 'sometimes' || attention === 'struggled';
}
});
});
engagementSection.addRow(row => {
row.addThumbRating('interactionOpportunity', {
label: 'Were there enough opportunities to ask questions or participate?',
showLabels: true,
upLabel: 'Yes',
downLabel: 'No',
alignment: 'center'
});
});
// ============================================
// SECTION 6: Key Takeaway
// ============================================
const takeawaySection = form.addSubform('takeaway', {
title: 'Key Takeaway',
isVisible: () => contentSection.starRating('contentQuality')?.value() !== null
});
takeawaySection.addRow(row => {
row.addTextarea('mainTakeaway', {
label: 'What was your main takeaway from this lecture?',
placeholder: 'In one or two sentences, what will you remember?',
rows: 2
});
});
takeawaySection.addRow(row => {
row.addTextarea('confusedAbout', {
label: 'Anything you found confusing or would like clarified?',
placeholder: 'Optional - specific topics or concepts...',
rows: 2
});
});
// ============================================
// SECTION 7: Quick Recommendation
// ============================================
const recommendSection = form.addSubform('recommend', {
title: 'Recommendation',
isVisible: () => overallSection.emojiRating('quickRating')?.value() !== null
});
recommendSection.addRow(row => {
row.addRatingScale('recommend', {
label: 'Would you recommend this lecture to other students?',
preset: 'likert-5',
lowLabel: 'Not at all',
highLabel: 'Definitely',
alignment: 'center'
});
});
// ============================================
// SECTION 8: Summary
// ============================================
const summarySection = form.addSubform('summary', {
title: 'Your Feedback Summary',
isVisible: () => {
const content = contentSection.starRating('contentQuality')?.value();
const instructor = instructorSection.starRating('instructorRating')?.value();
return content !== null && instructor !== null;
}
});
summarySection.addRow(row => {
row.addTextPanel('summaryContent', {
computedValue: () => {
const overall = overallSection.emojiRating('quickRating')?.value();
const content = contentSection.starRating('contentQuality')?.value();
const clarity = contentSection.starRating('clarity')?.value();
const instructor = instructorSection.starRating('instructorRating')?.value();
const pace = paceSection.ratingScale('paceRating')?.value();
const difficulty = paceSection.slider('difficultyLevel')?.value();
const recommend = recommendSection.ratingScale('recommend')?.value();
const moodLabels: Record<string, string> = {
'very-bad': 'Poor',
'bad': 'Below Average',
'neutral': 'Average',
'good': 'Good',
'excellent': 'Excellent'
};
const paceLabels = ['', 'Too Slow', 'Slow', 'Just Right', 'Fast', 'Too Fast'];
const diffLabels = ['', 'Very Easy', 'Easy', 'Just Right', 'Challenging', 'Very Difficult'];
let summary = 'Lecture Feedback Summary\n';
summary += '═'.repeat(28) + '\n\n';
if (overall) {
summary += `Overall: ${moodLabels[overall] || overall}\n`;
}
if (content) {
summary += `Content: ${'★'.repeat(content)}${'☆'.repeat(5 - content)}\n`;
}
if (clarity) {
summary += `Clarity: ${'★'.repeat(clarity)}${'☆'.repeat(5 - clarity)}\n`;
}
if (instructor) {
summary += `Instructor: ${'★'.repeat(instructor)}${'☆'.repeat(5 - instructor)}\n`;
}
if (pace) {
summary += `\nPace: ${paceLabels[pace]}\n`;
}
if (difficulty) {
summary += `Difficulty: ${diffLabels[difficulty]}\n`;
}
if (recommend) {
summary += `\nWould Recommend: ${recommend}/5`;
}
return summary;
},
customStyles: () => {
const overall = overallSection.emojiRating('quickRating')?.value();
const baseStyles = {
padding: '16px',
borderRadius: '8px',
whiteSpace: 'pre-wrap',
fontFamily: 'monospace',
fontSize: '14px'
};
if (overall === 'excellent' || overall === 'good') {
return { ...baseStyles, backgroundColor: '#ecfdf5', borderLeft: '4px solid #059669' };
} else if (overall === 'very-bad' || overall === 'bad') {
return { ...baseStyles, backgroundColor: '#fef2f2', borderLeft: '4px solid #dc2626' };
}
return { ...baseStyles, backgroundColor: '#f0fdf4', borderLeft: '4px solid #059669' };
}
});
});
// ============================================
// FORM CONFIGURATION
// ============================================
form.configureSubmitButton({
label: 'Submit Feedback',
isVisible: () => {
const content = contentSection.starRating('contentQuality')?.value();
const instructor = instructorSection.starRating('instructorRating')?.value();
return content !== null && instructor !== null;
}
});
form.configureCompletionScreen({
type: 'text',
title: 'Thank you!',
message: 'Your feedback helps improve the learning experience. We appreciate you taking the time to share your thoughts.'
});
}