1
0
forked from sent/waves

Icons for all Greetings

This commit is contained in:
𓍼 2025-04-22 22:17:23 -05:00
parent 2e8fb40eb7
commit 66a1f208bf

View File

@ -32,15 +32,15 @@ function submitName() {
} }
function updateGreeting(name) { function updateGreeting(name) {
const { text, iconClass } = getGreeting(); const { text, icon } = getGreeting();
const el = document.getElementById('greeting'); const el = document.getElementById('greeting');
if (el) { if (el) {
el.innerHTML = `<i class="${iconClass}"></i> ${text}, ${name}!`; el.innerHTML = `${icon} ${text}, ${name}!`;
el.style.opacity = 1; el.style.opacity = 1;
} }
} }
function showToast(message, type = 'success', iconType = 'check') { function showToast(message, type = 'success', iconType = 'wave') {
const toast = document.createElement('div'); const toast = document.createElement('div');
toast.className = `toast show ${type}`; toast.className = `toast show ${type}`;
const icons = { const icons = {
@ -74,53 +74,57 @@ function getGreeting() {
const hour = now.getHours(); const hour = now.getHours();
const day = now.getDay(); const day = now.getDay();
const options = []; const options = [];
if (hour >= 5 && hour < 12) { if (hour >= 5 && hour < 12) {
options.push( options.push(
{ text: 'Good morning, sunshine', iconClass: 'fa-regular fa-sun' }, { text: 'Good morning, sunshine', icon: '<i class="fa-regular fa-sun"></i>' },
{ text: 'Heres to a bright morning', iconClass: 'fa-regular fa-cloud-sun' }, { text: 'Heres to a bright morning', icon: '<i class="fa-regular fa-cloud-sun"></i>' },
{ text: 'Morning vibes only', iconClass: 'fa-regular fa-mug-hot' }, { text: 'Morning vibes only', icon: '<i class="fa-regular fa-mug-hot"></i>' },
{ text: 'Your day starts here', iconClass: 'fa-regular fa-star' } { text: 'Your day starts here', icon: '<i class="fa-regular fa-star"></i>' }
); );
} else if (hour < 17) { } else if (hour < 17) {
options.push( options.push(
{ text: 'Good afternoon', iconClass: 'fa-regular fa-leaf' }, { text: 'Good afternoon', icon: '<i class="fa-regular fa-leaf"></i>' },
{ text: 'Hope your day is going well', iconClass: 'fa-regular fa-coffee' }, { text: 'Hope your day is going well', icon: '<i class="fa-regular fa-coffee"></i>' },
{ text: 'Keep up the pace', iconClass: 'fa-regular fa-book' }, { text: 'Keep up the pace', icon: '<i class="fa-regular fa-book"></i>' },
{ text: 'Stay on track today', iconClass: 'fa-regular fa-sun' } { text: 'Stay on track today', icon: '<i class="fa-regular fa-sun"></i>' }
); );
} else if (hour < 21) { } else if (hour < 21) {
options.push( options.push(
{ text: 'Good evening', iconClass: 'fa-regular fa-cloud-moon' }, { text: 'Good evening', icon: '<i class="fa-regular fa-cloud-moon"></i>' },
{ text: 'Time to unwind', iconClass: 'fa-regular fa-fire' }, { text: 'Time to unwind', icon: '<i class="fa-regular fa-fire"></i>' },
{ text: 'Evenings here—relax', iconClass: 'fa-regular fa-star' }, { text: 'Evenings here—relax', icon: '<i class="fa-regular fa-star"></i>' },
{ text: 'Breathe and recharge', iconClass: 'fa-regular fa-moon' } { text: 'Breathe and recharge', icon: '<i class="fa-regular fa-moon"></i>' }
); );
} else { } else {
options.push( options.push(
{ text: 'Good night', iconClass: 'fa-regular fa-bed' }, { text: 'Good night', icon: '<i class="fa-regular fa-bed"></i>' },
{ text: 'Rest well', iconClass: 'fa-regular fa-sleep' }, { text: 'Rest well', icon: '<i class="fa-regular fa-blanket"></i>' },
{ text: 'Sweet dreams', iconClass: 'fa-regular fa-star-and-crescent' }, { text: 'Sweet dreams', icon: '<i class="fa-regular fa-star-and-crescent"></i>' },
{ text: 'See you tomorrow', iconClass: 'fa-regular fa-moon' } { text: 'See you tomorrow', icon: '<i class="fa-regular fa-moon"></i>' }
); );
} }
if (day === 4) { if (day === 4) {
options.push( options.push(
{ text: 'Thursday mode: engaged', iconClass: 'fa-regular fa-party-popper' }, { text: 'Thursday mode: engaged', icon: '<i class="fa-regular fa-party-popper"></i>' },
{ text: 'Almost Friday', iconClass: 'fa-regular fa-music' }, { text: 'Almost Friday', icon: '<i class="fa-regular fa-music"></i>' },
{ text: 'Keep going', iconClass: 'fa-regular fa-thumbs-up' } { text: 'Keep going', icon: '<i class="fa-regular fa-thumbs-up"></i>' }
); );
} }
if (day === 0 || day === 6) { if (day === 0 || day === 6) {
options.push( options.push(
{ text: 'Happy weekend', iconClass: 'fa-regular fa-umbrella-beach' }, { text: 'Happy weekend', icon: '<i class="fa-regular fa-umbrella-beach"></i>' },
{ text: 'Enjoy some downtime', iconClass: 'fa-regular fa-cocktail' } { text: 'Enjoy some downtime', icon: '<i class="fa-regular fa-cocktail"></i>' }
); );
} else { } else {
options.push( options.push(
{ text: 'Youve got this', iconClass: 'fa-regular fa-hand-holding-heart' }, { text: 'Youve got this', icon: '<i class="fa-regular fa-hand-holding-heart"></i>' },
{ text: 'One step at a time', iconClass: 'fa-regular fa-walking' }, { text: 'One step at a time', icon: '<i class="fa-regular fa-walking"></i>' },
{ text: 'Summer is coming', iconClass: 'fa-regular fa-umbrella-beach' } { text: 'Summer is coming', icon: '<i class="fa-regular fa-umbrella-beach"></i>' }
); );
} }
return options[Math.floor(Math.random() * options.length)]; return options[Math.floor(Math.random() * options.length)];
} }