first commit

This commit is contained in:
ervin committed 2026-07-07 14:41:34 +02:00
commit c7fa91c8ce
34 files changed
+4631

No files matched your search

+49
View File
@@ -0,0 +1,49 @@
// Toast értesítések - rövid ideig megjelenő üzenetek (siker, hiba, figyelmeztetés)
let container = null;
// Toast konténer létrehozása (egyszer, az első toast megjelenésekor)
function getContainer() {
if (!container) {
container = document.createElement('div');
container.className = 'fixed bottom-4 right-4 z-50 flex flex-col gap-2 pointer-events-none';
document.body.appendChild(container);
}
return container;
}
// Toast megjelenítése
// type: 'success' | 'error' | 'warning' | 'info'
export function showToast(message, type = 'info', duration = 3000) {
const c = getContainer();
const colors = {
success: 'bg-green-900/90 border-green-500/50 text-green-200',
error: 'bg-red-900/90 border-red-500/50 text-red-200',
warning: 'bg-yellow-900/90 border-yellow-500/50 text-yellow-200',
info: 'bg-gray-800/90 border-gray-600/50 text-gray-200'
};
const icons = {
success: '✓',
error: '✕',
warning: '⚠',
info: 'ℹ'
};
const toast = document.createElement('div');
toast.className = `pointer-events-auto flex items-center gap-2 px-4 py-3 rounded-lg border text-sm shadow-lg backdrop-blur-sm transition-all duration-300 opacity-0 translate-y-2 ${colors[type] || colors.info}`;
toast.innerHTML = `<span class="font-bold">${icons[type] || icons.info}</span><span>${message}</span>`;
c.appendChild(toast);
// Megjelenés animáció
requestAnimationFrame(() => {
toast.classList.remove('opacity-0', 'translate-y-2');
});
// Eltűnés animáció majd DOM eltávolítás
setTimeout(() => {
toast.classList.add('opacity-0', 'translate-y-2');
setTimeout(() => toast.remove(), 300);
}, duration);
}