[deploy]
All checks were successful
Deploy Discord Bot / deploy (push) Successful in 37s

This commit is contained in:
Pascal Prießnitz
2025-12-04 16:43:38 +01:00
parent 311f5a87f1
commit 22caa79b54
60 changed files with 2652 additions and 2999 deletions

23
public/ts/ui/toast.ts Normal file
View File

@@ -0,0 +1,23 @@
let currentTimeout: number | null = null;
export function showToast(message: string, isError = false, duration = 2500) {
let toast = document.getElementById('toast-root') as HTMLElement | null;
if (!toast) {
toast = document.createElement('div');
toast.id = 'toast-root';
document.body.appendChild(toast);
}
toast.className = `toast ${isError ? 'error' : ''}`;
toast.textContent = message;
requestAnimationFrame(() => {
toast?.classList.add('show');
});
if (currentTimeout) window.clearTimeout(currentTimeout);
currentTimeout = window.setTimeout(() => hideToast(), duration);
}
export function hideToast() {
const toast = document.getElementById('toast-root');
if (!toast) return;
toast.classList.remove('show');
}