feature: send thankscard page
This commit is contained in:
@@ -141,14 +141,47 @@
|
||||
closeBtn.addEventListener('click', closeSidebar);
|
||||
overlay.addEventListener('click', closeSidebar);
|
||||
}
|
||||
|
||||
// Client-side flash message support
|
||||
const flashSuccess = localStorage.getItem('flash_success');
|
||||
if (flashSuccess) {
|
||||
window.showToast(flashSuccess, 'success');
|
||||
localStorage.removeItem('flash_success');
|
||||
}
|
||||
const flashError = localStorage.getItem('flash_error');
|
||||
if (flashError) {
|
||||
window.showToast(flashError, 'error');
|
||||
localStorage.removeItem('flash_error');
|
||||
}
|
||||
});
|
||||
|
||||
window.showToast = function(message) {
|
||||
window.showToast = function(message, type = 'success') {
|
||||
const toast = document.getElementById('global-toast');
|
||||
if (!toast) return;
|
||||
|
||||
const msgEl = toast.querySelector('.text-sm');
|
||||
if (msgEl) msgEl.textContent = message;
|
||||
|
||||
// Dynamically set theme styling and icon
|
||||
const iconContainer = toast.querySelector('.shrink-0');
|
||||
if (iconContainer) {
|
||||
iconContainer.className = 'inline-flex items-center justify-center shrink-0 w-9 h-9 rounded-lg';
|
||||
let iconHtml = '';
|
||||
if (type === 'success') {
|
||||
iconContainer.classList.add('bg-emerald-50', 'text-emerald-500');
|
||||
iconHtml = '<svg class="w-5.5 h-5.5" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2.5"><path stroke-linecap="round" stroke-linejoin="round" d="M5 13l4 4L19 7" /></svg>';
|
||||
} else if (type === 'error') {
|
||||
iconContainer.classList.add('bg-red-50', 'text-red-500');
|
||||
iconHtml = '<svg class="w-5.5 h-5.5" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2.5"><path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" /></svg>';
|
||||
} else if (type === 'warning') {
|
||||
iconContainer.classList.add('bg-amber-50', 'text-amber-500');
|
||||
iconHtml = '<svg class="w-5.5 h-5.5" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2.5"><path stroke-linecap="round" stroke-linejoin="round" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" /></svg>';
|
||||
} else {
|
||||
iconContainer.classList.add('bg-blue-50', 'text-blue-500');
|
||||
iconHtml = '<svg class="w-5.5 h-5.5" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2.5"><path stroke-linecap="round" stroke-linejoin="round" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" /></svg>';
|
||||
}
|
||||
iconContainer.innerHTML = iconHtml;
|
||||
}
|
||||
|
||||
toast.classList.remove('hidden');
|
||||
toast.classList.add('flex');
|
||||
|
||||
Reference in New Issue
Block a user