Add birthday celebrations for students
Parents can set a birthday (MM-DD) per student in the Kids panel. During the student's birthday week (Mon–Sun), a festive overlay appears on login with balloons, birthday cake, confetti, and a personalized message — shown once per day via sessionStorage. Summer birthdays (June–Aug) show a note in admin suggesting the parent set an alternate school-week date to celebrate early. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
7f6268d6e5
commit
1eedfc7715
7 files changed
+146
-8
No files matched your search
@@ -342,6 +342,9 @@ async function openKid(id, tab = 'today', welcome = false) {
|
||||
switchTab(tab);
|
||||
if (welcome) showWelcomeToast(currentStudent.emoji, currentStudent.name);
|
||||
|
||||
// Birthday celebration — show once per day when it's the student's birthday week
|
||||
if (state.student.isBirthdayWeek) showBirthdayCelebration(state.student.name);
|
||||
|
||||
// Celebrate if all today's tasks are done
|
||||
if (agenda.tasks.length > 0) {
|
||||
const allDone = agenda.tasks.every((t) =>
|
||||
@@ -378,6 +381,23 @@ $('#celebration-close').addEventListener('click', () => {
|
||||
$('#celebration-overlay').hidden = true;
|
||||
});
|
||||
|
||||
// ---------- birthday celebration ----------
|
||||
|
||||
function showBirthdayCelebration(name) {
|
||||
const key = `bday_shown_${name}_${todayStr()}`;
|
||||
if (sessionStorage.getItem(key)) return; // only once per session per day
|
||||
sessionStorage.setItem(key, '1');
|
||||
$('#birthday-heading').textContent = `Happy Birthday, ${name}! 🎉`;
|
||||
$('#birthday-message').textContent = 'Wishing you an amazing day full of fun and joy!';
|
||||
$('#birthday-overlay').hidden = false;
|
||||
playFanfare();
|
||||
popConfetti();
|
||||
}
|
||||
|
||||
$('#birthday-close').addEventListener('click', () => {
|
||||
$('#birthday-overlay').hidden = true;
|
||||
});
|
||||
|
||||
// ---------- mini celebration (confetti + toast) ----------
|
||||
|
||||
let pendingMiniCelebration = false;
|
||||
|
||||
Reference in new issue
Block a user