fix: hide create community for instances where that is disabled
This commit is contained in:
7 files changed
+57
-16
No files matched your search
@@ -78,7 +78,7 @@
|
|||||||
-->
|
-->
|
||||||
<article
|
<article
|
||||||
class={[
|
class={[
|
||||||
'relative cursor-pointer group/post',
|
'relative group/post',
|
||||||
settings.leftAlign && 'left-align',
|
settings.leftAlign && 'left-align',
|
||||||
view == 'compact' && 'py-3 list-type compact',
|
view == 'compact' && 'py-3 list-type compact',
|
||||||
view == 'cozy' && 'py-5 flex flex-col gap-2',
|
view == 'cozy' && 'py-5 flex flex-col gap-2',
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
export { default as Button } from './button/Button.svelte'
|
export { default as Button } from './button/Button.svelte'
|
||||||
export { buttonColor, buttonSize, buttonShadow } from './button/Button.svelte'
|
export { buttonColor, buttonSize, buttonShadow } from './button/Button.svelte'
|
||||||
export { default as Spinner } from './loader/Spinner.svelte'
|
export { default as Spinner } from './loader/Spinner.svelte'
|
||||||
|
export { default as TextLoader } from './loader/TextLoader.svelte'
|
||||||
export { default as Material } from './materials/Material.svelte'
|
export { default as Material } from './materials/Material.svelte'
|
||||||
|
|
||||||
export { default as Label } from './forms/Label.svelte'
|
export { default as Label } from './forms/Label.svelte'
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import type { Snippet } from 'svelte'
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
children: Snippet
|
||||||
|
}
|
||||||
|
|
||||||
|
let { children }: Props = $props()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="text-loader">
|
||||||
|
{@render children?.()}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.text-loader {
|
||||||
|
color: transparent;
|
||||||
|
background: linear-gradient(
|
||||||
|
to right,
|
||||||
|
var(--color-zinc-500),
|
||||||
|
var(--color-zinc-50),
|
||||||
|
var(--color-zinc-500)
|
||||||
|
);
|
||||||
|
background-size: 200%;
|
||||||
|
background-clip: text;
|
||||||
|
display: inline;
|
||||||
|
width: max-content;
|
||||||
|
animation: pulse 1s infinite linear;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes pulse {
|
||||||
|
0% {
|
||||||
|
background-position: 100%;
|
||||||
|
}
|
||||||
|
50% {
|
||||||
|
background-position: 0%;
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
background-position: -100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import { site } from '$lib/lemmy.svelte'
|
||||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||||
import Tabs from '$lib/components/ui/layout/pages/Tabs.svelte'
|
import Tabs from '$lib/components/ui/layout/pages/Tabs.svelte'
|
||||||
import { t } from '$lib/i18n/translations'
|
import { t } from '$lib/i18n/translations'
|
||||||
@@ -10,6 +11,7 @@
|
|||||||
{$t('nav.create.label')}
|
{$t('nav.create.label')}
|
||||||
</Header>
|
</Header>
|
||||||
|
|
||||||
|
{#if !site || !site.data?.site_view.local_site.community_creation_admin_only}
|
||||||
<Tabs
|
<Tabs
|
||||||
style="subpage"
|
style="subpage"
|
||||||
routes={[
|
routes={[
|
||||||
@@ -23,5 +25,6 @@
|
|||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
|
{/if}
|
||||||
|
|
||||||
{@render children?.()}
|
{@render children?.()}
|
||||||
@@ -1,19 +1,12 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { goto } from '$app/navigation'
|
import { goto } from '$app/navigation'
|
||||||
import { profile } from '$lib/auth.svelte.js'
|
|
||||||
import PostForm from '$lib/components/lemmy/post/form/PostForm.svelte'
|
import PostForm from '$lib/components/lemmy/post/form/PostForm.svelte'
|
||||||
import { t } from '$lib/i18n/translations.js'
|
import { t } from '$lib/i18n/translations.js'
|
||||||
import { getSessionStorage, setSessionStorage } from '$lib/session.js'
|
import { getSessionStorage, setSessionStorage } from '$lib/session.js'
|
||||||
import { onDestroy, onMount } from 'svelte'
|
import { onDestroy } from 'svelte'
|
||||||
|
|
||||||
let { data } = $props()
|
let { data } = $props()
|
||||||
|
|
||||||
onMount(() => {
|
|
||||||
if (!profile.current?.jwt) {
|
|
||||||
goto('/login')
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
let community = getSessionStorage('lastSeenCommunity') as
|
let community = getSessionStorage('lastSeenCommunity') as
|
||||||
| { id: number; name: string }
|
| { id: number; name: string }
|
||||||
| undefined
|
| undefined
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
isUser,
|
isUser,
|
||||||
} from '$lib/lemmy/item.js'
|
} from '$lib/lemmy/item.js'
|
||||||
import { searchParam } from '$lib/util.svelte.js'
|
import { searchParam } from '$lib/util.svelte.js'
|
||||||
import { Button, Select, Spinner } from 'mono-svelte'
|
import { Button, Select, Spinner, TextLoader } from 'mono-svelte'
|
||||||
import Option from 'mono-svelte/forms/select/Option.svelte'
|
import Option from 'mono-svelte/forms/select/Option.svelte'
|
||||||
import {
|
import {
|
||||||
AdjustmentsHorizontal,
|
AdjustmentsHorizontal,
|
||||||
@@ -145,8 +145,7 @@
|
|||||||
class="flex gap-2 items-center my-4"
|
class="flex gap-2 items-center my-4"
|
||||||
out:slide={{ axis: 'y', easing: expoOut }}
|
out:slide={{ axis: 'y', easing: expoOut }}
|
||||||
>
|
>
|
||||||
<Spinner width={24} />
|
<TextLoader>{$t('routes.search.federating')}</TextLoader>
|
||||||
<span>{$t('routes.search.federating')}</span>
|
|
||||||
</div>
|
</div>
|
||||||
{:then object}
|
{:then object}
|
||||||
{#if object}
|
{#if object}
|
||||||
@@ -169,7 +168,7 @@
|
|||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
{/await}
|
{/await}
|
||||||
<CommonList items={data.results.value} animate size="lg">
|
<CommonList items={data.results.value}>
|
||||||
{#snippet item(result)}
|
{#snippet item(result)}
|
||||||
{#if isPostView(result)}
|
{#if isPostView(result)}
|
||||||
<PostItem post={result} />
|
<PostItem post={result} />
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { getClient } from '$lib/lemmy.svelte.js'
|
import { client } from '$lib/lemmy.svelte.js'
|
||||||
import { getItemPublished } from '$lib/lemmy/item.js'
|
import { getItemPublished } from '$lib/lemmy/item.js'
|
||||||
import { ReactiveState } from '$lib/promise.svelte.js'
|
import { ReactiveState } from '$lib/promise.svelte.js'
|
||||||
import type { SortType } from 'lemmy-js-client'
|
import type { SortType } from 'lemmy-js-client'
|
||||||
@@ -9,14 +9,17 @@ export async function load({ params, url, fetch }) {
|
|||||||
(url.searchParams.get('type') as 'comments' | 'posts' | 'all') || 'all'
|
(url.searchParams.get('type') as 'comments' | 'posts' | 'all') || 'all'
|
||||||
const sort: SortType = (url.searchParams.get('sort') as SortType) || 'New'
|
const sort: SortType = (url.searchParams.get('sort') as SortType) || 'New'
|
||||||
|
|
||||||
const user = await getClient(undefined, fetch).getPersonDetails({
|
const user = await client({ func: fetch }).getPersonDetails({
|
||||||
limit: 20,
|
limit: 20,
|
||||||
page: page,
|
page: page,
|
||||||
username: params.name,
|
username: params.name,
|
||||||
sort: sort,
|
sort: sort,
|
||||||
})
|
})
|
||||||
|
|
||||||
const items = [...user.posts, ...user.comments]
|
const items = [
|
||||||
|
...(type == 'posts' || type == 'all' ? user.posts : []),
|
||||||
|
...(type == 'comments' || type == 'all' ? user.comments : []),
|
||||||
|
]
|
||||||
|
|
||||||
if (sort == 'TopAll') {
|
if (sort == 'TopAll') {
|
||||||
items.sort(
|
items.sort(
|
||||||
|
|||||||
Reference in new issue
Block a user