diff --git a/src/lib/components/lemmy/community/CommunityCard.svelte b/src/lib/components/lemmy/community/CommunityCard.svelte index 20ee40ea..c26f4221 100644 --- a/src/lib/components/lemmy/community/CommunityCard.svelte +++ b/src/lib/components/lemmy/community/CommunityCard.svelte @@ -1,6 +1,7 @@ + +
+ +

Create Community

+
+ { + formData.name = formData.name.toLowerCase().replaceAll(' ', '_') + }} + disabled={edit} + /> + + + + + + NSFW + + Only moderators can post + + + diff --git a/src/lib/components/lemmy/community/CommunityTitle.svelte b/src/lib/components/lemmy/community/CommunityTitle.svelte new file mode 100644 index 00000000..2410c20f --- /dev/null +++ b/src/lib/components/lemmy/community/CommunityTitle.svelte @@ -0,0 +1,16 @@ + + +
+ +
+

{community.title}

+ + !{community.name}@{new URL(community.actor_id).hostname} + +
+
diff --git a/src/lib/components/lemmy/post/PostForm.svelte b/src/lib/components/lemmy/post/PostForm.svelte index 0e8435a9..f557900b 100644 --- a/src/lib/components/lemmy/post/PostForm.svelte +++ b/src/lib/components/lemmy/post/PostForm.svelte @@ -61,7 +61,7 @@ } if (passedCommunity) { - data.community = passedCommunity.id + data.community.community_view = passedCommunity.id communitySearch = passedCommunity.name } else { const list = await getClient().listCommunities({ @@ -88,7 +88,7 @@ }) async function submit() { - if ((!data.community || communitySearch == '') && !edit) { + if ((!data.community.community_view || communitySearch == '') && !edit) { toast({ type: 'warning', content: 'You need to set a community.', @@ -135,7 +135,7 @@ data.url = image || data.url || undefined const post = await getClient().createPost({ auth: $profile.jwt, - community_id: data.community!, + community_id: data.community.community_view!, name: data.title, body: data.body, url: data.url, @@ -183,7 +183,7 @@ Community * - {#if data.community} + {#if data.community.community_view} { if (!c) { - data.community = null + data.community.community_view = null return } - data.community = c.id + data.community.community_view = c.id communitySearch = `${c.name}@${new URL(c.actor_id).hostname}` }} /> diff --git a/src/routes/admin/config/+page.svelte b/src/routes/admin/config/+page.svelte index c951eff2..ffed7e20 100644 --- a/src/routes/admin/config/+page.svelte +++ b/src/routes/admin/config/+page.svelte @@ -86,7 +86,7 @@ }} /> Only admins can create communities diff --git a/src/routes/c/[name]/+layout.svelte b/src/routes/c/[name]/+layout.svelte new file mode 100644 index 00000000..2b51e0da --- /dev/null +++ b/src/routes/c/[name]/+layout.svelte @@ -0,0 +1,9 @@ + + + + {data.community.community_view.community.title} + + + diff --git a/src/routes/c/[name]/+page.ts b/src/routes/c/[name]/+layout.ts similarity index 80% rename from src/routes/c/[name]/+page.ts rename to src/routes/c/[name]/+layout.ts index 1aca1dc8..657eb25b 100644 --- a/src/routes/c/[name]/+page.ts +++ b/src/routes/c/[name]/+layout.ts @@ -21,11 +21,9 @@ export async function load(req: any) { sort: sort, auth: get(profile)?.jwt, }), - community: ( - await getClient(undefined, req.fetch).getCommunity({ - name: req.params.name, - auth: get(profile)?.jwt, - }) - ).community_view, + community: await getClient(undefined, req.fetch).getCommunity({ + name: req.params.name, + auth: get(profile)?.jwt, + }), } } diff --git a/src/routes/c/[name]/+page.svelte b/src/routes/c/[name]/+page.svelte index 4eaaebeb..3957727a 100644 --- a/src/routes/c/[name]/+page.svelte +++ b/src/routes/c/[name]/+page.svelte @@ -25,10 +25,10 @@ onMount(() => { setSessionStorage('lastSeenCommunity', { - id: data.community.community.id, + id: data.community.community_view.community.id, name: fullCommunityName( - data.community.community.name, - data.community.community.actor_id + data.community.community_view.community.name, + data.community.community_view.community.actor_id ), }) }) @@ -36,11 +36,14 @@ {data.posts.posts[0]?.community.name} - - {#if data.community.community.description} + + {#if data.community.community_view.community.description} {/if} @@ -49,7 +52,7 @@ About
- +
@@ -58,14 +61,16 @@
-

{data.community.community.title}

+

+ {data.community.community_view.community.title} +

- !{data.community.community.name}@{new URL( - data.community.community.actor_id + !{data.community.community_view.community.name}@{new URL( + data.community.community_view.community.actor_id ).hostname}
@@ -85,6 +90,6 @@ />
diff --git a/src/routes/c/[name]/settings/+layout.svelte b/src/routes/c/[name]/settings/+layout.svelte new file mode 100644 index 00000000..1686dc7d --- /dev/null +++ b/src/routes/c/[name]/settings/+layout.svelte @@ -0,0 +1,27 @@ + + +
+ { + goto(e.detail) + }} + /> + +
diff --git a/src/routes/c/[name]/settings/+page.svelte b/src/routes/c/[name]/settings/+page.svelte new file mode 100644 index 00000000..8b62049b --- /dev/null +++ b/src/routes/c/[name]/settings/+page.svelte @@ -0,0 +1,27 @@ + + +
+ +

Settings

+ + {''} + +
diff --git a/src/routes/c/[name]/settings/team/+page.svelte b/src/routes/c/[name]/settings/team/+page.svelte new file mode 100644 index 00000000..e69de29b diff --git a/src/routes/create/community/+page.svelte b/src/routes/create/community/+page.svelte index 32c9bffd..12f93ff3 100644 --- a/src/routes/create/community/+page.svelte +++ b/src/routes/create/community/+page.svelte @@ -1,125 +1,7 @@ -
-

Create Community

- { - formData.name = formData.name.toLowerCase().replaceAll(' ', '_') - }} - /> - - - - - - NSFW - - Only moderators can post - - - +
+ +