misc: add community language warning, close #483
This commit is contained in:
4 files changed
+35
-8
No files matched your search
@@ -439,7 +439,8 @@
|
|||||||
"team": "Team",
|
"team": "Team",
|
||||||
"settings": "Settings",
|
"settings": "Settings",
|
||||||
"manage": "Manage"
|
"manage": "Manage"
|
||||||
}
|
},
|
||||||
|
"languageWarning": "Content in this community is in languages you do not have selected. Some or all posts may be missing."
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"cards": {
|
"cards": {
|
||||||
|
|||||||
@@ -1,20 +1,22 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import type { ClassValue } from 'svelte/elements'
|
||||||
import { Material } from '../index.js'
|
import { Material } from '../index.js'
|
||||||
import { Icon, InformationCircle } from 'svelte-hero-icons'
|
import { Icon, InformationCircle } from 'svelte-hero-icons'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
content?: string | undefined
|
content?: string | undefined
|
||||||
children?: import('svelte').Snippet
|
children?: import('svelte').Snippet
|
||||||
|
class?: ClassValue
|
||||||
}
|
}
|
||||||
|
|
||||||
let { content = undefined, children }: Props = $props()
|
let { content = undefined, children, class: clazz = '' }: Props = $props()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Material
|
<Material
|
||||||
padding="none"
|
padding="none"
|
||||||
rounding="full"
|
rounding="full"
|
||||||
color="uniform"
|
color="uniform"
|
||||||
class="flex flex-row space-x-2 items-center px-4 py-3"
|
class="flex flex-row space-x-2 items-center px-4 py-3 {clazz}"
|
||||||
>
|
>
|
||||||
<Icon
|
<Icon
|
||||||
src={InformationCircle}
|
src={InformationCircle}
|
||||||
@@ -22,11 +24,13 @@
|
|||||||
mini
|
mini
|
||||||
class="text-primary-900 dark:text-primary-100"
|
class="text-primary-900 dark:text-primary-100"
|
||||||
/>
|
/>
|
||||||
<p>
|
<div class="flex items-center w-full">
|
||||||
{#if children}
|
{#if children}
|
||||||
{@render children?.()}
|
{@render children?.()}
|
||||||
{:else if content}
|
{:else if content}
|
||||||
{content}
|
<p>
|
||||||
|
{content}
|
||||||
|
</p>
|
||||||
{/if}
|
{/if}
|
||||||
</p>
|
</div>
|
||||||
</Material>
|
</Material>
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
{...rest}
|
{...rest}
|
||||||
{color}
|
{color}
|
||||||
rounding="none"
|
rounding="none"
|
||||||
class="w-full px-2 rounded-lg min-h-8 font-medium {disabled
|
class="w-full px-2 rounded-lg min-h-8 font-normal {disabled
|
||||||
? 'opacity-70 pointer-events-none cursor-not-allowed'
|
? 'opacity-70 pointer-events-none cursor-not-allowed'
|
||||||
: ''} {color == 'tertiary'
|
: ''} {color == 'tertiary'
|
||||||
? 'hover:dark:bg-zinc-800/70'
|
? 'hover:dark:bg-zinc-800/70'
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
import { setSessionStorage } from '$lib/session.js'
|
import { setSessionStorage } from '$lib/session.js'
|
||||||
import PostFeed from '$lib/components/lemmy/post/feed/PostFeed.svelte'
|
import PostFeed from '$lib/components/lemmy/post/feed/PostFeed.svelte'
|
||||||
import VirtualFeed from '$lib/components/lemmy/post/feed/VirtualFeed.svelte'
|
import VirtualFeed from '$lib/components/lemmy/post/feed/VirtualFeed.svelte'
|
||||||
import { Button, Modal, toast } from 'mono-svelte'
|
import { Button, Modal, Note, toast } from 'mono-svelte'
|
||||||
import { browser } from '$app/environment'
|
import { browser } from '$app/environment'
|
||||||
import { ArrowRight, ChartBar, Icon, XMark } from 'svelte-hero-icons'
|
import { ArrowRight, ChartBar, Icon, XMark } from 'svelte-hero-icons'
|
||||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||||
@@ -19,6 +19,7 @@
|
|||||||
import { resumables } from '$lib/lemmy/item'
|
import { resumables } from '$lib/lemmy/item'
|
||||||
import CommunityHeader from '$lib/components/lemmy/community/CommunityHeader.svelte'
|
import CommunityHeader from '$lib/components/lemmy/community/CommunityHeader.svelte'
|
||||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||||
|
import { profile } from '$lib/auth.svelte.js'
|
||||||
|
|
||||||
let { data: pageData } = $props()
|
let { data: pageData } = $props()
|
||||||
let data = $state(pageData)
|
let data = $state(pageData)
|
||||||
@@ -82,6 +83,27 @@
|
|||||||
<Sort selected={data.sort} />
|
<Sort selected={data.sort} />
|
||||||
{/snippet}
|
{/snippet}
|
||||||
</Header>
|
</Header>
|
||||||
|
|
||||||
|
{#if profile.data.user}
|
||||||
|
{#if !data.community.discussion_languages.every( (l) => profile.data.user?.discussion_languages.includes(l), )}
|
||||||
|
<Note class="!p-1 !pl-3">
|
||||||
|
{$t('routes.community.languageWarning')}
|
||||||
|
<Button
|
||||||
|
class="inline-block self-end ml-auto"
|
||||||
|
href="/profile/settings"
|
||||||
|
color="tertiary"
|
||||||
|
rounding="pill"
|
||||||
|
size="md"
|
||||||
|
>
|
||||||
|
{$t('profile.profile')}
|
||||||
|
{#snippet suffix()}
|
||||||
|
<Icon src={ArrowRight} size="16" micro />
|
||||||
|
{/snippet}
|
||||||
|
</Button>
|
||||||
|
</Note>
|
||||||
|
{/if}
|
||||||
|
{/if}
|
||||||
|
|
||||||
{#if data.community.community_view.blocked}
|
{#if data.community.community_view.blocked}
|
||||||
<Placeholder
|
<Placeholder
|
||||||
icon={XMark}
|
icon={XMark}
|
||||||
|
|||||||
Reference in new issue
Block a user