From 76c426546bda0a9a6c935946cf2d0cb63ca11a1c Mon Sep 17 00:00:00 2001 From: Leo Vasanko Date: Mon, 25 May 2026 14:21:13 +0000 Subject: [PATCH] refactor: media cards use proper links instead of JS navigation MediaCard, MediaRow, CollageHero, HeroSection, and MediaDetail cast cards now render as tags with real hrefs. Modified clicks (ctrl+click, middle-click) navigate natively, enabling open-in-new-tab and link copying. Plain left-clicks continue through the existing showDetail flow for side-effects like focus-state saving. --- frontend/src/components/CollageHero.vue | 47 ++++++++++++++++--- frontend/src/components/HeroSection.vue | 12 ++++- frontend/src/components/MediaCard.vue | 28 +++++++++-- frontend/src/components/MediaDetail.vue | 8 ++-- frontend/src/components/MediaRow.vue | 11 ++++- frontend/src/composables/useMediaWebSocket.ts | 2 + frontend/src/styles/main.css | 2 + mediahive/hivescan/indexer.py | 8 ++-- mediahive/index_store.py | 15 +++--- 9 files changed, 104 insertions(+), 29 deletions(-) diff --git a/frontend/src/components/CollageHero.vue b/frontend/src/components/CollageHero.vue index 3bcbf9c..01f9d33 100644 --- a/frontend/src/components/CollageHero.vue +++ b/frontend/src/components/CollageHero.vue @@ -3,8 +3,9 @@
@@ -425,7 +433,7 @@ function handleKeyDown(e: KeyboardEvent) { const item = collageItems.value[focusedIndex.value] e.preventDefault() e.stopPropagation() - if (item) handleItemClick(item, focusedIndex.value) + if (item) activateItem(item, focusedIndex.value) } return } @@ -606,13 +614,36 @@ function getPlayLabel(item: MediaItem): string { return props.hasResumePosition(getPlayableFile(item)) ? "Continue" : "Play" } -function handleItemClick(item: MediaItem, index: number) { +function getItemHref(item: MediaItem): string { + return `#/${item.type}/${item.id}` +} + +function activateItem(item: MediaItem, index: number) { if (index === 0) { emit("info", item) } else { emit("select", item) } } + +function handleItemClick(event: MouseEvent, item: MediaItem, index: number) { + if (index === 0) { + emit("info", item) + return + } + // Let modified clicks navigate natively + if ( + event.button !== 0 || + event.ctrlKey || + event.metaKey || + event.shiftKey || + event.altKey + ) { + return + } + event.preventDefault() + emit("select", item) +}