misc: add community language warning, close #483

This commit is contained in:
James Xylight committed 2025-02-09 10:06:41 -08:00
1 parent 5aebb5639f
commit 8c2b7592c8
4 files changed
+35 -8

No files matched your search

+2 -1
View File
@@ -439,7 +439,8 @@
"team": "Team",
"settings": "Settings",
"manage": "Manage"
}
},
"languageWarning": "Content in this community is in languages you do not have selected. Some or all posts may be missing."
}
},
"cards": {
+9 -5
View File
@@ -1,20 +1,22 @@
<script lang="ts">
import type { ClassValue } from 'svelte/elements'
import { Material } from '../index.js'
import { Icon, InformationCircle } from 'svelte-hero-icons'
interface Props {
content?: string | undefined
children?: import('svelte').Snippet
class?: ClassValue
}
let { content = undefined, children }: Props = $props()
let { content = undefined, children, class: clazz = '' }: Props = $props()
</script>
<Material
padding="none"
rounding="full"
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
src={InformationCircle}
@@ -22,11 +24,13 @@
mini
class="text-primary-900 dark:text-primary-100"
/>
<p>
<div class="flex items-center w-full">
{#if children}
{@render children?.()}
{:else if content}
{content}
<p>
{content}
</p>
{/if}
</p>
</div>
</Material>
+1 -1
View File
@@ -36,7 +36,7 @@
{...rest}
{color}
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'
: ''} {color == 'tertiary'
? 'hover:dark:bg-zinc-800/70'
+23 -1
View File
@@ -9,7 +9,7 @@
import { setSessionStorage } from '$lib/session.js'
import PostFeed from '$lib/components/lemmy/post/feed/PostFeed.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 { ArrowRight, ChartBar, Icon, XMark } from 'svelte-hero-icons'
import Placeholder from '$lib/components/ui/Placeholder.svelte'
@@ -19,6 +19,7 @@
import { resumables } from '$lib/lemmy/item'
import CommunityHeader from '$lib/components/lemmy/community/CommunityHeader.svelte'
import Header from '$lib/components/ui/layout/pages/Header.svelte'
import { profile } from '$lib/auth.svelte.js'
let { data: pageData } = $props()
let data = $state(pageData)
@@ -82,6 +83,27 @@
<Sort selected={data.sort} />
{/snippet}
</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}
<Placeholder
icon={XMark}