[READ-ONLY] Mirror of https://github.com/probablykasper/kadium. App for staying ontop of YouTube channels' uploads kadium.kasper.space
linux macos notifications tauri windows youtube
0

Configure Feed

Select the types of activity you want to include in your feed.

Keep video selected if it moves position

Kasper (Jan 21, 2024, 5:36 AM +0100) 077dc762 c85d377a

+22 -5
+2 -1
CHANGELOG.md
··· 1 1 # Changelog 2 2 3 3 ## Next 4 - - Fix deselection not happening when videos update 4 + - Fix selection staying in the same position when videos update 5 + - Keep video selected if it moves position 5 6 6 7 ## 1.6.2 - 2024 Jan 15 7 8 - Fix channel page filtering
+20 -4
src/routes/+page.svelte
··· 16 16 loading++ 17 17 18 18 const selectedId = videos[selectedIndex]?.id 19 + const oldselectedIndex = selectedIndex 19 20 20 21 const newVideos = await commands.getVideos(options, null) 21 22 allLoaded = newVideos.length < $viewOptions.limit 22 23 videos = newVideos 23 - // Remove selection if the video changes position 24 - if (!selectedId || selectedId !== videos[selectedIndex]?.id) { 24 + 25 + // Update the selection index if the video moves 26 + const newSelectedIndex = videos.findIndex((v) => v.id === selectedId) 27 + if (newSelectedIndex >= 0) { 28 + selectedIndex = newSelectedIndex 29 + selectionVisible = true 30 + } else { 31 + // Or clear selection if the video disappeared from view 25 32 selectedIndex = 0 26 33 selectionVisible = false 27 34 } 35 + const selectionMoved = selectionVisible && selectedIndex !== oldselectedIndex 28 36 29 - await tick() 37 + if (selectionMoved) { 38 + allowScrollToBox = false 39 + await tick() 40 + allowScrollToBox = true 41 + scrollToBox(selectedIndex) 42 + } else { 43 + await tick() 44 + } 30 45 await autoloadHandler() 31 46 loading-- 32 47 } ··· 263 278 264 279 let boxes: HTMLDivElement[] = [] 265 280 $: scrollToBox(selectedIndex) 281 + let allowScrollToBox = true 266 282 function scrollToBox(index: number) { 267 - if (scrollDiv && boxes[index]) { 283 + if (scrollDiv && boxes[index] && allowScrollToBox) { 268 284 const el = boxes[index].getBoundingClientRect() 269 285 const parent = scrollDiv.getBoundingClientRect() 270 286 const topOffset = el.top - parent.top