From 930bb932825b3eb74fe413e90838d71654f5e55e Mon Sep 17 00:00:00 2001 From: James Xylight Date: Thu, 21 Aug 2025 17:03:47 -0700 Subject: [PATCH 1/7] design: improve menus --- .../lemmy/comment/CommentActions.svelte | 7 +- .../comment/CommentListVirtualizer.svelte | 9 +- .../lemmy/post/actions/PostActionsMenu.svelte | 121 +++++++++--------- .../lemmy/post/link/PostLink.svelte | 20 ++- src/lib/mono/materials/Material.svelte | 4 +- src/lib/mono/popover/Menu.svelte | 6 +- src/lib/mono/popover/MenuButton.svelte | 5 +- src/lib/mono/popover/MenuDivider.svelte | 2 +- src/lib/mono/popover/Popover.svelte | 7 +- src/routes/instances/+layout.svelte | 24 ++++ src/routes/instances/+layout.ts | 6 + src/routes/instances/+page.svelte | 99 -------------- src/routes/instances/+page.ts | 7 +- src/routes/instances/linked/+page.svelte | 52 ++++++++ 14 files changed, 177 insertions(+), 192 deletions(-) create mode 100644 src/routes/instances/+layout.svelte create mode 100644 src/routes/instances/+layout.ts delete mode 100644 src/routes/instances/+page.svelte create mode 100644 src/routes/instances/linked/+page.svelte diff --git a/src/lib/components/lemmy/comment/CommentActions.svelte b/src/lib/components/lemmy/comment/CommentActions.svelte index 5c749bd1..3e5d72a0 100644 --- a/src/lib/components/lemmy/comment/CommentActions.svelte +++ b/src/lib/components/lemmy/comment/CommentActions.svelte @@ -11,7 +11,7 @@ import { deleteItem, save } from '$lib/lemmy/contentview.js' import { settings } from '$lib/settings.svelte' import type { CommentView } from 'lemmy-js-client' - import { Button, Menu, MenuButton, MenuDivider } from 'mono-svelte' + import { Button, Menu, MenuButton } from 'mono-svelte' import { Bookmark, BookmarkSlash, @@ -69,15 +69,14 @@ title={$t('comment.actions.label')} color="tertiary" rounding="pill" - size="square-sm" + size="square-md" class="text-slate-600 dark:text-zinc-400" > {#snippet prefix()} - + {/snippet} {/snippet} - {$t('comment.actions.label')} { if (navigator.share) diff --git a/src/lib/components/lemmy/comment/CommentListVirtualizer.svelte b/src/lib/components/lemmy/comment/CommentListVirtualizer.svelte index 676951dd..9fde335d 100644 --- a/src/lib/components/lemmy/comment/CommentListVirtualizer.svelte +++ b/src/lib/components/lemmy/comment/CommentListVirtualizer.svelte @@ -41,19 +41,14 @@
{#if offsetEl} {#snippet item(index)} -
+
[nodes[index]], v => (nodes[index] = v[0])} {post} diff --git a/src/lib/components/lemmy/post/actions/PostActionsMenu.svelte b/src/lib/components/lemmy/post/actions/PostActionsMenu.svelte index c80e9886..c05e1346 100644 --- a/src/lib/components/lemmy/post/actions/PostActionsMenu.svelte +++ b/src/lib/components/lemmy/post/actions/PostActionsMenu.svelte @@ -1,28 +1,25 @@ - - {$t('post.actions.more.actions')} - {#if profile.current?.user && profile.current?.jwt && profile.current.user.local_user_view.person.id == post.creator.id} (editing = true)}> {#snippet prefix()} @@ -65,52 +72,52 @@ : $t('post.actions.more.markRead')} {/if} - { - if (navigator.share) - navigator.share?.({ - url: localShare - ? `${instanceToURL(profile.current.instance)}/post/${post.post.id}` - : post.post.ap_id, - }) - else - navigator.clipboard.writeText( - localShare - ? `${instanceToURL(profile.current.instance)}/post/${post.post.id}` - : post.post.ap_id, - ) - toast({ content: $t('toast.copied') }) - }} - class="flex-1 py-0!" -> - {#snippet prefix()} - - {/snippet} - {$t('post.actions.more.share')} -
- {#if !post.post.local} -
- - -
- {/if} -
+
+ share()} + class={['flex-1', !post.post.local && 'rounded-r-xl']} + > + {#snippet prefix()} + + {/snippet} + {$t('post.actions.more.share')} + + + +
e.stopPropagation()} + > + {#if !post.post.local} + + {#snippet target()} + + {/snippet} + share(true)}> + {#snippet prefix()} + + {/snippet} + {$t('filter.location.global')} + + share(false)}> + {#snippet prefix()} + + {/snippet} + {$t('filter.location.local')} + + + {/if} +
+
{#if profile.current?.jwt} { diff --git a/src/lib/components/lemmy/post/link/PostLink.svelte b/src/lib/components/lemmy/post/link/PostLink.svelte index 5dc65a08..ccb58c06 100644 --- a/src/lib/components/lemmy/post/link/PostLink.svelte +++ b/src/lib/components/lemmy/post/link/PostLink.svelte @@ -1,8 +1,9 @@ - @@ -89,23 +90,20 @@ {:else} - + {/if} diff --git a/src/lib/mono/materials/Material.svelte b/src/lib/mono/materials/Material.svelte index 35d666ac..d14892c5 100644 --- a/src/lib/mono/materials/Material.svelte +++ b/src/lib/mono/materials/Material.svelte @@ -58,8 +58,8 @@ let { elevation = 'flat', padding = 'md', - rounding = 'lg', - color = 'default', + rounding = 'xl', + color = 'uniform', element = 'div', class: clazz = '', children, diff --git a/src/lib/mono/popover/Menu.svelte b/src/lib/mono/popover/Menu.svelte index c7f2ba23..522dfde7 100644 --- a/src/lib/mono/popover/Menu.svelte +++ b/src/lib/mono/popover/Menu.svelte @@ -49,12 +49,10 @@ > {#snippet popover()}
{@render children?.(open)} diff --git a/src/lib/mono/popover/MenuButton.svelte b/src/lib/mono/popover/MenuButton.svelte index 9a990f30..6569295b 100644 --- a/src/lib/mono/popover/MenuButton.svelte +++ b/src/lib/mono/popover/MenuButton.svelte @@ -37,9 +37,10 @@ {/snippet} diff --git a/src/lib/components/ui/EndPlaceholder.svelte b/src/lib/components/ui/EndPlaceholder.svelte index bab6dbb7..070a7771 100644 --- a/src/lib/components/ui/EndPlaceholder.svelte +++ b/src/lib/components/ui/EndPlaceholder.svelte @@ -1,20 +1,52 @@
{@render children?.()} -
+
{@render action?.()}
diff --git a/src/lib/components/ui/sidebar/Sidebar.svelte b/src/lib/components/ui/sidebar/Sidebar.svelte index 7e8d1b75..83a58214 100644 --- a/src/lib/components/ui/sidebar/Sidebar.svelte +++ b/src/lib/components/ui/sidebar/Sidebar.svelte @@ -97,7 +97,7 @@ > {#snippet title()} - + {$t('account.accounts')} {#snippet action()} @@ -134,7 +134,7 @@ > {#snippet title()} - + {$t('routes.profile.moderates')} {#snippet action()} @@ -185,7 +185,7 @@ > {#snippet title()} - + {$t('profile.subscribed')} {#snippet action()} diff --git a/src/lib/i18n/en.json b/src/lib/i18n/en.json index ee14b6d6..44cf3d97 100644 --- a/src/lib/i18n/en.json +++ b/src/lib/i18n/en.json @@ -281,8 +281,8 @@ "createPost": "Create Post", "createCommunity": "Create Community", "post": { - "crosspostCount": "crossposts", - "commentCount": "comments", + "crosspostCount": "Crossposts", + "commentCount": "Comments", "addComment": "Add a comment", "scrollToTop": "Scroll to top", "instanceWarning": "This post was requested from a different server than your account's. Many actions won't work.", diff --git a/src/lib/mono/forms/TextInput.svelte b/src/lib/mono/forms/TextInput.svelte index f1fcd73d..f15c8040 100644 --- a/src/lib/mono/forms/TextInput.svelte +++ b/src/lib/mono/forms/TextInput.svelte @@ -39,7 +39,7 @@ import Label from '../forms/Label.svelte' import { generateID } from '../forms/helper.js' - const borderClass = `border border-slate-200 border-b-slate-300 dark:border-zinc-800` + const borderClass = `border border-slate-200 border-b-slate-300 dark:border-t-zinc-800 dark:border-zinc-900` let { label = undefined, diff --git a/src/lib/mono/forms/select/Select.svelte b/src/lib/mono/forms/select/Select.svelte index bd4a4ea1..2d992305 100644 --- a/src/lib/mono/forms/select/Select.svelte +++ b/src/lib/mono/forms/select/Select.svelte @@ -88,7 +88,7 @@ }: Props = $props() -
+
{#if customLabel || label}