design: show icons by default in navbar

This commit is contained in:
Xylight committed 2025-09-19 16:18:06 -07:00
1 parent a3c417f9cb
commit 252643b5ed
4 files changed
+90 -86

No files matched your search

+1 -1
View File
@@ -61,7 +61,7 @@
style: 'grid-area: sidebar; width: 100% !important;', style: 'grid-area: sidebar; width: 100% !important;',
})} })}
{@render main?.({ {@render main?.({
class: `w-full bg-slate-50 dark:bg-zinc-925 justify-self-center border-x border-slate-200 dark:border-zinc-900 max-lg:pb-22 pb-3 sm:pb-6`, class: `w-full bg-slate-50 dark:bg-zinc-925 justify-self-center border-x border-slate-200 dark:border-zinc-900 max-lg:pb-22 pb-3 lg:pb-6`,
style: 'grid-area: main', style: 'grid-area: main',
})} })}
{@render suffix?.({ {@render suffix?.({
@@ -54,13 +54,16 @@
aria-selected={isSelected} aria-selected={isSelected}
> >
{#snippet prefix()} {#snippet prefix()}
<div class={(icon || customIcon) && adaptive ? 'lg:hidden' : ''}> {#if icon}
{#if icon} <div class="hidden lg:block">
<Icon src={icon} size="16" micro />
</div>
<div class="block lg:hidden">
<Icon src={icon} size="20" mini /> <Icon src={icon} size="20" mini />
{:else} </div>
{@render customIcon?.({ size: 16, isSelected })} {:else}
{/if} {@render customIcon?.({ size: 16, isSelected })}
</div> {/if}
{/snippet} {/snippet}
<span class="hidden {adaptive ? 'lg:block' : ''}">{label}</span> <span class="hidden {adaptive ? 'lg:block' : ''}">{label}</span>
{@render children?.()} {@render children?.()}
+75 -79
View File
@@ -1,5 +1,6 @@
<script lang="ts"> <script lang="ts">
import { notifications, profile } from '$lib/auth.svelte.js' import { notifications, profile } from '$lib/auth.svelte.js'
import { site } from '$lib/client/lemmy.svelte'
import { import {
amModOfAny, amModOfAny,
isAdmin, isAdmin,
@@ -7,14 +8,13 @@
import Avatar from '$lib/components/ui/Avatar.svelte' import Avatar from '$lib/components/ui/Avatar.svelte'
import { t } from '$lib/i18n/translations' import { t } from '$lib/i18n/translations'
import { LINKED_INSTANCE_URL } from '$lib/instance.svelte' import { LINKED_INSTANCE_URL } from '$lib/instance.svelte'
import { site } from '$lib/client/lemmy.svelte'
import { Menu, Spinner } from 'mono-svelte' import { Menu, Spinner } from 'mono-svelte'
import { import {
Bars3, Bars3,
GlobeAlt, GlobeAlt,
Icon, Icon,
MagnifyingGlass, MagnifyingGlass,
Plus, PencilSquare,
ServerStack, ServerStack,
ShieldCheck, ShieldCheck,
} from 'svelte-hero-icons' } from 'svelte-hero-icons'
@@ -35,7 +35,9 @@
<CommandsWrapper bind:open={promptOpen} /> <CommandsWrapper bind:open={promptOpen} />
<nav <nav
class={[ class={[
'flex flex-row gap-2 items-center w-full mx-auto z-50 box-border p-0.5 duration-150 @container', 'w-full mx-auto z-50',
'lg:gap-5 gap-2 flex flex-row items-center p-2',
'box-border p-0.5 duration-150 @container',
clazz, clazz,
]} ]}
{style} {style}
@@ -48,7 +50,7 @@
}} }}
href="/" href="/"
label={$t('nav.home')} label={$t('nav.home')}
class="ml-2 lg:ml-2 logo border-0 lg:rounded-full! lg:w-10! lg:h-10 lg:px-0! text-primary-900! dark:text-primary-100!" class="logo border-0 lg:rounded-full! lg:w-10! lg:h-10 lg:px-0! text-primary-900! dark:text-primary-100!"
adaptive={false} adaptive={false}
> >
{#snippet customIcon()} {#snippet customIcon()}
@@ -68,85 +70,79 @@
{/if} {/if}
{/snippet} {/snippet}
</NavButton> </NavButton>
<div <div class="flex-1"></div>
class="flex flex-row gap-2 lg:gap-5 py-2 px-2 items-center w-full overflow-auto" {#if profile.current?.user && isAdmin(profile.current.user)}
style="border-radius: inherit;"
>
<div class="ml-auto"></div>
{#if profile.current?.user && isAdmin(profile.current.user)}
<NavButton
href="/admin"
label={$t('nav.admin')}
icon={ServerStack}
class="relative"
isSelectedFilter={(path) => path.startsWith('/admin')}
/>
{/if}
{#if amModOfAny(profile.current?.user)}
<NavButton
href="/moderation"
label={$t('nav.moderation')}
class="relative"
icon={ShieldCheck}
/>
{/if}
<NavButton
href="/explore/communities"
label={$t('routes.explore.title')}
icon={GlobeAlt}
isSelectedFilter={(path) => path.startsWith('/explore')}
/>
<NavButton href="/search" label={$t('nav.search')} icon={MagnifyingGlass} />
<NavButton <NavButton
href="/admin"
label={$t('nav.admin')}
icon={ServerStack}
class="relative" class="relative"
label={$t('nav.create.label')} isSelectedFilter={(path) => path.startsWith('/admin')}
icon={Plus}
adaptive={false}
color="primary"
href="/create"
/> />
<Menu placement="bottom"> {/if}
{#snippet target(attachment)} {#if amModOfAny(profile.current?.user)}
<button <NavButton
{@attach attachment} href="/moderation"
class="w-10 h-10 rounded-full border-slate-200 dark:border-zinc-700 label={$t('nav.moderation')}
class="relative"
icon={ShieldCheck}
/>
{/if}
<NavButton
href="/explore/communities"
label={$t('routes.explore.title')}
icon={GlobeAlt}
isSelectedFilter={(path) => path.startsWith('/explore')}
/>
<NavButton href="/search" label={$t('nav.search')} icon={MagnifyingGlass} />
<NavButton
label={$t('nav.create.label')}
href="/create"
isSelectedFilter={(path) => path.startsWith('/create')}
icon={PencilSquare}
alwaysShowIcon
/>
<Menu placement="bottom">
{#snippet target(attachment)}
<button
{@attach attachment}
class="w-10 h-10 rounded-full border-slate-200 dark:border-zinc-700
transition-all bg-slate-50 dark:bg-zinc-900 relative transition-all bg-slate-50 dark:bg-zinc-900 relative
hover:bg-slate-200 dark:hover:bg-zinc-700 group cursor-pointer" hover:bg-slate-200 dark:hover:bg-zinc-700 group cursor-pointer"
title={$t('profile.profile')} title={$t('profile.profile')}
> >
{#if profile.current?.user} {#if profile.current?.user}
<div <div
class="w-full h-full aspect-square object-cover rounded-full grid place-items-center group-hover:scale-90 transition-transform group-active:scale-[85%]" class="w-full h-full aspect-square object-cover rounded-full grid place-items-center group-hover:scale-90 transition-transform group-active:scale-[85%]"
> >
<Avatar <Avatar
url={profile.current.user.local_user_view.person.avatar} url={profile.current.user.local_user_view.person.avatar}
width={36} width={36}
alt={profile.current.user.local_user_view.person.name} alt={profile.current.user.local_user_view.person.name}
/> />
</div> </div>
{:else} {:else}
<div class="w-full h-full grid place-items-center"> <div class="w-full h-full grid place-items-center">
<Icon src={Bars3} micro size="18" /> <Icon src={Bars3} micro size="18" />
</div> </div>
{/if}
{#if Math.max(...Object.values($notifications)) > 0}
<div
class="w-2 h-2 absolute top-0.5 right-0.5 bg-red-500 rounded-full"
></div>
{/if}
</button>
{/snippet}
{#snippet children(open)}
{#if open}
{#await import('./Profile.svelte')}
<div class="p-8 w-full h-full grid place-items-center">
<Spinner width={20} />
</div>
{:then { default: Profile }}
<Profile />
{/await}
{/if} {/if}
{/snippet} {#if Math.max(...Object.values($notifications)) > 0}
</Menu> <div
</div> class="w-2 h-2 absolute top-0.5 right-0.5 bg-red-500 rounded-full"
></div>
{/if}
</button>
{/snippet}
{#snippet children(open)}
{#if open}
{#await import('./Profile.svelte')}
<div class="p-8 w-full h-full grid place-items-center">
<Spinner width={20} />
</div>
{:then { default: Profile }}
<Profile />
{/await}
{/if}
{/snippet}
</Menu>
</nav> </nav>
+5
View File
@@ -15,6 +15,11 @@
let { data = $bindable() } = $props() let { data = $bindable() } = $props()
$effect(() => {
if (data.filters.value.sort)
settings.defaultSort.sort = data.filters.value.sort
})
const FeedComponent = $derived( const FeedComponent = $derived(
settings.infiniteScroll && browser && !settings.posts.noVirtualize settings.infiniteScroll && browser && !settings.posts.noVirtualize
? VirtualFeed ? VirtualFeed