fix: hide create community for instances where that is disabled
This commit is contained in:
7 files changed
+70
-29
No files matched your search
@@ -78,7 +78,7 @@
|
||||
-->
|
||||
<article
|
||||
class={[
|
||||
'relative cursor-pointer group/post',
|
||||
'relative group/post',
|
||||
settings.leftAlign && 'left-align',
|
||||
view == 'compact' && 'py-3 list-type compact',
|
||||
view == 'cozy' && 'py-5 flex flex-col gap-2',
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
export { default as Button } from './button/Button.svelte'
|
||||
export { buttonColor, buttonSize, buttonShadow } from './button/Button.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 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">
|
||||
import { site } from '$lib/lemmy.svelte'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import Tabs from '$lib/components/ui/layout/pages/Tabs.svelte'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
@@ -10,18 +11,20 @@
|
||||
{$t('nav.create.label')}
|
||||
</Header>
|
||||
|
||||
<Tabs
|
||||
style="subpage"
|
||||
routes={[
|
||||
{
|
||||
href: '/create/post',
|
||||
name: $t('nav.create.post'),
|
||||
},
|
||||
{
|
||||
href: '/create/community',
|
||||
name: $t('nav.create.community'),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
{#if !site || !site.data?.site_view.local_site.community_creation_admin_only}
|
||||
<Tabs
|
||||
style="subpage"
|
||||
routes={[
|
||||
{
|
||||
href: '/create/post',
|
||||
name: $t('nav.create.post'),
|
||||
},
|
||||
{
|
||||
href: '/create/community',
|
||||
name: $t('nav.create.community'),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
{/if}
|
||||
|
||||
{@render children?.()}
|
||||
@@ -1,19 +1,12 @@
|
||||
<script lang="ts">
|
||||
import { goto } from '$app/navigation'
|
||||
import { profile } from '$lib/auth.svelte.js'
|
||||
import PostForm from '$lib/components/lemmy/post/form/PostForm.svelte'
|
||||
import { t } from '$lib/i18n/translations.js'
|
||||
import { getSessionStorage, setSessionStorage } from '$lib/session.js'
|
||||
import { onDestroy, onMount } from 'svelte'
|
||||
import { onDestroy } from 'svelte'
|
||||
|
||||
let { data } = $props()
|
||||
|
||||
onMount(() => {
|
||||
if (!profile.current?.jwt) {
|
||||
goto('/login')
|
||||
}
|
||||
})
|
||||
|
||||
let community = getSessionStorage('lastSeenCommunity') as
|
||||
| { id: number; name: string }
|
||||
| undefined
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
isUser,
|
||||
} from '$lib/lemmy/item.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 {
|
||||
AdjustmentsHorizontal,
|
||||
@@ -145,8 +145,7 @@
|
||||
class="flex gap-2 items-center my-4"
|
||||
out:slide={{ axis: 'y', easing: expoOut }}
|
||||
>
|
||||
<Spinner width={24} />
|
||||
<span>{$t('routes.search.federating')}</span>
|
||||
<TextLoader>{$t('routes.search.federating')}</TextLoader>
|
||||
</div>
|
||||
{:then object}
|
||||
{#if object}
|
||||
@@ -169,7 +168,7 @@
|
||||
</div>
|
||||
{/if}
|
||||
{/await}
|
||||
<CommonList items={data.results.value} animate size="lg">
|
||||
<CommonList items={data.results.value}>
|
||||
{#snippet item(result)}
|
||||
{#if isPostView(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 { ReactiveState } from '$lib/promise.svelte.js'
|
||||
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'
|
||||
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,
|
||||
page: page,
|
||||
username: params.name,
|
||||
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') {
|
||||
items.sort(
|
||||
|
||||
Reference in new issue
Block a user