fix: merge conflict
This commit is contained in:
commit
fb6b8c6370
2 files changed
+30
-30
No files matched your search
@@ -23,6 +23,7 @@
|
|||||||
import {
|
import {
|
||||||
createVirtualizer,
|
createVirtualizer,
|
||||||
createWindowVirtualizer,
|
createWindowVirtualizer,
|
||||||
|
type SvelteVirtualizer,
|
||||||
} from '@tanstack/svelte-virtual'
|
} from '@tanstack/svelte-virtual'
|
||||||
import { afterNavigate, beforeNavigate } from '$app/navigation'
|
import { afterNavigate, beforeNavigate } from '$app/navigation'
|
||||||
import { combineCrossposts } from './crosspost'
|
import { combineCrossposts } from './crosspost'
|
||||||
@@ -34,6 +35,7 @@
|
|||||||
} from '$lib/lemmy/postfeed'
|
} from '$lib/lemmy/postfeed'
|
||||||
import { t } from '$lib/translations'
|
import { t } from '$lib/translations'
|
||||||
import InfiniteScroll from 'svelte-infinite-scroll'
|
import InfiniteScroll from 'svelte-infinite-scroll'
|
||||||
|
import type { Readable } from 'svelte/motion'
|
||||||
|
|
||||||
export let posts: PostView[]
|
export let posts: PostView[]
|
||||||
export let community: boolean = false
|
export let community: boolean = false
|
||||||
@@ -47,18 +49,18 @@
|
|||||||
estimateSize: () => 150,
|
estimateSize: () => 150,
|
||||||
})
|
})
|
||||||
|
|
||||||
$: if (posts.length)
|
|
||||||
$virtualizer.setOptions({
|
|
||||||
count: posts.length,
|
|
||||||
scrollMargin: virtualListEl?.offsetTop,
|
|
||||||
})
|
|
||||||
|
|
||||||
$: items = $virtualizer.getVirtualItems()
|
$: items = $virtualizer.getVirtualItems()
|
||||||
$: {
|
$: {
|
||||||
if (virtualItemEls.length)
|
if (virtualItemEls.length)
|
||||||
virtualItemEls.forEach((el) => $virtualizer.measureElement(el))
|
virtualItemEls.forEach((el) => $virtualizer.measureElement(el))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$: if (posts.length && virtualListEl)
|
||||||
|
$virtualizer.setOptions({
|
||||||
|
scrollMargin: virtualListEl?.offsetTop,
|
||||||
|
count: posts.length,
|
||||||
|
})
|
||||||
|
|
||||||
afterNavigate(() => {
|
afterNavigate(() => {
|
||||||
console.log($postFeeds[feedId].lastSeen)
|
console.log($postFeeds[feedId].lastSeen)
|
||||||
$virtualizer.scrollToIndex($postFeeds[feedId].lastSeen ?? 0)
|
$virtualizer.scrollToIndex($postFeeds[feedId].lastSeen ?? 0)
|
||||||
@@ -167,6 +169,11 @@
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
onMount(async () => {
|
||||||
|
await tick()
|
||||||
|
$virtualizer.measure()
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<ul
|
<ul
|
||||||
@@ -181,7 +188,6 @@
|
|||||||
'embed embed'
|
'embed embed'
|
||||||
'actions actions'; --template-columns: auto 1fr;`
|
'actions actions'; --template-columns: auto 1fr;`
|
||||||
: ``}
|
: ``}
|
||||||
bind:this={virtualListEl}
|
|
||||||
>
|
>
|
||||||
{#if posts?.length == 0}
|
{#if posts?.length == 0}
|
||||||
<div class="h-full grid place-items-center">
|
<div class="h-full grid place-items-center">
|
||||||
@@ -201,6 +207,7 @@
|
|||||||
style="position:relative; height: {browser
|
style="position:relative; height: {browser
|
||||||
? `${$virtualizer.getTotalSize()}px`
|
? `${$virtualizer.getTotalSize()}px`
|
||||||
: '100%'}; width: 100%;"
|
: '100%'}; width: 100%;"
|
||||||
|
bind:this={virtualListEl}
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
style="position: absolute; top: 0; left: 0; width: 100%; transform: translateY({items?.[0]
|
style="position: absolute; top: 0; left: 0; width: 100%; transform: translateY({items?.[0]
|
||||||
@@ -211,15 +218,9 @@
|
|||||||
>
|
>
|
||||||
{#each items as row, index (row.index)}
|
{#each items as row, index (row.index)}
|
||||||
<li
|
<li
|
||||||
in:fly|global={{
|
|
||||||
y: -8,
|
|
||||||
duration: 300,
|
|
||||||
opacity: 0,
|
|
||||||
delay: 50 + index * 20,
|
|
||||||
}}
|
|
||||||
bind:this={virtualItemEls[index]}
|
bind:this={virtualItemEls[index]}
|
||||||
data-index={row.index}
|
data-index={row.index}
|
||||||
class="relative post-container"
|
class="relative post-container pop-in"
|
||||||
>
|
>
|
||||||
{#if posts[row.index]}
|
{#if posts[row.index]}
|
||||||
<Post
|
<Post
|
||||||
@@ -281,4 +282,19 @@
|
|||||||
.skeleton * {
|
.skeleton * {
|
||||||
@apply bg-slate-100 dark:bg-zinc-800 rounded-md;
|
@apply bg-slate-100 dark:bg-zinc-800 rounded-md;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@keyframes popIn {
|
||||||
|
from {
|
||||||
|
transform: translateY(-24px);
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
transform: translateY(0px);
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.pop-in {
|
||||||
|
animation: popIn 500ms cubic-bezier(0.075, 0.82, 0.165, 1) forwards;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -2,22 +2,6 @@
|
|||||||
@tailwind components;
|
@tailwind components;
|
||||||
@tailwind utilities;
|
@tailwind utilities;
|
||||||
|
|
||||||
@layer utilities {
|
|
||||||
/*
|
|
||||||
Chromium browsers don't render nested backdrop filters.
|
|
||||||
As a workaround, add 'before:' to the outer filter, along with 'before:backdrop-hack':
|
|
||||||
|
|
||||||
<div class="before:backdrop-blur-md before:backdrop-hack>
|
|
||||||
<div class="backdrop-blur-md"></div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
See https://stackoverflow.com/a/76207141.
|
|
||||||
*/
|
|
||||||
.backdrop-hack {
|
|
||||||
@apply absolute inset-0 -z-10;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'Inter';
|
font-family: 'Inter';
|
||||||
src: url('/font/Inter.woff2') format('woff2');
|
src: url('/font/Inter.woff2') format('woff2');
|
||||||
|
|||||||
Reference in new issue
Block a user