Update main page

This commit is contained in:
Xyphyn committed 2023-06-30 20:00:51 -07:00
1 parent 09d86dd721
commit aac09a11c3
3 files changed
+21 -3

No files matched your search

+1 -1
View File
@@ -4,7 +4,7 @@
numeric: 'auto',
style: 'short',
}).format(
Math.floor((Date.now() - date.getTime()) / 1000 / 60 / 60 / 24),
Math.floor((date.getTime() - Date.now()) / 1000 / 60 / 60 / 24),
'days'
)
</script>
+9 -2
View File
@@ -1,5 +1,12 @@
import { lemmy } from '$lib/lemmy.js'
export function load() {
return lemmy.getPosts({ limit: 20, page: 1 })
export function load(req) {
const page = Number(req.url.searchParams.get('page') || 1) || 1
console.log(page)
return lemmy.getPosts({
limit: 40,
page: page,
sort: 'Active',
type_: 'Local',
})
}
+11
View File
@@ -1,4 +1,8 @@
<script lang="ts">
import { goto } from '$app/navigation'
import { page } from '$app/stores'
import Button from '$lib/components/Button.svelte'
import Link from '$lib/components/Link.svelte'
import MultiSelect from '$lib/components/MultiSelect.svelte'
import Post from './post/[id]/Post.svelte'
@@ -14,6 +18,13 @@
<Post {post} />
{/each}
</div>
<Button
on:click={() =>
goto(`/?page=${(Number($page.url.searchParams.get('page')) || 1) + 1}`)}
>
Next
</Button>
</div>
<div
class="bg-white dark:bg-zinc-900 border dark:border-zinc-800 border-slate-200