From 66a1f208bfdde2c1ac3e0ce3f35d07d268ccc5e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=F0=93=8D=BC?= <143974574+xojw@users.noreply.github.com> Date: Tue, 22 Apr 2025 22:17:23 -0500 Subject: [PATCH] Icons for all Greetings --- public/assets/js/greetings.js | 58 +++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 27 deletions(-) diff --git a/public/assets/js/greetings.js b/public/assets/js/greetings.js index f065687b..0b9a4366 100644 --- a/public/assets/js/greetings.js +++ b/public/assets/js/greetings.js @@ -32,15 +32,15 @@ function submitName() { } function updateGreeting(name) { - const { text, iconClass } = getGreeting(); + const { text, icon } = getGreeting(); const el = document.getElementById('greeting'); if (el) { - el.innerHTML = ` ${text}, ${name}!`; + el.innerHTML = `${icon} ${text}, ${name}!`; el.style.opacity = 1; } } -function showToast(message, type = 'success', iconType = 'check') { +function showToast(message, type = 'success', iconType = 'wave') { const toast = document.createElement('div'); toast.className = `toast show ${type}`; const icons = { @@ -74,53 +74,57 @@ function getGreeting() { const hour = now.getHours(); const day = now.getDay(); const options = []; + if (hour >= 5 && hour < 12) { options.push( - { text: 'Good morning, sunshine', iconClass: 'fa-regular fa-sun' }, - { text: 'Here’s to a bright morning', iconClass: 'fa-regular fa-cloud-sun' }, - { text: 'Morning vibes only', iconClass: 'fa-regular fa-mug-hot' }, - { text: 'Your day starts here', iconClass: 'fa-regular fa-star' } + { text: 'Good morning, sunshine', icon: '' }, + { text: 'Here’s to a bright morning', icon: '' }, + { text: 'Morning vibes only', icon: '' }, + { text: 'Your day starts here', icon: '' } ); } else if (hour < 17) { options.push( - { text: 'Good afternoon', iconClass: 'fa-regular fa-leaf' }, - { text: 'Hope your day is going well', iconClass: 'fa-regular fa-coffee' }, - { text: 'Keep up the pace', iconClass: 'fa-regular fa-book' }, - { text: 'Stay on track today', iconClass: 'fa-regular fa-sun' } + { text: 'Good afternoon', icon: '' }, + { text: 'Hope your day is going well', icon: '' }, + { text: 'Keep up the pace', icon: '' }, + { text: 'Stay on track today', icon: '' } ); } else if (hour < 21) { options.push( - { text: 'Good evening', iconClass: 'fa-regular fa-cloud-moon' }, - { text: 'Time to unwind', iconClass: 'fa-regular fa-fire' }, - { text: 'Evening’s here—relax', iconClass: 'fa-regular fa-star' }, - { text: 'Breathe and recharge', iconClass: 'fa-regular fa-moon' } + { text: 'Good evening', icon: '' }, + { text: 'Time to unwind', icon: '' }, + { text: 'Evening’s here—relax', icon: '' }, + { text: 'Breathe and recharge', icon: '' } ); } else { options.push( - { text: 'Good night', iconClass: 'fa-regular fa-bed' }, - { text: 'Rest well', iconClass: 'fa-regular fa-sleep' }, - { text: 'Sweet dreams', iconClass: 'fa-regular fa-star-and-crescent' }, - { text: 'See you tomorrow', iconClass: 'fa-regular fa-moon' } + { text: 'Good night', icon: '' }, + { text: 'Rest well', icon: '' }, + { text: 'Sweet dreams', icon: '' }, + { text: 'See you tomorrow', icon: '' } ); } + if (day === 4) { options.push( - { text: 'Thursday mode: engaged', iconClass: 'fa-regular fa-party-popper' }, - { text: 'Almost Friday', iconClass: 'fa-regular fa-music' }, - { text: 'Keep going', iconClass: 'fa-regular fa-thumbs-up' } + { text: 'Thursday mode: engaged', icon: '' }, + { text: 'Almost Friday', icon: '' }, + { text: 'Keep going', icon: '' } ); } + if (day === 0 || day === 6) { options.push( - { text: 'Happy weekend', iconClass: 'fa-regular fa-umbrella-beach' }, - { text: 'Enjoy some downtime', iconClass: 'fa-regular fa-cocktail' } + { text: 'Happy weekend', icon: '' }, + { text: 'Enjoy some downtime', icon: '' } ); } else { options.push( - { text: 'You’ve got this', iconClass: 'fa-regular fa-hand-holding-heart' }, - { text: 'One step at a time', iconClass: 'fa-regular fa-walking' }, - { text: 'Summer is coming', iconClass: 'fa-regular fa-umbrella-beach' } + { text: 'You’ve got this', icon: '' }, + { text: 'One step at a time', icon: '' }, + { text: 'Summer is coming', icon: '' } ); } + return options[Math.floor(Math.random() * options.length)]; } \ No newline at end of file