export function pulseWeeklySurvey(form: FormTs) {
// Weekly Pulse Check - Employee engagement and wellbeing tracker
// Demonstrates: EmojiRating, Slider, StarRating, RatingScale, MatrixQuestion, ThumbRating, SuggestionChips
// ============================================
// HEADER
// ============================================
form.addRow(row => {
row.addTextPanel('header', {
label: 'Weekly Pulse Check',
computedValue: () => 'Quick check-in to see how you\'re doing this week.',
customStyles: {
background: 'linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%)',
color: 'white',
padding: '24px',
borderRadius: '12px',
textAlign: 'center'
}
});
});
// ============================================
// SECTION 1: Mood & Energy
// ============================================
const moodSection = form.addSubform('moodSection', {
title: 'How Are You Feeling?',
customStyles: { backgroundColor: '#faf5ff', padding: '16px', borderRadius: '8px' }
});
moodSection.addRow(row => {
row.addEmojiRating('mood', {
label: 'Overall mood this week',
preset: 'satisfaction',
size: 'lg',
showLabels: true,
alignment: 'center'
});
});
moodSection.addRow(row => {
row.addEmojiRating('energy', {
label: 'Energy level',
preset: 'effort',
size: 'lg',
showLabels: true,
alignment: 'center'
});
});
// ============================================
// SECTION 2: Workload Assessment
// ============================================
const workloadSection = form.addSubform('workloadSection', {
title: 'Workload & Stress',
customStyles: () => {
const workload = workloadSection.slider('workload')?.value() ?? 5;
if (workload >= 8) return { backgroundColor: '#fee2e2', padding: '16px', borderRadius: '8px' };
if (workload <= 3) return { backgroundColor: '#dbeafe', padding: '16px', borderRadius: '8px' };
return { backgroundColor: '#f0fdf4', padding: '16px', borderRadius: '8px' };
}
});
workloadSection.addRow(row => {
row.addSlider('workload', {
label: () => {
const val = workloadSection.slider('workload')?.value() ?? 5;
if (val >= 8) return 'Workload level (Very Heavy!)';
if (val >= 6) return 'Workload level (Manageable but busy)';
if (val <= 3) return 'Workload level (Could take on more)';
return 'Workload level (Just right)';
},
min: 1,
max: 10,
defaultValue: 5,
showValue: true,
unit: '/10'
});
});
workloadSection.addRow(row => {
row.addSlider('stress', {
label: 'Stress level this week',
min: 1,
max: 10,
defaultValue: 5,
showValue: true,
unit: '/10'
});
});
// High stress follow-up
workloadSection.addRow(row => {
row.addTextarea('stressReason', {
label: 'What\'s contributing to your stress?',
placeholder: 'Share what\'s on your mind - this helps us support you better...',
rows: 2,
autoExpand: true,
isVisible: () => (workloadSection.slider('stress')?.value() ?? 0) >= 7
});
});
// ============================================
// SECTION 3: Team & Collaboration
// ============================================
const teamSection = form.addSubform('teamSection', {
title: 'Team & Collaboration'
});
teamSection.addRow(row => {
row.addRatingScale('teamCollaboration', {
preset: 'likert-5',
label: 'How well is your team collaborating?',
lowLabel: 'Poorly',
highLabel: 'Excellently',
alignment: 'center'
});
});
teamSection.addRow(row => {
row.addThumbRating('managerSupport', {
label: 'Do you feel supported by your manager?',
showLabels: true,
upLabel: 'Yes, supported',
downLabel: 'Need more support',
alignment: 'center'
});
});
// Follow-up for lack of support
teamSection.addRow(row => {
row.addTextarea('supportNeeded', {
label: 'What kind of support would help?',
placeholder: 'Let us know how we can better support you...',
rows: 2,
isVisible: () => teamSection.thumbRating('managerSupport')?.value() === 'down'
});
});
// ============================================
// SECTION 4: Work Aspects Matrix
// ============================================
const aspectsSection = form.addSubform('aspectsSection', {
title: 'Rate Your Week'
});
aspectsSection.addRow(row => {
row.addMatrixQuestion('weeklyAspects', {
label: 'How would you rate these aspects of your work this week?',
rows: [
{ id: 'productivity', label: 'Productivity', isRequired: true },
{ id: 'focus', label: 'Ability to focus' },
{ id: 'worklife', label: 'Work-life balance' },
{ id: 'motivation', label: 'Motivation' },
{ id: 'communication', label: 'Team communication' }
],
columns: [
{ id: '1', label: 'Poor' },
{ id: '2', label: 'Fair' },
{ id: '3', label: 'Good' },
{ id: '4', label: 'Great' },
{ id: '5', label: 'Excellent' }
],
striped: true,
fullWidth: true
});
});
// ============================================
// SECTION 5: Highlights & Challenges
// ============================================
const highlightsSection = form.addSubform('highlightsSection', {
title: 'Week Highlights & Challenges'
});
highlightsSection.addRow(row => {
row.addSuggestionChips('highlights', {
label: 'What went well this week? (select all that apply)',
suggestions: [
{ id: 'completed', name: 'Completed key tasks' },
{ id: 'learned', name: 'Learned something new' },
{ id: 'helped', name: 'Helped a colleague' },
{ id: 'recognition', name: 'Received recognition' },
{ id: 'progress', name: 'Made progress on goals' },
{ id: 'meeting', name: 'Productive meetings' },
{ id: 'creativity', name: 'Creative breakthroughs' },
{ id: 'balance', name: 'Good work-life balance' }
],
alignment: 'left'
});
});
highlightsSection.addRow(row => {
row.addSuggestionChips('challenges', {
label: 'What challenges did you face?',
suggestions: [
{ id: 'workload', name: 'Too much work' },
{ id: 'unclear', name: 'Unclear priorities' },
{ id: 'blockers', name: 'Blocked by others' },
{ id: 'meetings', name: 'Too many meetings' },
{ id: 'tech', name: 'Technical issues' },
{ id: 'communication', name: 'Communication gaps' },
{ id: 'resources', name: 'Lack of resources' },
{ id: 'motivation', name: 'Low motivation' }
],
alignment: 'left'
});
});
// ============================================
// SECTION 6: Overall Week Rating
// ============================================
const overallSection = form.addSubform('overallSection', {
title: 'Overall Week',
customStyles: () => {
const rating = overallSection.starRating('weekRating')?.value() ?? 0;
if (rating >= 4) return { backgroundColor: '#d1fae5', padding: '16px', borderRadius: '8px' };
if (rating <= 2 && rating > 0) return { backgroundColor: '#fee2e2', padding: '16px', borderRadius: '8px' };
return { padding: '16px' };
}
});
overallSection.addRow(row => {
row.addStarRating('weekRating', {
label: 'How would you rate your week overall?',
maxStars: 5,
size: 'xl',
alignment: 'center',
showConfettiOnMax: true
});
});
overallSection.addRow(row => {
row.addTextarea('additionalComments', {
label: () => {
const rating = overallSection.starRating('weekRating')?.value() ?? 0;
if (rating >= 4) return 'Anything else you\'d like to share about your great week?';
if (rating <= 2 && rating > 0) return 'What could have made this week better?';
return 'Any additional comments?';
},
placeholder: 'Optional thoughts or feedback...',
rows: 2,
autoExpand: true
});
});
// ============================================
// SECTION 7: Summary
// ============================================
const summarySection = form.addSubform('summarySection', {
title: 'Your Pulse Summary',
isVisible: () => {
const mood = moodSection.emojiRating('mood')?.value();
const rating = overallSection.starRating('weekRating')?.value();
return mood !== null || (rating !== null && rating !== undefined && rating > 0);
}
});
summarySection.addRow(row => {
row.addTextPanel('summary', {
computedValue: () => {
const mood = moodSection.emojiRating('mood')?.value();
const energy = moodSection.emojiRating('energy')?.value();
const workload = workloadSection.slider('workload')?.value() ?? 5;
const stress = workloadSection.slider('stress')?.value() ?? 5;
const weekRating = overallSection.starRating('weekRating')?.value() ?? 0;
const highlights = highlightsSection.suggestionChips('highlights')?.value() || [];
const challenges = highlightsSection.suggestionChips('challenges')?.value() || [];
const moodLabels: Record<string, string> = {
'very-bad': 'Very Low', 'bad': 'Low', 'neutral': 'Neutral',
'good': 'Good', 'excellent': 'Great'
};
const energyLabels: Record<string, string> = {
'very-easy': 'Very High', 'easy': 'High', 'moderate': 'Moderate',
'difficult': 'Low', 'very-difficult': 'Very Low'
};
let summary = 'Weekly Pulse Summary\n';
summary += '═'.repeat(25) + '\n\n';
if (mood) summary += `Mood: ${moodLabels[mood] || mood}\n`;
if (energy) summary += `Energy: ${energyLabels[energy] || energy}\n`;
summary += `Workload: ${workload}/10\n`;
summary += `Stress: ${stress}/10\n`;
if (weekRating > 0) summary += `Week Rating: ${'★'.repeat(weekRating)}${'☆'.repeat(5 - weekRating)}\n`;
if (highlights.length > 0) summary += `\nHighlights: ${highlights.length} items`;
if (challenges.length > 0) summary += `\nChallenges: ${challenges.length} items`;
return summary;
},
customStyles: {
backgroundColor: '#f8fafc',
padding: '16px',
borderRadius: '8px',
whiteSpace: 'pre-wrap',
fontFamily: 'monospace',
fontSize: '13px',
borderLeft: '4px solid #8b5cf6'
}
});
});
// ============================================
// FORM CONFIGURATION
// ============================================
form.configureSubmitButton({
label: 'Submit Pulse Check'
});
form.configureCompletionScreen({
type: 'text',
title: 'Thanks for checking in!',
message: 'Your pulse feedback helps us understand how the team is doing and where we can improve. Have a great week!'
});
}