forked from blisstown/campfire
feat: partial favourites
This commit is contained in:
parent
c51a0b1e5d
commit
99def58c8b
3 changed files with 81 additions and 8 deletions
36
src/routes/favourites/+page.svelte
Normal file
36
src/routes/favourites/+page.svelte
Normal file
|
@ -0,0 +1,36 @@
|
|||
<script>
|
||||
import { page } from '$app/stores';
|
||||
import { account } from '@cf/store/account.js';
|
||||
import { timeline, getTimeline } from '$lib/timeline.js';
|
||||
|
||||
import Button from '@cf/ui/Button.svelte';
|
||||
import Post from '@cf/ui/post/Post.svelte';
|
||||
import PageHeader from '@cf/ui/core/PageHeader.svelte';
|
||||
|
||||
import Lang from '$lib/lang';
|
||||
|
||||
const lang = Lang();
|
||||
if (!$account) goto("/");
|
||||
|
||||
getTimeline("favourites");
|
||||
|
||||
document.addEventListener('scroll', () => {
|
||||
if ($account && $page.url.pathname !== "/favourites") return;
|
||||
if (window.innerHeight + window.scrollY >= document.body.offsetHeight - 2048) {
|
||||
getTimeline("favourites");
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<PageHeader title={lang.string(`navigation.favourites`)}/>
|
||||
|
||||
<div id="feed" role="feed">
|
||||
{#if $timeline.length <= 0}
|
||||
<div class="loading throb">
|
||||
<span>{lang.string('timeline.fetching')}</span>
|
||||
</div>
|
||||
{/if}
|
||||
{#each $timeline as post}
|
||||
<Post post_data={post} />
|
||||
{/each}
|
||||
</div>
|
Loading…
Add table
Add a link
Reference in a new issue