Bug fixes.

This commit is contained in:
Aodhan
2025-07-19 21:46:31 +01:00
parent 7bebc95c09
commit c2ecf93abe
12 changed files with 618 additions and 373 deletions

View File

@@ -1,11 +1,45 @@
export function showToast(message) {
export function showToast(message, type = 'info') {
const toastEl = document.getElementById('toast');
if (!toastEl) return;
// Clear any existing classes
toastEl.className = 'toast';
// Add the appropriate class based on type
if (type === 'error') {
toastEl.classList.add('toast-error');
} else if (type === 'success') {
toastEl.classList.add('toast-success');
} else {
toastEl.classList.add('toast-info');
}
toastEl.textContent = message;
toastEl.classList.add('show');
setTimeout(() => toastEl.classList.remove('show'), 3000);
}
export function addRippleEffect(button) {
if (!button) return;
button.addEventListener('click', function(e) {
const ripple = document.createElement('span');
ripple.classList.add('ripple');
this.appendChild(ripple);
const rect = button.getBoundingClientRect();
const size = Math.max(rect.width, rect.height);
ripple.style.width = ripple.style.height = `${size}px`;
ripple.style.left = `${e.clientX - rect.left - size/2}px`;
ripple.style.top = `${e.clientY - rect.top - size/2}px`;
setTimeout(() => {
ripple.remove();
}, 600);
});
}
export function updateImageInfo(data) {
const resolutionEl = document.getElementById('image-resolution');
if (resolutionEl) {