feat: add community cards with a hacky slot parameter
This commit is contained in:
1 parent
b65d78b973
commit
d2b27803b4
9 files changed
+78
-39
No files matched your search
@@ -1,29 +1,25 @@
|
||||
import { profile } from '$lib/auth.js'
|
||||
import CommunityCard from '$lib/components/lemmy/community/CommunityCard.svelte'
|
||||
import { getClient } from '$lib/lemmy.js'
|
||||
import { userSettings } from '$lib/settings.js'
|
||||
import type { ListingType, SortType } from 'lemmy-js-client'
|
||||
import { get } from 'svelte/store'
|
||||
|
||||
export async function load(req: any) {
|
||||
const cursor: string | undefined = req.url.searchParams.get('cursor')
|
||||
const page = Number(req.url.searchParams.get('page')) || undefined
|
||||
|
||||
const sort: SortType =
|
||||
(req.url.searchParams.get('sort') as SortType) ||
|
||||
get(userSettings).defaultSort.sort
|
||||
const community = await getClient(undefined, req.fetch).getCommunity({
|
||||
name: req.params.name,
|
||||
})
|
||||
|
||||
return {
|
||||
sort: sort,
|
||||
page: page || 1,
|
||||
posts: getClient(undefined, req.fetch).getPosts({
|
||||
limit: 40,
|
||||
community_name: req.params.name,
|
||||
page: page,
|
||||
sort: sort,
|
||||
page_cursor: cursor
|
||||
}),
|
||||
community: getClient(undefined, req.fetch).getCommunity({
|
||||
name: req.params.name,
|
||||
}),
|
||||
community: community,
|
||||
slots: {
|
||||
sidebar: {
|
||||
component: CommunityCard,
|
||||
props: {
|
||||
community_view: community.community_view,
|
||||
moderators: community.moderators,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user