From 2138c8b0d212d0a4868339f408aa8aaa0adf18b4 Mon Sep 17 00:00:00 2001 From: lucor Date: Fri, 1 May 2026 23:35:43 +0200 Subject: [PATCH] feat(hive): preview video attachments inline Adds a dedicated modal with an HTML video player when a notification attachment has a video MIME type, mirroring the existing image preview flow. --- .../lib/components/notification_card.svelte | 91 ++++++++++++++++++- .../hive/src/lib/utils/attachmentCache.ts | 9 ++ 2 files changed, 98 insertions(+), 2 deletions(-) diff --git a/web/apps/hive/src/lib/components/notification_card.svelte b/web/apps/hive/src/lib/components/notification_card.svelte index e88ab75..9776eeb 100644 --- a/web/apps/hive/src/lib/components/notification_card.svelte +++ b/web/apps/hive/src/lib/components/notification_card.svelte @@ -2,6 +2,7 @@ import { Image, FileDown, + Video, ChevronUp, EllipsisVertical, Check, @@ -11,9 +12,10 @@ } from '@lucide/svelte'; import type { Notification, NotificationPriority } from '@beebuzz/shared/types'; import { notificationsStore, formatRelativeTime } from '$lib/stores/notifications.svelte'; - import { fetchAndCacheAttachment, isImageMime } from '$lib/utils/attachmentCache'; + import { fetchAndCacheAttachment, isImageMime, isVideoMime } from '$lib/utils/attachmentCache'; import type { CachedAttachment } from '$lib/utils/attachmentCache'; import { parseHttpsLinkSegments } from '$lib/utils/linkify'; + import { tick } from 'svelte'; const PRIORITY_HIGH: NotificationPriority = 'high'; @@ -49,8 +51,13 @@ let cachedAttachment = $state(null); let showImageModal = $state(false); + let showVideoModal = $state(false); let attachmentLoading = $state(false); let imageDialog = $state(undefined); + let videoDialog = $state(undefined); + // Why: Safari can't reliably play