misc: add settings pages
This commit is contained in:
1 parent
7e76b1684c
commit
f493f19c60
12 files changed
+270
-148
No files matched your search
@@ -0,0 +1,9 @@
|
||||
<script lang="ts">
|
||||
export let data
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
<title>{data.community.community_view.community.title}</title>
|
||||
</svelte:head>
|
||||
|
||||
<slot />
|
||||
@@ -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,
|
||||
}),
|
||||
}
|
||||
}
|
||||
@@ -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 @@
|
||||
|
||||
<svelte:head>
|
||||
<title>{data.posts.posts[0]?.community.name}</title>
|
||||
<meta name="og:title" content={data.community.community.name} />
|
||||
{#if data.community.community.description}
|
||||
<meta
|
||||
name="og:title"
|
||||
content={data.community.community_view.community.name}
|
||||
/>
|
||||
{#if data.community.community_view.community.description}
|
||||
<meta
|
||||
name="og:description"
|
||||
content={data.community.community.description}
|
||||
content={data.community.community_view.community.description}
|
||||
/>
|
||||
{/if}
|
||||
<meta name="og:url" content={$page.url.toString()} />
|
||||
@@ -49,7 +52,7 @@
|
||||
<Modal bind:open={sidebar}>
|
||||
<span slot="title">About</span>
|
||||
<div class="mx-auto">
|
||||
<CommunityCard community_view={data.community} />
|
||||
<CommunityCard community_view={data.community.community_view} />
|
||||
</div>
|
||||
</Modal>
|
||||
|
||||
@@ -58,14 +61,16 @@
|
||||
<div class="flex flex-row gap-3 items-center">
|
||||
<Avatar
|
||||
width={48}
|
||||
url={data.community.community.icon}
|
||||
alt={data.community.community.name}
|
||||
url={data.community.community_view.community.icon}
|
||||
alt={data.community.community_view.community.name}
|
||||
/>
|
||||
<div class="flex flex-col gap-0">
|
||||
<h1 class="font-bold text-xl">{data.community.community.title}</h1>
|
||||
<h1 class="font-bold text-xl">
|
||||
{data.community.community_view.community.title}
|
||||
</h1>
|
||||
<span class="dark:text-zinc-400 text-slate-600 text-sm">
|
||||
!{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}
|
||||
</span>
|
||||
</div>
|
||||
@@ -85,6 +90,6 @@
|
||||
/>
|
||||
</div>
|
||||
<div class="hidden xl:block">
|
||||
<CommunityCard community_view={data.community} />
|
||||
<CommunityCard community_view={data.community.community_view} />
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,27 @@
|
||||
<script lang="ts">
|
||||
import { goto } from '$app/navigation'
|
||||
import { page } from '$app/stores'
|
||||
import MultiSelect from '$lib/components/input/MultiSelect.svelte'
|
||||
import { fullCommunityName } from '$lib/util.js'
|
||||
import type { PageData } from './$types.js'
|
||||
|
||||
export let data: PageData
|
||||
|
||||
$: communityUrl = `/c/${fullCommunityName(
|
||||
data.community.community_view.community.name,
|
||||
data.community.community_view.community.actor_id
|
||||
)}`
|
||||
</script>
|
||||
|
||||
<div class="flex flex-col gap-4 h-full">
|
||||
<MultiSelect
|
||||
headless
|
||||
options={[`${communityUrl}/settings`, `${communityUrl}/settings/team`]}
|
||||
optionNames={['Settings', 'Team']}
|
||||
selected={$page.url.pathname}
|
||||
on:select={(e) => {
|
||||
goto(e.detail)
|
||||
}}
|
||||
/>
|
||||
<slot />
|
||||
</div>
|
||||
@@ -0,0 +1,27 @@
|
||||
<script lang="ts">
|
||||
import CommunityForm from '$lib/components/lemmy/community/CommunityForm.svelte'
|
||||
import CommunityTitle from '$lib/components/lemmy/community/CommunityTitle.svelte'
|
||||
|
||||
export let data
|
||||
</script>
|
||||
|
||||
<div class="flex flex-col gap-4">
|
||||
<CommunityTitle community={data.community.community_view.community} />
|
||||
<h1 class="font-bold text-2xl">Settings</h1>
|
||||
<CommunityForm
|
||||
edit={data.community.community_view.community.id}
|
||||
formData={{
|
||||
name: data.community.community_view.community.name,
|
||||
displayName: data.community.community_view.community.title,
|
||||
nsfw: data.community.community_view.community.nsfw,
|
||||
postsLockedToModerators:
|
||||
data.community.community_view.community.posting_restricted_to_mods,
|
||||
sidebar: data.community.community_view.community.description ?? '',
|
||||
icon: null,
|
||||
banner: null,
|
||||
submitting: false,
|
||||
}}
|
||||
>
|
||||
<svelte:fragment slot="formtitle">{''}</svelte:fragment>
|
||||
</CommunityForm>
|
||||
</div>
|
||||
Whitespace-only changes.
Reference in new issue
Block a user