fix: hide redundant information in accounts selector for linked instances

This commit is contained in:
Xylight committed 2025-10-15 21:40:13 -07:00
1 parent 0bb99ddb86
commit ad9236f43b
4 files changed
+37 -22

No files matched your search

+14 -8
View File
@@ -15,7 +15,10 @@
UserGroup,
} from 'svelte-hero-icons/dist'
let { profiles }: { profiles: ProfileInfo[] } = $props()
let {
profiles,
selectable = true,
}: { profiles: ProfileInfo[]; selectable?: boolean } = $props()
function switchTo(id: number) {
profile.meta.profile = id
@@ -27,7 +30,8 @@
</script>
<Menu placement="bottom">
{#snippet target(attachment)}
{#snippet target(passedAttachment)}
{@const attachment = selectable ? passedAttachment : () => {}}
<Button
{@attach attachment}
color="tertiary"
@@ -56,12 +60,14 @@
{/if}
</div>
{#snippet suffix()}
<Icon
src={ChevronUpDown}
size="16"
micro
class="block justify-self-end"
/>
{#if selectable}
<Icon
src={ChevronUpDown}
size="16"
micro
class="block justify-self-end"
/>
{/if}
{/snippet}
</Button>
{/snippet}
+9 -1
View File
@@ -2,6 +2,7 @@
import { env } from '$env/dynamic/public'
import { notifications, profile } from '$lib/app/auth.svelte'
import { t } from '$lib/app/i18n'
import { LINKED_INSTANCE_URL } from '$lib/app/instance.svelte'
import { settings } from '$lib/app/settings.svelte'
import { theme } from '$lib/app/theme/theme.svelte'
import { communityLink } from '$lib/app/util.svelte'
@@ -41,7 +42,14 @@
class={['flex flex-col overflow-auto gap-1', clazz]}
{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>
{#if profile.current?.jwt}
<SidebarButton
+7 -5
View File
@@ -169,12 +169,14 @@
</Badge>
{/if}
</span>
<span class="text-xs text-slate-600 dark:text-zinc-400">
<span class="capitalize">
{p.client?.name ?? DEFAULT_CLIENT_TYPE.name}
{#if !LINKED_INSTANCE_URL}
<span class="text-xs text-slate-600 dark:text-zinc-400">
<span class="capitalize">
{p.client?.name ?? DEFAULT_CLIENT_TYPE.name}
</span>
• {p.instance}
</span>
• {p.instance}
</span>
{/if}
</div>
<Menu placement="bottom-end">
{#snippet target(attachment)}
+7 -8
View File
@@ -90,11 +90,10 @@
{/if}
</ul>
{/if}
{#if data.communities.length > 0}
<Fixate placement="bottom">
<Pageination
page={Number(page.url.searchParams.get('page')) || 1}
href={(c) => `?page=${c}`}
/>
</Fixate>
{/if}
<Fixate placement="bottom">
<Pageination
page={Number(page.url.searchParams.get('page')) || 1}
href={(c) => `?page=${c}`}
hasMore={data.communities.length >= 40}
/>
</Fixate>