From f6172a1ed3b1bcc06021117c82753cf0d658a32c Mon Sep 17 00:00:00 2001 From: James Xylight Date: Sat, 30 Aug 2025 13:03:54 -0700 Subject: [PATCH 1/8] fix: inconsistent spacing for headers --- .../components/ui/layout/pages/Header.svelte | 2 +- src/routes/+page.svelte | 54 ++++---- src/routes/accounts/+page.svelte | 2 +- src/routes/communities/+page.svelte | 7 +- src/routes/inbox/messages/+page.svelte | 1 + src/routes/moderation/+page.svelte | 123 +++++++++--------- src/routes/search/+page.svelte | 7 +- src/routes/search/SearchBar.svelte | 2 +- src/routes/theme/+page.svelte | 4 +- 9 files changed, 101 insertions(+), 101 deletions(-) diff --git a/src/lib/components/ui/layout/pages/Header.svelte b/src/lib/components/ui/layout/pages/Header.svelte index 462fab0c..cfb51a80 100644 --- a/src/lib/components/ui/layout/pages/Header.svelte +++ b/src/lib/components/ui/layout/pages/Header.svelte @@ -43,7 +43,7 @@ {@render children?.()} {#if extended} -
+
{@render extended?.()}
{/if} diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 55107f14..920940ca 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -21,12 +21,12 @@ onMount(async () => { await data.feed.value - $effect(() => { - if (data.filters.value.type_) - settings.defaultSort.feed = data.filters.value.type_ - if (data.filters.value.sort) - settings.defaultSort.sort = data.filters.value.sort - }) + }) + $effect(() => { + if (data.filters.value.type_) + settings.defaultSort.feed = data.filters.value.type_ + if (data.filters.value.sort) + settings.defaultSort.sort = data.filters.value.sort }) const FeedComponent = $derived( @@ -45,27 +45,33 @@ {$t('routes.frontpage.title')} {#snippet extended()} -
- {#if data.filters.value.type_} - +
+ {#if data.filters.value.type_} + + {/if} + - {/if} - - + - + +
{/snippet} diff --git a/src/routes/accounts/+page.svelte b/src/routes/accounts/+page.svelte index fa79dbf5..fdb2335a 100644 --- a/src/routes/accounts/+page.svelte +++ b/src/routes/accounts/+page.svelte @@ -126,7 +126,7 @@
{/snippet} -
+ p.id == profile.meta.profile} items={profile.meta.profiles} diff --git a/src/routes/communities/+page.svelte b/src/routes/communities/+page.svelte index 0292721c..c06ee075 100644 --- a/src/routes/communities/+page.svelte +++ b/src/routes/communities/+page.svelte @@ -41,14 +41,13 @@ {$t('routes.communities.title')} -
- {$t('routes.communities.title')} - +
+ {$t('routes.communities.title')} {#snippet extended()} -
+
(searchModal.open = !searchModal.open)} > diff --git a/src/routes/moderation/+page.svelte b/src/routes/moderation/+page.svelte index c4cf40c6..d6243676 100644 --- a/src/routes/moderation/+page.svelte +++ b/src/routes/moderation/+page.svelte @@ -71,67 +71,67 @@ } -
-
- {$t('routes.moderation.title')} - {#snippet extended()} -
- - -
- {#if data.filters.community} -
    -
  • - - {$t('form.post.community')} - - {#await client().getCommunity({ id: data.filters.community })} - - {:then community} - - - - - {/await} -
  • -
- {/if} - {/snippet} -
-
- +
+ {$t('routes.moderation.title')} + {#snippet extended()} +
+ + +
+ {#if data.filters.community} +
    +
  • + + {$t('form.post.community')} + + {#await client().getCommunity({ id: data.filters.community })} + + {:then community} + + + + + {/await} +
  • +
+ {/if} + {/snippet} +
+{#if batch.progress > 0} + +{/if} {#if data.items?.value && data.items?.value.length > 0} {#snippet item(item)} @@ -165,4 +165,3 @@ description={$t('routes.moderation.empty.description')} /> {/if} -
diff --git a/src/routes/search/+page.svelte b/src/routes/search/+page.svelte index 1e7fa30d..fc56f683 100644 --- a/src/routes/search/+page.svelte +++ b/src/routes/search/+page.svelte @@ -55,12 +55,7 @@
{$t('routes.search.title')} {#snippet extended()} - +
{ - e.preventDefault() - }} - onkeypress={e => { - e.preventDefault() - open = !open - }} - {onchange} - {oncontextmenu} - {placeholder} - > - {#if placeholder} - - {/if} - {@render children?.()} - + {/snippet} - - {#snippet target(attachment)} - {@const render = passedTarget ?? selectTarget} - {@render render?.(attachment)} - {/snippet} - {#each context.options as option (option)} - {#if customOption}{@render customOption({ - option, - selected: option.value == value, - })}{:else} - { - value = option.value - await tick() - element?.dispatchEvent(new Event('change', { bubbles: true })) - }} - size="custom" - disabled={option.disabled} - color="none" - class={[ - 'min-h-0! py-1 hover:bg-slate-100 dark:hover:bg-zinc-800', - option.value == value && - 'bg-slate-100 dark:bg-zinc-800 text-primary-900 dark:text-primary-100 font-medium', - option.disabled && - 'pointer-events-none text-slate-600 dark:text-zinc-400', - option.isLabel && 'text-xs mt-2', - ]} - > - {#if option.value == value} - - {:else if option.icon} - - {/if} - {@html option.label} - + + {#snippet target(attachment)} + {@const render = passedTarget ?? selectTarget} + {@render render?.(attachment)} + {/snippet} + {#each context.options as option (option)} + {#if customOption}{@render customOption({ + option, + selected: option.value == value, + })}{:else} + { + value = option.value + await tick() + element?.dispatchEvent(new Event('change', { bubbles: true })) + }} + size="custom" + disabled={option.disabled} + color="none" + class={[ + 'min-h-0! py-1 hover:bg-slate-100 dark:hover:bg-zinc-800', + option.value == value && + 'bg-slate-100 dark:bg-zinc-800 text-primary-900 dark:text-primary-100 font-medium', + option.disabled && + 'pointer-events-none text-slate-600 dark:text-zinc-400', + option.isLabel && 'text-xs mt-2', + ]} + > + {#if option.value == value} + + {:else if option.icon} + {/if} - {/each} - + {@html option.label} + + {/if} + {/each} + diff --git a/src/routes/settings/app/+page.svelte b/src/routes/settings/app/+page.svelte index c4a59792..32ca5782 100644 --- a/src/routes/settings/app/+page.svelte +++ b/src/routes/settings/app/+page.svelte @@ -153,47 +153,41 @@ class="flex flex-row flex-wrap flex-1 gap-2 w-full lg:w-max max-w-full lg:self-end" > -
- -
-
- -
-
- + {#snippet customLabel()} +
+ + {$t('filter.location.label')} +
+ {/snippet} + + + + + + + -
+ + + + + +
Date: Sat, 30 Aug 2025 13:13:45 -0700 Subject: [PATCH 3/8] fix: neverending progress bar following redirects --- src/lib/components/ui/navbar/Profile.svelte | 2 +- src/routes/+layout.svelte | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/lib/components/ui/navbar/Profile.svelte b/src/lib/components/ui/navbar/Profile.svelte index 5dfe484a..a1d4eedb 100644 --- a/src/lib/components/ui/navbar/Profile.svelte +++ b/src/lib/components/ui/navbar/Profile.svelte @@ -133,7 +133,7 @@ {/snippet} {$t('nav.menu.settings')} - {#snippet target(attachment)} { - if (navigating.to) + if (navigating.to) { + clearTimeout(nprogressTimeout) nprogressTimeout = setTimeout( () => nProgress.start(), 200, ) as unknown as number - else { + } else { if (nprogressTimeout > -1) { clearTimeout(nprogressTimeout) nprogressTimeout = -1 From 69ee0b5c28df936c49ffdbb0145556ae2c661f6c Mon Sep 17 00:00:00 2001 From: James Xylight Date: Sat, 30 Aug 2025 13:23:58 -0700 Subject: [PATCH 4/8] misc: expose time edited on hover, close #406 --- .../components/lemmy/comment/Comment.svelte | 22 +++++++++++++++---- src/lib/components/lemmy/post/PostMeta.svelte | 16 +++++++++++--- src/lib/i18n/en.json | 3 ++- src/routes/admin/+layout.svelte | 7 ------ src/routes/admin/+layout.ts | 3 +++ 5 files changed, 36 insertions(+), 15 deletions(-) diff --git a/src/lib/components/lemmy/comment/Comment.svelte b/src/lib/components/lemmy/comment/Comment.svelte index d17372d6..9c8da7ac 100644 --- a/src/lib/components/lemmy/comment/Comment.svelte +++ b/src/lib/components/lemmy/comment/Comment.svelte @@ -5,12 +5,14 @@ import UserLink from '$lib/components/lemmy/user/UserLink.svelte' import Markdown from '$lib/components/markdown/Markdown.svelte' import { publishedToDate } from '$lib/components/util/date.js' - import RelativeDate from '$lib/components/util/RelativeDate.svelte' + import RelativeDate, { + formatRelativeDate, + } from '$lib/components/util/RelativeDate.svelte' import { t } from '$lib/i18n/translations' import { getClient } from '$lib/lemmy.svelte.js' import { errorMessage } from '$lib/lemmy/error' import { settings } from '$lib/settings.svelte' - import { Button, Modal, toast } from 'mono-svelte' + import { Button, modal, Modal, toast } from 'mono-svelte' import { Bookmark, Icon, @@ -168,8 +170,20 @@ date={publishedToDate(node.comment_view.comment.published)} /> - {#if node.comment_view.comment.updated} - + {#if node.comment_view.comment.updated}{@const edited = $t( + 'post.meta.lastEdited', + { + default: formatRelativeDate( + publishedToDate(node.comment_view.comment.updated), + { + style: 'long', + }, + ), + }, + )} +
+ +
{/if} {#if node.comment_view.comment.deleted || node.comment_view.comment.removed} {/if} {#if edited} -
+ modal({ + title: $t('common.info'), + body: $t('post.meta.lastEdited', { + default: formatRelativeDate(publishedToDate(edited), { + style: 'long', + }), + }), + })} > -
+ {/if}
import { notifications } from '$lib/auth.svelte' import Tabs from '$lib/components/ui/layout/pages/Tabs.svelte' - import {} from '$lib/components/ui/layout/Shell.svelte' import { t } from '$lib/i18n/translations' import { Badge } from 'mono-svelte' - /** - * @typedef {Object} Props - * @property {import('svelte').Snippet} [children] - */ - /** @type {Props} */ let { children } = $props() @@ -49,7 +43,6 @@ name: $t('routes.admin.media.title'), }, ]} - class="overflow-auto" /> {@render children?.()}
diff --git a/src/routes/admin/+layout.ts b/src/routes/admin/+layout.ts index bd6beb1c..b000f9f4 100644 --- a/src/routes/admin/+layout.ts +++ b/src/routes/admin/+layout.ts @@ -1,6 +1,9 @@ +import { profile } from '$lib/auth.svelte.js' import { getClient, site as siteStore } from '$lib/lemmy.svelte.js' +import { error } from '@sveltejs/kit' export async function load({ fetch }) { + if (!profile.current.jwt) error(403) const site = siteStore if (!site.data) { From e1cfff376e95fe8b311657fc0f3f868f5275dfa4 Mon Sep 17 00:00:00 2001 From: James Xylight Date: Sat, 30 Aug 2025 13:27:01 -0700 Subject: [PATCH 5/8] lint: fix lint issue --- src/lib/components/lemmy/comment/Comment.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/components/lemmy/comment/Comment.svelte b/src/lib/components/lemmy/comment/Comment.svelte index 9c8da7ac..606ad117 100644 --- a/src/lib/components/lemmy/comment/Comment.svelte +++ b/src/lib/components/lemmy/comment/Comment.svelte @@ -12,7 +12,7 @@ import { getClient } from '$lib/lemmy.svelte.js' import { errorMessage } from '$lib/lemmy/error' import { settings } from '$lib/settings.svelte' - import { Button, modal, Modal, toast } from 'mono-svelte' + import { Button, Modal, toast } from 'mono-svelte' import { Bookmark, Icon, From d93d29a8b1bfe52b4de2422c7b6cf5f9290237bc Mon Sep 17 00:00:00 2001 From: James Xylight Date: Sat, 30 Aug 2025 14:45:06 -0700 Subject: [PATCH 6/8] fix: custom labels causing missing select --- .../components/ui/navbar/commands/actions.svelte.ts | 2 +- src/lib/i18n/en.json | 4 ++-- src/lib/mono/forms/Label.svelte | 11 +++++++---- src/lib/mono/forms/select/Select.svelte | 3 +-- src/lib/mono/modal/Modal.svelte | 2 +- src/routes/moderation/+page.svelte | 12 +++++++----- 6 files changed, 19 insertions(+), 15 deletions(-) diff --git a/src/lib/components/ui/navbar/commands/actions.svelte.ts b/src/lib/components/ui/navbar/commands/actions.svelte.ts index 31b3243a..39667e06 100644 --- a/src/lib/components/ui/navbar/commands/actions.svelte.ts +++ b/src/lib/components/ui/navbar/commands/actions.svelte.ts @@ -182,7 +182,7 @@ export function getGroups( { name: t.get('filter.sort.top.time.6hours'), icon: ChartBar, - href: '/?sort=TopSixHours', + href: '/?sort=TopSixHour', }, { name: t.get('filter.sort.top.time.hour'), diff --git a/src/lib/i18n/en.json b/src/lib/i18n/en.json index 0945fbd8..7f9453a2 100644 --- a/src/lib/i18n/en.json +++ b/src/lib/i18n/en.json @@ -603,12 +603,12 @@ "title": "Removing Submission", "titleRestore": "Restoring Submission", "titlePurge": "Purging Submission", - "withReason": "Reply with reason", + "withReason": "Notify user", "comment": "Comment", "message": "Message", "failReply": "Failed to post reply. Removing anyway...", "failMessage": "Failed to message user. Removing anyway...", - "failEmptyReply": "Your reply cannot be empty if 'Reply with reason' is enabled.", + "failEmptyReply": "Your reply cannot be empty if 'Notify user' is enabled.", "successPurge": "Successfully purged that submission." }, "reportModal": { diff --git a/src/lib/mono/forms/Label.svelte b/src/lib/mono/forms/Label.svelte index 84d943f1..cd8d106f 100644 --- a/src/lib/mono/forms/Label.svelte +++ b/src/lib/mono/forms/Label.svelte @@ -1,4 +1,5 @@ {#snippet selectTarget(attachment: Attachment)} -