design: restructure andd redesign sidebar

This commit is contained in:
James Xylight committed 2025-08-23 14:59:35 -07:00
1 parent 0b3c1f7856
commit 0247d6dc4d
24 files changed
+281 -353

No files matched your search

+10 -32
View File
@@ -10,8 +10,7 @@
import Link from '../input/Link.svelte'
import Expandable from '../ui/Expandable.svelte'
import LabelStat from '../ui/LabelStat.svelte'
import CommonList from '../ui/layout/CommonList.svelte'
import SidebarButton from '../ui/sidebar/SidebarButton.svelte'
import ItemList from './generic/ItemList.svelte'
import { optimizeImageURL } from './post/helpers'
interface Props {
@@ -115,36 +114,15 @@
{$t('cards.site.admins')}
</span>
{/snippet}
<CommonList
animate={false}
size="xs"
items={admins}
class="px-1 py-0.5"
>
{#snippet item(admin)}
<SidebarButton
class="font-normal w-full h-max"
color="none"
alignment="left"
href={userLink(admin.person)}
>
{#snippet customIcon()}
<Avatar
url={admin.person.avatar}
alt={admin.person.name}
width={28}
/>{/snippet}
{#snippet label()}
<div class="flex flex-col max-w-full break-words">
<span>{admin.person.display_name ?? admin.person.name}</span>
<span class="text-xs text-slate-600 dark:text-zinc-400">
{new URL(admin.person.actor_id).hostname}
</span>
</div>
{/snippet}
</SidebarButton>
{/snippet}
</CommonList>
<ItemList
items={admins.map(i => ({
id: i.person.id,
name: i.person.display_name || i.person.name,
url: userLink(i.person),
avatar: i.person.avatar,
instance: new URL(i.person.actor_id).hostname,
}))}
/>
</Expandable>
{/if}
@@ -76,8 +76,6 @@
import Entity from '$lib/components/ui/Entity.svelte'
import Expandable from '$lib/components/ui/Expandable.svelte'
import LabelStat from '$lib/components/ui/LabelStat.svelte'
import CommonList from '$lib/components/ui/layout/CommonList.svelte'
import SidebarButton from '$lib/components/ui/sidebar/SidebarButton.svelte'
import { t } from '$lib/i18n/translations'
import { client, getClient } from '$lib/lemmy.svelte.js'
import { errorMessage } from '$lib/lemmy/error'
@@ -107,6 +105,7 @@
NoSymbol,
Plus,
} from 'svelte-hero-icons'
import ItemList from '../generic/ItemList.svelte'
let loading = $state({
blocking: false,
@@ -214,40 +213,15 @@
{$t('cards.community.moderators')}
</span>
{/snippet}
<CommonList
animate={false}
size="xs"
items={moderators}
class="px-1 py-0.5"
>
{#snippet item(moderator)}
<SidebarButton
class="font-normal w-full h-max"
color="none"
alignment="left"
href={userLink(moderator.moderator)}
>
{#snippet customIcon()}
<Avatar
url={moderator.moderator.avatar}
alt={moderator.moderator.name}
width={28}
/>
{/snippet}
{#snippet label()}
<div class="flex flex-col max-w-full break-words">
<span>
{moderator.moderator.display_name ??
moderator.moderator.name}
</span>
<span class="text-xs text-slate-600 dark:text-zinc-400">
{new URL(moderator.moderator.actor_id).hostname}
</span>
</div>
{/snippet}
</SidebarButton>
{/snippet}
</CommonList>
<ItemList
items={moderators.map(i => ({
id: i.moderator.id,
name: i.moderator.display_name || i.moderator.name,
url: userLink(i.moderator),
avatar: i.moderator.avatar,
instance: new URL(i.moderator.actor_id).hostname,
}))}
/>
</Expandable>
{/if}
</div>
@@ -31,8 +31,6 @@
import ItemList from '../generic/ItemList.svelte'
import { amMod, isAdmin } from '../moderation/moderation'
import { block, blockInstance, purgeCommunity } from './CommunityCard.svelte'
import CommonList from '$lib/components/ui/layout/CommonList.svelte'
import SidebarButton from '$lib/components/ui/sidebar/SidebarButton.svelte'
interface Props {
community: Community
@@ -2,8 +2,6 @@
import Avatar from '$lib/components/ui/Avatar.svelte'
import CommonList from '$lib/components/ui/layout/CommonList.svelte'
import { Button } from 'mono-svelte'
import { flip } from 'svelte/animate'
import { expoOut } from 'svelte/easing'
interface Props {
items: {
@@ -18,7 +16,7 @@
let { items }: Props = $props()
</script>
<CommonList animate={false} size="xs" {items}>
<CommonList animate={false} class="px-1 py-0.5" size="xs" {items}>
{#snippet item(item)}
<Button
class="font-normal w-full h-max block"
@@ -94,7 +94,7 @@
buttonColor.secondary,
'rounded-full h-full font-medium flex items-center *:p-2 relative',
'hover:bg-white dark:hover:bg-zinc-900 overflow-hidden transition-colors shrink-0',
'text-inherit! divide-x divide-slate-200 dark:divide-zinc-800 shadow-xs',
'text-inherit! divide-x divide-slate-200 dark:divide-zinc-800',
loading && 'animate-pulse opacity-75 pointer-events-none',
voteRatio < 85 && settings.voteRatioBar && 'vote-ratio',
]}
@@ -89,8 +89,6 @@
bind:score={post.counts.score}
bind:upvotes={post.counts.upvotes}
bind:downvotes={post.counts.downvotes}
showCounts={profile.current?.user?.local_user_view?.local_user
?.show_scores ?? true}
/>
<Button
@@ -190,7 +190,7 @@
{:else}
<VirtualList
id="feed"
class="divide-y-2 -mx-3 sm:-mx-6 divide-slate-200 dark:divide-zinc-900"
class="divide-y-2 -mx-3 sm:-mx-6 divide-slate-100 dark:divide-zinc-900"
items={posts}
{initialOffset}
overscan={3}
@@ -35,7 +35,6 @@
class={[
'flex flex-col-reverse sm:flex-row overflow-hidden gap-4 embed-card z-0 relative',
'dark:bg-zinc-950 group-hover/link:bg-slate-50 dark:group-hover/link:bg-zinc-900 transition-colors',
'shadow-xs',
]}
rounding="2xl"
element="article"
@@ -2,6 +2,7 @@
import type { ClassValue } from 'svelte/elements'
const sizes = {
xs: 'text-xs px-3 mt-3 mb-1',
sm: 'text-sm',
md: 'text-base',
lg: 'text-lg',
+1 -1
View File
@@ -44,7 +44,7 @@
<div class="absolute inset-0 h-96 overflow-x-hidden -z-10">
<img
src={banner || avatar}
class="w-full h-48 blur-3xl"
class="w-full h-64 object-cover blur-3xl opacity-30 dark:opacity-30"
height="192"
alt="User banner"
/>
+1 -1
View File
@@ -55,7 +55,7 @@
</div>
<div class={['content flex-1', settings.newWidth && 'limit-width']}>
{@render sidebar?.({
class: `hidden md:flex sticky top-0 lg:top-16 left-0 h-max bg-slate-100 dark:bg-zinc-950 z-40 max-h-screen`,
class: `hidden md:flex sticky top-0 lg:top-16 left-0 h-max bg-slate-100 dark:bg-zinc-950 z-40 max-h-[calc(100vh-4rem)] min-h-[calc(100vh-4rem)]`,
style: 'grid-area: sidebar; width: 100% !important;',
})}
{@render main?.({
@@ -29,8 +29,8 @@
class={[
pageHeader &&
`w-[calc(100%+1.5rem)] sm:w-[calc(100%+3rem)]
bg-slate-100 dark:bg-zinc-950 -mx-3 sm:-mx-6 sm:px-6 sm:pb-6 px-4 pb-4 -mt-24 pt-24
border-b border-slate-200/50 dark:border-zinc-900 margin z-20`,
bg-slate-100 dark:bg-zinc-950 -mx-3 sm:-mx-6 sm:px-6 sm:pb-6 px-4 pb-4 -mt-64 pt-64
border-b border-slate-200 dark:border-zinc-900 margin z-0`,
]}
{style}
>
@@ -27,7 +27,7 @@
</script>
<nav
class="flex flex-row items-center gap-x-8 gap-y-4 p-1 justify-center sm:justify-start my-2 sm:mt-0 flex-wrap"
class="flex flex-row items-center gap-x-8 gap-y-4 p-1 justify-center sm:justify-start my-2 sm:mt-0 flex-wrap z-20"
>
{#each routes as route (route.href)}
{@const selected = isSelected(
+183 -175
View File
@@ -1,25 +1,35 @@
<script lang="ts">
import { goto } from '$app/navigation'
import { page } from '$app/state'
import { notifications, profile } from '$lib/auth.svelte.js'
import ItemList from '$lib/components/lemmy/generic/ItemList.svelte'
import Expandable from '$lib/components/ui/Expandable.svelte'
import ProfileButton from '$lib/components/ui/sidebar/ProfileButton.svelte'
import SidebarButton from '$lib/components/ui/sidebar/SidebarButton.svelte'
import { t } from '$lib/i18n/translations'
import { communityLink } from '$lib/lemmy/generic'
import { settings } from '$lib/settings.svelte.js'
import { Badge } from 'mono-svelte'
import { Badge, Button, Menu, MenuButton, Option, Select } from 'mono-svelte'
import {
ArrowLeftOnRectangle,
Bookmark,
CheckCircle,
ChevronUpDown,
Cog6Tooth,
ComputerDesktop,
Icon,
Identification,
Inbox,
Moon,
QuestionMarkCircle,
Sun,
Swatch,
UserCircle,
UserGroup,
} from 'svelte-hero-icons'
import type { ClassValue } from 'svelte/elements'
import Avatar from '../Avatar.svelte'
import EndPlaceholder from '../EndPlaceholder.svelte'
import CommonList from '../layout/CommonList.svelte'
import { theme } from '$lib/ui/colors.svelte'
interface Props {
style?: string
@@ -30,201 +40,199 @@
</script>
<nav class={['flex flex-col overflow-auto gap-1', clazz]} {style}>
<Menu placement="bottom">
{#snippet target()}
<Button
color="tertiary"
alignment="left"
size="md"
class="flex flex-row gap-2 items-center"
>
{#snippet prefix()}
<Avatar
url={profile.current.avatar}
alt={profile.current.username}
width={24}
/>
{/snippet}
<div class="flex-1">
<div class="font-medium">{profile.current.username}</div>
<div class="text-xs text-slate-500 dark:text-zinc-500">
{profile.current.instance}
</div>
</div>
{#snippet suffix()}
<Icon
src={ChevronUpDown}
size="16"
micro
class="block justify-self-end"
/>
{/snippet}
</Button>
{/snippet}
{#each profile.meta.profiles as p}
<MenuButton
onclick={() => {
profile.meta.profile = p.id
goto(page.url, {
invalidateAll: true,
})
}}
>
{#snippet prefix()}
<Avatar url={p.avatar} alt={p.username} width={24} />
{/snippet}
<div>
<div class="font-medium text-sm">{p.username}</div>
<div class="text-xs text-slate-500 dark:text-zinc-500">
{p.instance}
</div>
</div>
{#if profile.meta.profile == p.id}
<Icon
src={CheckCircle}
class="text-primary-900 dark:text-primary-100 ml-auto"
size="16"
micro
/>
{/if}
{#if !p.jwt}
<Badge color="gray-subtle" class="ml-auto p-1!">
<Icon src={QuestionMarkCircle} size="16" micro />
</Badge>
{/if}
</MenuButton>
{/each}
<MenuButton href="/accounts">
{#snippet prefix()}
<Icon src={UserGroup} size="16" micro />
{/snippet}
{$t('account.accounts')}
</MenuButton>
</Menu>
<EndPlaceholder size="xs">{$t('profile.profile')}</EndPlaceholder>
{#if profile.current?.jwt}
<SidebarButton icon={UserCircle} href="/profile">
{#snippet label()}
<span>
{$t('profile.profile')}
</span>
{/snippet}
</SidebarButton>
<SidebarButton icon={Inbox} href="/inbox">
{#snippet label()}
<span class="flex items-center gap-2">
{$t('profile.inbox')}
{#if $notifications.inbox}
<Badge
class="min-w-5 h-5 p-0! px-0.5 grid place-items-center ml-auto"
color="red-subtle"
>
{$notifications.inbox > 99 ? '∞' : $notifications.inbox}
</Badge>
{/if}
</span>
{/snippet}
</SidebarButton>
<SidebarButton icon={Bookmark} href="/saved">
{#snippet label()}
<span>{$t('profile.saved')}</span>
{/snippet}
<SidebarButton
icon={UserCircle}
href="/profile"
label={$t('profile.profile')}
/>
<SidebarButton icon={Inbox} href="/inbox" label={$t('profile.inbox')}>
{#if $notifications.inbox}
<Badge
class="min-w-5 h-5 p-0! px-0.5 grid place-items-center ml-auto"
color="red-subtle"
>
{$notifications.inbox > 99 ? '∞' : $notifications.inbox}
</Badge>
{/if}
</SidebarButton>
<SidebarButton icon={Bookmark} href="/saved" label={$t('profile.saved')} />
{:else}
<SidebarButton
href="/login"
title={$t('account.login')}
label={$t('account.login')}
icon={ArrowLeftOnRectangle}
>
{#snippet label()}
<span>{$t('account.login')}</span>
{/snippet}
</SidebarButton>
/>
<SidebarButton
href="/signup"
title={$t('account.signup')}
label={$t('account.signup')}
icon={Identification}
>
{#snippet label()}
<span>{$t('account.signup')}</span>
{/snippet}
</SidebarButton>
/>
<SidebarButton
href="/settings"
title={$t('nav.menu.settings')}
icon={Cog6Tooth}
>
{#snippet label()}
<span>{$t('nav.menu.settings')}</span>
{/snippet}
</SidebarButton>
href="/accounts"
title={$t('accounts.accounts')}
icon={UserGroup}
/>
{/if}
{#if profile.meta.profiles.length >= 1}
<hr class="border-slate-200 dark:border-zinc-900 my-1" />
<Expandable
class="max-w-full min-w-0 w-full"
bind:open={settings.expand.accounts}
>
{#snippet title()}
<span class="px-2 py-1 w-full">
<EndPlaceholder border={false}>
{$t('account.accounts')}
{#snippet action()}
<span class="dark:text-white text-black">
{profile.meta.profiles.length}
</span>
{/snippet}
</EndPlaceholder>
</span>
{/snippet}
<CommonList
size="xs"
animate={false}
items={profile.meta.profiles}
class="px-1 py-0.5"
selected={prof => prof.id == profile.meta.profile}
<EndPlaceholder size="xs">{$t('nav.menu.app')}</EndPlaceholder>
<SidebarButton
href="/settings"
label={$t('nav.menu.settings')}
icon={Cog6Tooth}
/>
<Select bind:value={theme.colorScheme} size="sm">
{#snippet target()}
<SidebarButton
label={$t('nav.menu.colorscheme.label')}
icon={theme.colorScheme == 'system'
? ComputerDesktop
: theme.colorScheme == 'light'
? Sun
: Moon}
class=" w-full"
>
{#snippet item(prof, index)}
<ProfileButton {index} {prof} />
{/snippet}
<li class="xs px-1 py-0.5">
<SidebarButton href="/accounts" icon={UserGroup}>
{$t('account.accounts')}
</SidebarButton>
</li>
</CommonList>
</Expandable>
{/if}
<hr class="border-slate-200 dark:border-zinc-900 my-1" />
<Option value="system" class="hidden" icon={ComputerDesktop}>
{$t('nav.menu.colorscheme.system')}
</Option>
<Option value="light" class="hidden" icon={Sun}>
{$t('nav.menu.colorscheme.light')}
</Option>
<Option value="dark" class="hidden" icon={Moon}>
{$t('nav.menu.colorscheme.dark')}
</Option>
</SidebarButton>
{/snippet}
</Select>
<SidebarButton href="/theme" label={$t('nav.menu.theme')} icon={Swatch} />
{#if profile.current?.user}
{#if profile.current?.user.moderates.length > 0}
<Expandable
class="max-w-full min-w-0 w-full"
bind:open={settings.expand.moderates}
>
<EndPlaceholder size="xs">{$t('content.communities')}</EndPlaceholder>
<div class="space-y-3">
{#if profile.current?.user.moderates.length > 0}
<Expandable class="px-1.5" bind:open={settings.expand.moderates}>
{#snippet title()}
<span class="px-2 py-1 w-full">
<EndPlaceholder border={false}>
{$t('routes.profile.moderates')}
{#snippet action()}
<span class="dark:text-white text-black">
{profile.current.user?.moderates.length}
</span>
{/snippet}
</EndPlaceholder>
</span>
{/snippet}
<ItemList
items={profile.current.user.moderates.map(i => ({
id: i.community.id,
name: i.community.title,
url: communityLink(i.community),
avatar: i.community.icon,
instance: new URL(i.community.actor_id).hostname,
}))}
/>
</Expandable>
{/if}
<Expandable class="px-1.5" bind:open={settings.expand.communities}>
{#snippet title()}
<span class="px-2 py-1 w-full">
<EndPlaceholder border={false}>
{$t('routes.profile.moderates')}
{$t('profile.subscribed')}
{#snippet action()}
<span class="dark:text-white text-black">
{profile.current.user?.moderates.length}
{profile.current.user?.follows.length}
</span>
{/snippet}
</EndPlaceholder>
</span>
{/snippet}
<CommonList
animate={false}
size="xs"
items={profile.current.user.moderates}
class="px-1 py-0.5"
>
{#snippet item(moderate)}
<SidebarButton
class="font-normal w-full h-max"
color="none"
alignment="left"
href={communityLink(moderate.community)}
>
{#snippet customIcon()}
<Avatar
url={moderate.community.icon}
alt={moderate.community.name}
title={moderate.community.title}
width={28}
/>{/snippet}
{#snippet label()}
<div class="flex flex-col max-w-full break-words">
<span>{moderate.community.title}</span>
<span class="text-xs text-slate-600 dark:text-zinc-400">
{new URL(moderate.community.actor_id).hostname}
</span>
</div>
{/snippet}
</SidebarButton>
{/snippet}
</CommonList>
</Expandable>
<hr class="border-slate-200 dark:border-zinc-900 my-1" />
{/if}
<Expandable
class="max-w-full min-w-0 w-full"
bind:open={settings.expand.communities}
>
{#snippet title()}
<span class="px-2 py-1 w-full">
<EndPlaceholder border={false}>
{$t('profile.subscribed')}
{#snippet action()}
<span class="dark:text-white text-black">
{profile.current.user?.follows.length}
</span>
{/snippet}
</EndPlaceholder>
</span>
{/snippet}
<CommonList
animate={false}
size="xs"
items={profile.current.user.follows}
class="px-1 py-0.5"
>
{#snippet item(follow)}
<SidebarButton
class="font-normal w-full h-max"
color="none"
alignment="left"
href={communityLink(follow.community)}
>
{#snippet customIcon()}
<Avatar
url={follow.community.icon}
alt={follow.community.name}
title={follow.community.title}
width={28}
/>{/snippet}
{#snippet label()}
<div class="flex flex-col max-w-full break-words">
<span>{follow.community.title}</span>
<span class="text-xs text-slate-600 dark:text-zinc-400">
{new URL(follow.community.actor_id).hostname}
</span>
</div>
{/snippet}
</SidebarButton>
{/snippet}
</CommonList>
</Expandable>
<ItemList
items={profile.current.user.follows.map(i => ({
id: i.community.id,
name: i.community.title,
url: communityLink(i.community),
avatar: i.community.icon,
instance: new URL(i.community.actor_id).hostname,
}))}
/>
</Expandable>
</div>
{/if}
<div class="flex-1 h-full mt-auto"></div>
</nav>
@@ -8,9 +8,9 @@
href?: string | undefined
icon?: IconSource | undefined
class?: string
label?: string
customIcon?: import('svelte').Snippet<[{ selected: boolean }]>
children?: import('svelte').Snippet
label?: import('svelte').Snippet
}
let {
@@ -27,9 +27,9 @@
</script>
<Button
color="none"
color="tertiary"
alignment="left"
rounding="pill"
rounding="xl"
{...rest}
{href}
class={[
@@ -49,8 +49,6 @@
<Icon src={icon} solid size="20" />
{/if}
{/snippet}
{label}
{@render children?.()}
<div class="contents">
{@render label?.()}
</div>
</Button>
+7 -7
View File
@@ -18,7 +18,7 @@
hover:bg-slate-100 dark:hover:bg-zinc-800 dark:hover:border-zinc-700 dark:active:bg-zinc-900 active:bg-slate-200`,
tertiary:
'border border-transparent bg-transparent hover:bg-slate-100 dark:hover:bg-zinc-700/30 dark:text-zinc-200',
' bg-transparent hover:bg-slate-200/50 dark:hover:bg-zinc-700/30 dark:text-zinc-200',
danger:
'border border-red-500 bg-red-500 hover:text-red-500 hover:bg-transparent text-white',
@@ -47,9 +47,9 @@
export const buttonSize = {
xs: 'px-2 py-1 text-xs',
sm: 'px-3 py-1.5 text-[12px]',
md: 'px-3 py-1.5',
lg: 'px-4 py-2',
xl: 'px-6 py-3',
md: 'px-3 py-1.5 text-sm',
lg: 'px-4 py-2 text-sm',
xl: 'px-6 py-3 text-base',
'square-sm': 'w-6 h-6',
'square-md': 'w-8 h-8',
'square-lg': 'w-10 h-10',
@@ -105,7 +105,7 @@
size = 'md',
rounding = size == 'lg' ? 'xl' : 'lg',
alignment = 'center',
shadow = color != 'tertiary' ? 'sm' : 'none',
shadow = color != 'tertiary' ? 'none' : 'none',
column = false,
disabled,
loaderWidth = undefined,
@@ -129,7 +129,7 @@
buttonRounding[rounding],
buttonShadow[shadow],
buttonColor[color],
'text-sm transition-all font-medium cursor-pointer duration-75 disabled:opacity-50 disabled:pointer-events-none disabled:shadow-none',
'transition-all font-medium cursor-pointer duration-75 disabled:opacity-50 disabled:pointer-events-none disabled:shadow-none text-sm',
(disabled || loading) && 'pointer-events-none opacity-50 shadow-none',
alignment == 'center'
? 'origin-center'
@@ -144,7 +144,7 @@
class={[
'flex',
column ? 'flex-col justify-center' : 'flex-row items-center',
'h-full gap-1.5 button-content',
'h-full gap-1.5 button-content w-full',
buttonAlignment[alignment],
]}
>
+36 -34
View File
@@ -24,6 +24,7 @@
},
]
>
target?: Snippet
oncontextmenu?: HTMLSelectAttributes['oncontextmenu']
onchange?: HTMLSelectAttributes['onchange']
placement?: Placement
@@ -33,7 +34,7 @@
</script>
<script lang="ts" generics="T">
import { setContext, tick } from 'svelte'
import { setContext, tick, type Snippet } from 'svelte'
import {
CheckCircle,
ChevronUpDown,
@@ -87,10 +88,43 @@
oncontextmenu,
onchange,
placement = 'bottom',
target,
...rest
}: Props<T> = $props()
</script>
{#snippet selectTarget()}
<select
{...rest}
{id}
bind:this={element}
class={[
buttonSize[size],
buttonShadow[shadow],
buttonColor.secondary,
'appearance-none transition-colors rounded-xl text-sm w-full min-w-full cursor-pointer pr-6',
selectClass,
clazz,
]}
bind:value
onmousedown={e => {
e.preventDefault()
}}
onkeypress={e => {
e.preventDefault()
open = !open
}}
{onchange}
{oncontextmenu}
{placeholder}
>
{#if placeholder}
<option disabled selected value="">{placeholder}</option>
{/if}
{@render children?.()}
</select>
{/snippet}
<div class={['flex flex-col gap-1', clazz, baseClass]}>
{#if customLabel || label}
<Label for={id} text={label}>
@@ -99,39 +133,7 @@
{/if}
<div class="w-full relative">
<Menu bind:open {placement}>
{#snippet target()}
<select
{...rest}
{id}
bind:this={element}
class={[
buttonSize[size],
buttonShadow[shadow],
buttonColor.secondary,
'appearance-none transition-colors rounded-xl text-sm w-full min-w-full cursor-pointer pr-6',
selectClass,
clazz,
]}
bind:value
onmousedown={e => {
e.preventDefault()
}}
onkeypress={e => {
e.preventDefault()
open = !open
}}
{onchange}
{oncontextmenu}
{placeholder}
>
{#if placeholder}
<option disabled selected value="">{placeholder}</option>
{/if}
{@render children?.()}
</select>
{/snippet}
<Menu bind:open {placement} target={target ?? selectTarget}>
{#each context.options as option (option)}
{#if customOption}{@render customOption({
option,
@@ -6,9 +6,9 @@
import Header from '$lib/components/ui/layout/pages/Header.svelte'
import ProfileButton from '$lib/components/ui/sidebar/ProfileButton.svelte'
import SidebarButton from '$lib/components/ui/sidebar/SidebarButton.svelte'
import { t } from '$lib/i18n/translations'
import { client } from '$lib/lemmy.svelte'
import { errorMessage } from '$lib/lemmy/error'
import { t } from '$lib/i18n/translations'
import { toast } from 'mono-svelte'
import Button from 'mono-svelte/button/Button.svelte'
import Material from 'mono-svelte/materials/Material.svelte'
@@ -1,16 +1,15 @@
<script lang="ts">
import { profile } from '$lib/auth.svelte.js'
import ImageInputUpload from '$lib/components/form/ImageInputUpload.svelte'
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
import Header from '$lib/components/ui/layout/pages/Header.svelte'
import SectionTitle from '$lib/components/ui/SectionTitle.svelte'
import { t } from '$lib/i18n/translations.js'
import { getClient, site } from '$lib/lemmy.svelte.js'
import { uploadImage } from '$lib/util.svelte.js'
import type { SaveUserSettings } from 'lemmy-js-client'
import {
Badge,
Button,
ImageInput,
Material,
Menu,
MenuButton,
@@ -20,7 +19,6 @@
} from 'mono-svelte'
import { Icon, Plus } from 'svelte-hero-icons'
import type { PageData } from './$types'
import ImageInputUpload from '$lib/components/form/ImageInputUpload.svelte'
interface Props {
inline?: boolean
@@ -110,6 +108,9 @@
<Switch bind:checked={formData.show_bot_accounts}>
{$t('form.profile.showBots')}
</Switch>
<Switch bind:checked={formData.show_read_posts}>
{$t('form.profile.showRead')}
</Switch>
<div class="space-y-1">
<SectionTitle id="languages">
{$t('form.profile.languages.title')}
+6 -17
View File
@@ -1,8 +1,6 @@
<script>
import Tabs from '$lib/components/ui/layout/pages/Tabs.svelte'
import { t } from '$lib/i18n/translations'
import { site } from '$lib/lemmy.svelte'
import { feature } from '$lib/version'
import { Button, Menu, MenuButton } from 'mono-svelte'
import {
ArrowDown,
@@ -28,10 +26,6 @@
<div class="flex flex-row justify-between">
<Tabs
routes={[
{
href: '/profile',
name: $t('profile.profile'),
},
{
href: '/profile/user',
name: $t('routes.profile.submissions'),
@@ -52,21 +46,16 @@
name: $t('routes.profile.credentials'),
},
]}
/>
{#if feature('mediaAndVotes', site.data?.version)}
>
<Menu class="flex-1" placement="bottom-end">
{#snippet target()}
<Button
title={$t('post.actions.more.label')}
size="square-lg"
rounding="pill"
aria-label={$t('post.actions.more.label')}
size="square-sm"
color="none"
class="bg-white/60 dark:bg-zinc-800/60
border border-slate-200/60 dark:border-zinc-800
backdrop-blur-xl shadow-xl hover:bg-slate-100 dark:hover:bg-zinc-800
shrink-0"
class="z-0 text-slate-600 dark:text-zinc-500 hover:bg-slate-100 hover:dark:bg-zinc-800"
>
<Icon src={EllipsisHorizontal} size="16" mini />
<Icon src={EllipsisHorizontal} size="16" micro />
</Button>
{/snippet}
<MenuButton href="/profile/media">
@@ -88,7 +77,7 @@
{$t('routes.profile.downvoted')}
</MenuButton>
</Menu>
{/if}
</Tabs>
</div>
{@render children?.()}
</div>
-8
View File
@@ -1,8 +0,0 @@
<script lang="ts">
import Header from '$lib/components/ui/layout/pages/Header.svelte'
import { t } from '$lib/i18n/translations.js'
</script>
<Header pageHeader>
{$t('profile.profile')}
</Header>
+5
View File
@@ -0,0 +1,5 @@
import { redirect } from '@sveltejs/kit'
export function load() {
redirect(302, '/profile/user')
}
+2 -3
View File
@@ -6,7 +6,6 @@
{#if data.user && data.sort && data.type && data.page}
<UserPage
inline
data={{
items: new ReactiveState(data.user.submissions),
filters: new ReactiveState({
@@ -14,8 +13,8 @@
sort: data.sort,
type: data.type,
}),
person_view: {value: data.user.person_view},
moderates: {value: data.user.moderates},
person_view: { value: data.user.person_view },
moderates: { value: data.user.moderates },
}}
/>
{:else}
+4 -16
View File
@@ -3,6 +3,7 @@
import { page } from '$app/state'
import { profile } from '$lib/auth.svelte.js'
import CommentItem from '$lib/components/lemmy/comment/CommentItem.svelte'
import Sort from '$lib/components/lemmy/dropdowns/Sort.svelte'
import ItemList from '$lib/components/lemmy/generic/ItemList.svelte'
import { ban, isAdmin } from '$lib/components/lemmy/moderation/moderation.js'
import ShieldIcon from '$lib/components/lemmy/moderation/ShieldIcon.svelte'
@@ -34,7 +35,6 @@
import {
AdjustmentsHorizontal,
AtSymbol,
ChartBar,
EllipsisHorizontal,
Envelope,
Fire,
@@ -330,22 +330,10 @@
<Option value="posts">{$t('content.posts')}</Option>
<Option value="comments">{$t('content.comments')}</Option>
</Select>
<Select
bind:value={data.filters.value.sort}
name="sort"
<Sort
bind:selected={data.filters.value.sort}
onchange={() => sortForm?.requestSubmit()}
>
{#snippet customLabel()}
<span class="flex items-center gap-1">
<Icon src={ChartBar} size="14" mini />
{$t('filter.sort.label')}
</span>
{/snippet}
<Option value="New">{$t('filter.sort.new')}</Option>
<Option value="TopAll">{$t('filter.sort.top.label')}</Option>
<Option value="Old">{$t('filter.sort.old')}</Option>
<Option value="Controversial">{$t('filter.sort.controversial')}</Option>
</Select>
/>
</form>
{#if data.items.value.length == 0}
<Placeholder