impr: hide features when unsupported
This commit is contained in:
8 files changed
+154
-127
No files matched your search
@@ -41,6 +41,7 @@
|
|||||||
import { amMod, isAdmin } from '../moderation/moderation'
|
import { amMod, isAdmin } from '../moderation/moderation'
|
||||||
import { block, blockInstance, purgeCommunity } from './CommunityCard.svelte'
|
import { block, blockInstance, purgeCommunity } from './CommunityCard.svelte'
|
||||||
import CommunityFlair from './CommunityFlair.svelte'
|
import CommunityFlair from './CommunityFlair.svelte'
|
||||||
|
import { client } from '$lib/client/lemmy.svelte'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
community: Community
|
community: Community
|
||||||
@@ -176,15 +177,17 @@
|
|||||||
{/snippet}
|
{/snippet}
|
||||||
</Subscribe>
|
</Subscribe>
|
||||||
|
|
||||||
<Button
|
{#if client().setFlair}
|
||||||
size="custom"
|
<Button
|
||||||
class="h-9 aspect-square"
|
size="custom"
|
||||||
rounding="pill"
|
class="h-9 aspect-square"
|
||||||
onclick={() => (setFlair = !setFlair)}
|
rounding="pill"
|
||||||
aria-label={$t('cards.community.flair')}
|
onclick={() => (setFlair = !setFlair)}
|
||||||
>
|
aria-label={$t('cards.community.flair')}
|
||||||
<Icon src={Tag} size="16" micro />
|
>
|
||||||
</Button>
|
<Icon src={Tag} size="16" micro />
|
||||||
|
</Button>
|
||||||
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{#if profile.current?.user && profile.current.user.moderates
|
{#if profile.current?.user && profile.current.user.moderates
|
||||||
|
|||||||
@@ -4,8 +4,6 @@
|
|||||||
let { children } = $props()
|
let { children } = $props()
|
||||||
|
|
||||||
const options = getContext('options')
|
const options = getContext('options')
|
||||||
|
|
||||||
console.log(options.noStyle)
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<p class={[!options.noStyle && 'leading-[1.7] break-words max-w']}>
|
<p class={[!options.noStyle && 'leading-[1.7] break-words max-w']}>
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
alignment="left"
|
alignment="left"
|
||||||
size="md"
|
size="md"
|
||||||
rounding="xl"
|
rounding="xl"
|
||||||
class="flex flex-row gap-2 items-center"
|
class="flex flex-row gap-2! items-center"
|
||||||
aria-label={$t('aria.sidebar.accounts')}
|
aria-label={$t('aria.sidebar.accounts')}
|
||||||
>
|
>
|
||||||
{#snippet prefix()}
|
{#snippet prefix()}
|
||||||
@@ -48,9 +48,9 @@
|
|||||||
<div class="font-medium">{profile.current.username}</div>
|
<div class="font-medium">{profile.current.username}</div>
|
||||||
{#if !LINKED_INSTANCE_URL}
|
{#if !LINKED_INSTANCE_URL}
|
||||||
<div class="text-xs text-slate-500 dark:text-zinc-500">
|
<div class="text-xs text-slate-500 dark:text-zinc-500">
|
||||||
<span class="capitalize"
|
<span class="capitalize">
|
||||||
>{profile.current.client?.name ?? DEFAULT_CLIENT_TYPE.name}</span
|
{profile.current.client?.name ?? DEFAULT_CLIENT_TYPE.name}
|
||||||
>
|
</span>
|
||||||
• {profile.current.instance}
|
• {profile.current.instance}
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
@@ -69,7 +69,7 @@
|
|||||||
{@const selected = profile.meta.profile == p.id}
|
{@const selected = profile.meta.profile == p.id}
|
||||||
<MenuButton
|
<MenuButton
|
||||||
onclick={() => switchTo(p.id)}
|
onclick={() => switchTo(p.id)}
|
||||||
class={[selected && 'bg-slate-100! dark:bg-zinc-800!']}
|
class={[selected && 'bg-slate-100! dark:bg-zinc-800!', 'gap-2!']}
|
||||||
>
|
>
|
||||||
{#snippet prefix()}
|
{#snippet prefix()}
|
||||||
<Avatar url={p.avatar} alt={p.username} width={24} />
|
<Avatar url={p.avatar} alt={p.username} width={24} />
|
||||||
@@ -78,9 +78,9 @@
|
|||||||
<div class="font-medium text-sm">{p.username}</div>
|
<div class="font-medium text-sm">{p.username}</div>
|
||||||
{#if !LINKED_INSTANCE_URL}
|
{#if !LINKED_INSTANCE_URL}
|
||||||
<div class="text-xs text-slate-500 dark:text-zinc-500">
|
<div class="text-xs text-slate-500 dark:text-zinc-500">
|
||||||
<span class="capitalize"
|
<span class="capitalize">
|
||||||
>{p.client?.name ?? DEFAULT_CLIENT_TYPE.name}</span
|
{p.client?.name ?? DEFAULT_CLIENT_TYPE.name}
|
||||||
>
|
</span>
|
||||||
• {p.instance}
|
• {p.instance}
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
@@ -265,6 +265,11 @@
|
|||||||
},
|
},
|
||||||
"translators": "Translators",
|
"translators": "Translators",
|
||||||
"accounts": "Accounts",
|
"accounts": "Accounts",
|
||||||
|
"accounts.placeholder": {
|
||||||
|
"title": "Not logged in",
|
||||||
|
"description": "You aren't logged in. You can sign up or log in here.",
|
||||||
|
"descriptionWithGuest": "You aren't logged in. You can log in, sign up, or add a new guest account here."
|
||||||
|
},
|
||||||
"explore": {
|
"explore": {
|
||||||
"title": "Explore",
|
"title": "Explore",
|
||||||
"feeds": "Feeds",
|
"feeds": "Feeds",
|
||||||
|
|||||||
@@ -318,6 +318,10 @@
|
|||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
filter: brightness(90%);
|
filter: brightness(90%);
|
||||||
cursor: normal;
|
cursor: normal;
|
||||||
|
|
||||||
|
@variant dark {
|
||||||
|
filter: brightness(70%);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
+123
-108
@@ -1,11 +1,15 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import { Header } from '$comp/ui/layout'
|
||||||
|
import CommonList from '$comp/ui/layout/CommonList.svelte'
|
||||||
|
import Placeholder from '$comp/ui/Placeholder.svelte'
|
||||||
|
import DebugObject from '$comp/util/debug/DebugObject.svelte'
|
||||||
import { profile, type ProfileInfo } from '$lib/auth.svelte.js'
|
import { profile, type ProfileInfo } from '$lib/auth.svelte.js'
|
||||||
import { DEFAULT_CLIENT_TYPE } from '$lib/client/base'
|
import { DEFAULT_CLIENT_TYPE } from '$lib/client/base'
|
||||||
import CommonList from '$comp/ui/layout/CommonList.svelte'
|
|
||||||
import { Header } from '$comp/ui/layout'
|
|
||||||
import DebugObject from '$comp/util/debug/DebugObject.svelte'
|
|
||||||
import { t } from '$lib/i18n/translations'
|
import { t } from '$lib/i18n/translations'
|
||||||
import { LINKED_INSTANCE_URL } from '$lib/instance.svelte.js'
|
import {
|
||||||
|
DEFAULT_INSTANCE_URL,
|
||||||
|
LINKED_INSTANCE_URL,
|
||||||
|
} from '$lib/instance.svelte.js'
|
||||||
import ProfileAvatar from '$lib/lemmy/ProfileAvatar.svelte'
|
import ProfileAvatar from '$lib/lemmy/ProfileAvatar.svelte'
|
||||||
import { settings } from '$lib/settings.svelte.js'
|
import { settings } from '$lib/settings.svelte.js'
|
||||||
import { Badge, Button, Menu, MenuButton, Modal } from 'mono-svelte'
|
import { Badge, Button, Menu, MenuButton, Modal } from 'mono-svelte'
|
||||||
@@ -118,114 +122,125 @@
|
|||||||
</div>
|
</div>
|
||||||
{/snippet}
|
{/snippet}
|
||||||
</Header>
|
</Header>
|
||||||
<form class="accounts-grid gap-4">
|
{#if profile.meta.profiles.length == 1 && !profile.current.jwt && profile.current.instance == DEFAULT_INSTANCE_URL}
|
||||||
<CommonList
|
<Placeholder
|
||||||
selected={(p) => p.id == profile.meta.profile}
|
icon={Identification}
|
||||||
items={profile.meta.profiles}
|
title={$t('routes.accounts.placeholder.title')}
|
||||||
animate={false}
|
description={LINKED_INSTANCE_URL
|
||||||
>
|
? $t('routes.accounts.placeholder.description')
|
||||||
{#snippet item(p, index)}
|
: $t('routes.accounts.placeholder.descriptionWithGuest')}
|
||||||
<label class="relative block">
|
class="my-auto"
|
||||||
<input
|
/>
|
||||||
type="radio"
|
{:else}
|
||||||
id={p.id.toString()}
|
<form class="accounts-grid gap-4">
|
||||||
name="profile"
|
<CommonList
|
||||||
value={p.id}
|
selected={(p) => p.id == profile.meta.profile}
|
||||||
class="hidden peer"
|
items={profile.meta.profiles}
|
||||||
bind:group={radioSelected}
|
animate={false}
|
||||||
/>
|
>
|
||||||
<div
|
{#snippet item(p, index)}
|
||||||
class={[
|
<label class="relative block">
|
||||||
'flex flex-row items-center gap-2 transition-all duration-75',
|
<input
|
||||||
'cursor-pointer relative ring-transparent',
|
type="radio"
|
||||||
]}
|
id={p.id.toString()}
|
||||||
>
|
name="profile"
|
||||||
<div
|
value={p.id}
|
||||||
class="absolute -inset-2 -inset-x-3 sm:-inset-y-3 sm:-inset-x-4 group-first/li:rounded-t-2xl group-last/li:rounded-b-2xl rounded-md ring-2 ring-inherit"
|
class="hidden peer"
|
||||||
></div>
|
bind:group={radioSelected}
|
||||||
<ProfileAvatar
|
|
||||||
profile={p}
|
|
||||||
{index}
|
|
||||||
selected={profile?.current.id == p.id}
|
|
||||||
size={32}
|
|
||||||
/>
|
/>
|
||||||
<div class="flex flex-col overflow-hidden">
|
<div
|
||||||
<span class="break-words font-medium text-base">
|
class={[
|
||||||
{p.username}
|
'flex flex-row items-center gap-2 transition-all duration-75',
|
||||||
{#if !p.jwt}
|
'cursor-pointer relative ring-transparent',
|
||||||
<Badge class="inline-grid w-6 h-6 p-0! place-items-center">
|
]}
|
||||||
<Icon src={QuestionMarkCircle} size="16" micro />
|
>
|
||||||
</Badge>
|
|
||||||
{/if}
|
|
||||||
</span>
|
|
||||||
<span class="text-sm text-slate-600 dark:text-zinc-400">
|
|
||||||
<span class="capitalize">
|
|
||||||
{p.client?.name ?? DEFAULT_CLIENT_TYPE.name}
|
|
||||||
</span>
|
|
||||||
• {p.instance}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<Menu placement="bottom-end">
|
|
||||||
{#snippet target(attachment)}
|
|
||||||
<Button
|
|
||||||
{@attach attachment}
|
|
||||||
size="square-md"
|
|
||||||
color="tertiary"
|
|
||||||
class="justify-self-end ml-auto z-50"
|
|
||||||
aria-label={$t('post.actions.more.label')}
|
|
||||||
icon={EllipsisHorizontal}
|
|
||||||
></Button>
|
|
||||||
{/snippet}
|
|
||||||
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
|
||||||
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
||||||
<div
|
<div
|
||||||
class="px-4 py-2 flex items-center gap-2"
|
class="absolute -inset-2 -inset-x-3 sm:-inset-y-3 sm:-inset-x-4 group-first/li:rounded-t-2xl group-last/li:rounded-b-2xl rounded-md ring-2 ring-inherit"
|
||||||
onclick={(e) => e.stopPropagation()}
|
></div>
|
||||||
>
|
<ProfileAvatar
|
||||||
<Button
|
profile={p}
|
||||||
size="square-md"
|
{index}
|
||||||
color="secondary"
|
selected={profile?.current.id == p.id}
|
||||||
title={$t('account.moveUp')}
|
size={32}
|
||||||
onclick={() => profile.move(p.id, true)}
|
/>
|
||||||
icon={ChevronUp}
|
<div class="flex flex-col overflow-hidden">
|
||||||
></Button>
|
<span class="break-words font-medium text-base">
|
||||||
<Button
|
{p.username}
|
||||||
size="square-md"
|
{#if !p.jwt}
|
||||||
color="secondary"
|
<Badge class="inline-grid w-6 h-6 p-0! place-items-center">
|
||||||
title={$t('account.moveDown')}
|
<Icon src={QuestionMarkCircle} size="16" micro />
|
||||||
onclick={() => profile.move(p.id, false)}
|
</Badge>
|
||||||
icon={ChevronDown}
|
{/if}
|
||||||
></Button>
|
</span>
|
||||||
|
<span class="text-sm text-slate-600 dark:text-zinc-400">
|
||||||
|
<span class="capitalize">
|
||||||
|
{p.client?.name ?? DEFAULT_CLIENT_TYPE.name}
|
||||||
|
</span>
|
||||||
|
• {p.instance}
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
{#if settings.debugInfo}
|
<Menu placement="bottom-end">
|
||||||
<MenuButton
|
{#snippet target(attachment)}
|
||||||
onclick={() => {
|
<Button
|
||||||
debugProfile = p
|
{@attach attachment}
|
||||||
debugging = !debugging
|
size="square-md"
|
||||||
}}
|
color="tertiary"
|
||||||
icon={BugAnt}
|
class="justify-self-end ml-auto z-50"
|
||||||
|
aria-label={$t('post.actions.more.label')}
|
||||||
|
icon={EllipsisHorizontal}
|
||||||
|
></Button>
|
||||||
|
{/snippet}
|
||||||
|
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
||||||
|
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
||||||
|
<div
|
||||||
|
class="px-4 py-2 flex items-center gap-2"
|
||||||
|
onclick={(e) => e.stopPropagation()}
|
||||||
>
|
>
|
||||||
{$t('common.debug')}
|
<Button
|
||||||
</MenuButton>
|
size="square-md"
|
||||||
{/if}
|
color="secondary"
|
||||||
{#if !LINKED_INSTANCE_URL || p.user}
|
title={$t('account.moveUp')}
|
||||||
<MenuButton
|
onclick={() => profile.move(p.id, true)}
|
||||||
onclick={() => {
|
icon={ChevronUp}
|
||||||
removing.account = p
|
></Button>
|
||||||
removing.shown = !removing.shown
|
<Button
|
||||||
}}
|
size="square-md"
|
||||||
color="danger-subtle"
|
color="secondary"
|
||||||
icon={ArrowRightOnRectangle}
|
title={$t('account.moveDown')}
|
||||||
>
|
onclick={() => profile.move(p.id, false)}
|
||||||
{$t('account.logout')}
|
icon={ChevronDown}
|
||||||
</MenuButton>
|
></Button>
|
||||||
{/if}
|
</div>
|
||||||
</Menu>
|
{#if settings.debugInfo}
|
||||||
</div>
|
<MenuButton
|
||||||
</label>
|
onclick={() => {
|
||||||
{/snippet}
|
debugProfile = p
|
||||||
</CommonList>
|
debugging = !debugging
|
||||||
</form>
|
}}
|
||||||
|
icon={BugAnt}
|
||||||
|
>
|
||||||
|
{$t('common.debug')}
|
||||||
|
</MenuButton>
|
||||||
|
{/if}
|
||||||
|
{#if !LINKED_INSTANCE_URL || p.user}
|
||||||
|
<MenuButton
|
||||||
|
onclick={() => {
|
||||||
|
removing.account = p
|
||||||
|
removing.shown = !removing.shown
|
||||||
|
}}
|
||||||
|
color="danger-subtle"
|
||||||
|
icon={ArrowRightOnRectangle}
|
||||||
|
>
|
||||||
|
{$t('account.logout')}
|
||||||
|
</MenuButton>
|
||||||
|
{/if}
|
||||||
|
</Menu>
|
||||||
|
</div>
|
||||||
|
</label>
|
||||||
|
{/snippet}
|
||||||
|
</CommonList>
|
||||||
|
</form>
|
||||||
|
{/if}
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.accounts-grid {
|
.accounts-grid {
|
||||||
|
|||||||
@@ -80,6 +80,7 @@
|
|||||||
{#if icon}
|
{#if icon}
|
||||||
<Icon
|
<Icon
|
||||||
src={icon}
|
src={icon}
|
||||||
|
mini
|
||||||
size="32"
|
size="32"
|
||||||
class="bg-red-200/20 dark:bg-red-600/20 p-1.5 rounded-lg color
|
class="bg-red-200/20 dark:bg-red-600/20 p-1.5 rounded-lg color
|
||||||
text-red-500 dark:text-red-300 float-left mr-2 clear-both"
|
text-red-500 dark:text-red-300 float-left mr-2 clear-both"
|
||||||
|
|||||||
@@ -77,6 +77,7 @@
|
|||||||
<Icon
|
<Icon
|
||||||
src={icon}
|
src={icon}
|
||||||
size="32"
|
size="32"
|
||||||
|
mini
|
||||||
class="bg-red-200/20 dark:bg-red-600/20 p-1.5 self-center
|
class="bg-red-200/20 dark:bg-red-600/20 p-1.5 self-center
|
||||||
rounded-lg color text-red-500 dark:text-red-300"
|
rounded-lg color text-red-500 dark:text-red-300"
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in new issue
Block a user