fix: hide redundant information in accounts selector for linked instances
This commit is contained in:
4 files changed
+37
-22
No files matched your search
@@ -15,7 +15,10 @@
|
|||||||
UserGroup,
|
UserGroup,
|
||||||
} from 'svelte-hero-icons/dist'
|
} from 'svelte-hero-icons/dist'
|
||||||
|
|
||||||
let { profiles }: { profiles: ProfileInfo[] } = $props()
|
let {
|
||||||
|
profiles,
|
||||||
|
selectable = true,
|
||||||
|
}: { profiles: ProfileInfo[]; selectable?: boolean } = $props()
|
||||||
|
|
||||||
function switchTo(id: number) {
|
function switchTo(id: number) {
|
||||||
profile.meta.profile = id
|
profile.meta.profile = id
|
||||||
@@ -27,7 +30,8 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Menu placement="bottom">
|
<Menu placement="bottom">
|
||||||
{#snippet target(attachment)}
|
{#snippet target(passedAttachment)}
|
||||||
|
{@const attachment = selectable ? passedAttachment : () => {}}
|
||||||
<Button
|
<Button
|
||||||
{@attach attachment}
|
{@attach attachment}
|
||||||
color="tertiary"
|
color="tertiary"
|
||||||
@@ -56,12 +60,14 @@
|
|||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
{#snippet suffix()}
|
{#snippet suffix()}
|
||||||
<Icon
|
{#if selectable}
|
||||||
src={ChevronUpDown}
|
<Icon
|
||||||
size="16"
|
src={ChevronUpDown}
|
||||||
micro
|
size="16"
|
||||||
class="block justify-self-end"
|
micro
|
||||||
/>
|
class="block justify-self-end"
|
||||||
|
/>
|
||||||
|
{/if}
|
||||||
{/snippet}
|
{/snippet}
|
||||||
</Button>
|
</Button>
|
||||||
{/snippet}
|
{/snippet}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
import { env } from '$env/dynamic/public'
|
import { env } from '$env/dynamic/public'
|
||||||
import { notifications, profile } from '$lib/app/auth.svelte'
|
import { notifications, profile } from '$lib/app/auth.svelte'
|
||||||
import { t } from '$lib/app/i18n'
|
import { t } from '$lib/app/i18n'
|
||||||
|
import { LINKED_INSTANCE_URL } from '$lib/app/instance.svelte'
|
||||||
import { settings } from '$lib/app/settings.svelte'
|
import { settings } from '$lib/app/settings.svelte'
|
||||||
import { theme } from '$lib/app/theme/theme.svelte'
|
import { theme } from '$lib/app/theme/theme.svelte'
|
||||||
import { communityLink } from '$lib/app/util.svelte'
|
import { communityLink } from '$lib/app/util.svelte'
|
||||||
@@ -41,7 +42,14 @@
|
|||||||
class={['flex flex-col overflow-auto gap-1', clazz]}
|
class={['flex flex-col overflow-auto gap-1', clazz]}
|
||||||
{style}
|
{style}
|
||||||
>
|
>
|
||||||
<ProfileSelection profiles={profile.meta.profiles} />
|
<ProfileSelection
|
||||||
|
selectable={!(
|
||||||
|
LINKED_INSTANCE_URL &&
|
||||||
|
!profile.current.jwt &&
|
||||||
|
profile.meta.profiles.length == 1
|
||||||
|
)}
|
||||||
|
profiles={profile.meta.profiles}
|
||||||
|
/>
|
||||||
<EndPlaceholder margin="sm" size="xs">{$t('profile.profile')}</EndPlaceholder>
|
<EndPlaceholder margin="sm" size="xs">{$t('profile.profile')}</EndPlaceholder>
|
||||||
{#if profile.current?.jwt}
|
{#if profile.current?.jwt}
|
||||||
<SidebarButton
|
<SidebarButton
|
||||||
|
|||||||
@@ -169,12 +169,14 @@
|
|||||||
</Badge>
|
</Badge>
|
||||||
{/if}
|
{/if}
|
||||||
</span>
|
</span>
|
||||||
<span class="text-xs text-slate-600 dark:text-zinc-400">
|
{#if !LINKED_INSTANCE_URL}
|
||||||
<span class="capitalize">
|
<span class="text-xs text-slate-600 dark:text-zinc-400">
|
||||||
{p.client?.name ?? DEFAULT_CLIENT_TYPE.name}
|
<span class="capitalize">
|
||||||
|
{p.client?.name ?? DEFAULT_CLIENT_TYPE.name}
|
||||||
|
</span>
|
||||||
|
• {p.instance}
|
||||||
</span>
|
</span>
|
||||||
• {p.instance}
|
{/if}
|
||||||
</span>
|
|
||||||
</div>
|
</div>
|
||||||
<Menu placement="bottom-end">
|
<Menu placement="bottom-end">
|
||||||
{#snippet target(attachment)}
|
{#snippet target(attachment)}
|
||||||
|
|||||||
@@ -90,11 +90,10 @@
|
|||||||
{/if}
|
{/if}
|
||||||
</ul>
|
</ul>
|
||||||
{/if}
|
{/if}
|
||||||
{#if data.communities.length > 0}
|
<Fixate placement="bottom">
|
||||||
<Fixate placement="bottom">
|
<Pageination
|
||||||
<Pageination
|
page={Number(page.url.searchParams.get('page')) || 1}
|
||||||
page={Number(page.url.searchParams.get('page')) || 1}
|
href={(c) => `?page=${c}`}
|
||||||
href={(c) => `?page=${c}`}
|
hasMore={data.communities.length >= 40}
|
||||||
/>
|
/>
|
||||||
</Fixate>
|
</Fixate>
|
||||||
{/if}
|
|
||||||
Reference in new issue
Block a user