fix(ux): toast swipe-to-dismiss, widget-icons neutral, reminders.css lazy

This commit is contained in:
Ulas Kalayci
2026-04-27 22:32:09 +02:00
parent 688d6a6efa
commit 890b00f0b0
2 changed files with 32 additions and 1 deletions
+31
View File
@@ -205,6 +205,7 @@ async function navigate(path, userOrPushState = true, pushState = true) {
if (typeof userOrPushState === 'object' && userOrPushState !== null) { if (typeof userOrPushState === 'object' && userOrPushState !== null) {
currentUser = userOrPushState; currentUser = userOrPushState;
await syncPreferencesOnce(); await syncPreferencesOnce();
loadReminderStyles();
initReminders(); initReminders();
} else { } else {
pushState = userOrPushState; pushState = userOrPushState;
@@ -223,6 +224,7 @@ async function navigate(path, userOrPushState = true, pushState = true) {
const result = await auth.me(); const result = await auth.me();
currentUser = result.user; currentUser = result.user;
await syncPreferencesOnce(); await syncPreferencesOnce();
loadReminderStyles();
initReminders(); initReminders();
} catch { } catch {
currentPath = null; // Reset damit navigate('/login') nicht geblockt wird currentPath = null; // Reset damit navigate('/login') nicht geblockt wird
@@ -629,6 +631,14 @@ function showShortcutsModal() {
if (window.lucide) window.lucide.createIcons({ el: panel }); if (window.lucide) window.lucide.createIcons({ el: panel });
} }
function loadReminderStyles() {
if (document.querySelector('link[href="/styles/reminders.css"]')) return;
const link = document.createElement('link');
link.rel = 'stylesheet';
link.href = '/styles/reminders.css';
document.head.appendChild(link);
}
function initOfflineBanner() { function initOfflineBanner() {
const banner = document.getElementById('offline-banner'); const banner = document.getElementById('offline-banner');
if (!banner) return; if (!banner) return;
@@ -980,6 +990,27 @@ function showToast(message, type = 'default', duration = 3000, onUndo = null) {
toast.classList.add('toast--out'); toast.classList.add('toast--out');
toast.addEventListener('animationend', () => toast.remove(), { once: true }); toast.addEventListener('animationend', () => toast.remove(), { once: true });
}, duration); }, duration);
let startX = 0;
toast.addEventListener('pointerdown', (e) => { startX = e.clientX; toast.setPointerCapture(e.pointerId); });
toast.addEventListener('pointermove', (e) => {
const dx = e.clientX - startX;
if (Math.abs(dx) > 10) {
toast.style.transform = `translateX(${dx}px)`;
toast.style.opacity = String(Math.max(0, 1 - Math.abs(dx) / 120));
}
});
toast.addEventListener('pointerup', (e) => {
const dx = e.clientX - startX;
if (Math.abs(dx) > 40) {
clearTimeout(dismissTimer);
toast.classList.add('toast--out');
toast.addEventListener('animationend', () => toast.remove(), { once: true });
} else {
toast.style.transform = '';
toast.style.opacity = '';
}
});
} }
// -------------------------------------------------------- // --------------------------------------------------------
+1 -1
View File
@@ -361,7 +361,7 @@
.widget__title-icon { .widget__title-icon {
width: 16px; width: 16px;
height: 16px; height: 16px;
color: var(--widget-accent, var(--color-accent)); color: var(--color-text-secondary);
} }
.widget__link { .widget__link {