From 84fca4036e83a63b7a4ef2d250e5bbc1c529c128 Mon Sep 17 00:00:00 2001 From: Till-JS <101404291+Till-JS@users.noreply.github.com> Date: Thu, 29 Jan 2026 17:16:02 +0100 Subject: [PATCH] feat(matrix-web): add online status indicators for DMs - Add PresenceState and UserPresence types - Track user presence via Matrix SDK events - Display green dot indicator for online users in DM list - Show gray dot for offline users - Add tooltip with last active time Co-Authored-By: Claude Opus 4.5 --- .../src/lib/components/chat/RoomItem.svelte | 48 ++++++++++--- .../apps/web/src/lib/matrix/store.svelte.ts | 72 ++++++++++++++++++- apps/matrix/apps/web/src/lib/matrix/types.ts | 20 ++++++ 3 files changed, 128 insertions(+), 12 deletions(-) diff --git a/apps/matrix/apps/web/src/lib/components/chat/RoomItem.svelte b/apps/matrix/apps/web/src/lib/components/chat/RoomItem.svelte index 31d25537e..5f037431b 100644 --- a/apps/matrix/apps/web/src/lib/components/chat/RoomItem.svelte +++ b/apps/matrix/apps/web/src/lib/components/chat/RoomItem.svelte @@ -27,6 +27,22 @@ .substring(0, 2) .toUpperCase() ); + + // Online status for DMs + let isOnline = $derived(room.isDirect && room.presence === 'online'); + + // Format last active time + let lastActiveText = $derived(() => { + if (!room.isDirect || !room.lastActiveAgo) return ''; + if (room.presence === 'online') return 'Online'; + const minutes = Math.floor(room.lastActiveAgo / 60000); + if (minutes < 1) return 'Gerade aktiv'; + if (minutes < 60) return `Vor ${minutes} Min.`; + const hours = Math.floor(minutes / 60); + if (hours < 24) return `Vor ${hours} Std.`; + const days = Math.floor(hours / 24); + return `Vor ${days} Tag${days > 1 ? 'en' : ''}`; + });