forked from sent/waves
Icons for all Greetings
This commit is contained in:
parent
2e8fb40eb7
commit
66a1f208bf
|
@ -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 = `<i class="${iconClass}"></i> ${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: '<i class="fa-regular fa-sun"></i>' },
|
||||
{ text: 'Here’s to a bright morning', icon: '<i class="fa-regular fa-cloud-sun"></i>' },
|
||||
{ text: 'Morning vibes only', icon: '<i class="fa-regular fa-mug-hot"></i>' },
|
||||
{ text: 'Your day starts here', icon: '<i class="fa-regular fa-star"></i>' }
|
||||
);
|
||||
} 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: '<i class="fa-regular fa-leaf"></i>' },
|
||||
{ text: 'Hope your day is going well', icon: '<i class="fa-regular fa-coffee"></i>' },
|
||||
{ text: 'Keep up the pace', icon: '<i class="fa-regular fa-book"></i>' },
|
||||
{ text: 'Stay on track today', icon: '<i class="fa-regular fa-sun"></i>' }
|
||||
);
|
||||
} 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: '<i class="fa-regular fa-cloud-moon"></i>' },
|
||||
{ text: 'Time to unwind', icon: '<i class="fa-regular fa-fire"></i>' },
|
||||
{ text: 'Evening’s here—relax', icon: '<i class="fa-regular fa-star"></i>' },
|
||||
{ text: 'Breathe and recharge', icon: '<i class="fa-regular fa-moon"></i>' }
|
||||
);
|
||||
} 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: '<i class="fa-regular fa-bed"></i>' },
|
||||
{ text: 'Rest well', icon: '<i class="fa-regular fa-blanket"></i>' },
|
||||
{ text: 'Sweet dreams', icon: '<i class="fa-regular fa-star-and-crescent"></i>' },
|
||||
{ text: 'See you tomorrow', icon: '<i class="fa-regular fa-moon"></i>' }
|
||||
);
|
||||
}
|
||||
|
||||
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: '<i class="fa-regular fa-party-popper"></i>' },
|
||||
{ text: 'Almost Friday', icon: '<i class="fa-regular fa-music"></i>' },
|
||||
{ text: 'Keep going', icon: '<i class="fa-regular fa-thumbs-up"></i>' }
|
||||
);
|
||||
}
|
||||
|
||||
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: '<i class="fa-regular fa-umbrella-beach"></i>' },
|
||||
{ text: 'Enjoy some downtime', icon: '<i class="fa-regular fa-cocktail"></i>' }
|
||||
);
|
||||
} 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: '<i class="fa-regular fa-hand-holding-heart"></i>' },
|
||||
{ text: 'One step at a time', icon: '<i class="fa-regular fa-walking"></i>' },
|
||||
{ text: 'Summer is coming', icon: '<i class="fa-regular fa-umbrella-beach"></i>' }
|
||||
);
|
||||
}
|
||||
|
||||
return options[Math.floor(Math.random() * options.length)];
|
||||
}
|
Loading…
Reference in New Issue
Block a user