From e86d436c86b35c0cf41c6b6283006416af4bb6e6 Mon Sep 17 00:00:00 2001 From: Xyphyn Date: Sat, 26 Aug 2023 10:59:19 -0700 Subject: [PATCH] feat: change the way placeholders work --- src/lib/components/input/Button.svelte | 10 +++- src/lib/components/lemmy/post/PostFeed.svelte | 10 ++-- .../components/markdown/MarkdownEditor.svelte | 2 + src/lib/components/ui/Placeholder.svelte | 33 ++++++++----- src/routes/admin/applications/+page.svelte | 9 ++-- src/routes/admin/taglines/+page.svelte | 10 ++-- src/routes/inbox/+page.svelte | 17 +++---- src/routes/moderation/+page.svelte | 9 ++-- .../profile/(local_user)/blocks/+page.svelte | 40 +++++++--------- src/routes/search/+page.svelte | 9 ++-- src/routes/signup/[instance]/+page.svelte | 21 +++++++-- src/routes/u/[name]/+page.svelte | 47 +++++++++---------- 12 files changed, 121 insertions(+), 96 deletions(-) diff --git a/src/lib/components/input/Button.svelte b/src/lib/components/input/Button.svelte index ccb61586..53adfd30 100644 --- a/src/lib/components/input/Button.svelte +++ b/src/lib/components/input/Button.svelte @@ -1,5 +1,6 @@ +
- {#if $$slots.icon} + {#if icon}
- +
{/if} - {#if $$slots.title} -

- {/if} - {#if $$slots.description} -

- {/if} - +
+

+ {title} +

+ {#if description} +

{description}

+ {/if} +
+
diff --git a/src/routes/admin/applications/+page.svelte b/src/routes/admin/applications/+page.svelte index 8eaa76d1..de6862ff 100644 --- a/src/routes/admin/applications/+page.svelte +++ b/src/routes/admin/applications/+page.svelte @@ -38,8 +38,9 @@ {/if} {:else} - - - No new applications - + {/if} diff --git a/src/routes/admin/taglines/+page.svelte b/src/routes/admin/taglines/+page.svelte index f518c230..32f71d09 100644 --- a/src/routes/admin/taglines/+page.svelte +++ b/src/routes/admin/taglines/+page.svelte @@ -103,10 +103,12 @@ {:else}
- - - No taglines -
+ +
{ diff --git a/src/routes/inbox/+page.svelte b/src/routes/inbox/+page.svelte index 60c7738b..32574144 100644 --- a/src/routes/inbox/+page.svelte +++ b/src/routes/inbox/+page.svelte @@ -17,6 +17,7 @@ import { profile } from '$lib/auth.js' import Placeholder from '$lib/components/ui/Placeholder.svelte' import { fly } from 'svelte/transition' + import { searchParam } from '$lib/util.js' export let data @@ -92,10 +93,11 @@
{#if !data.data || (data.data?.length ?? 0) == 0}
- - - No new notifications - +
{:else} {#each data.data as item} @@ -105,12 +107,7 @@ {/each} { - $page.url.searchParams.set('page', p.detail.toString()) - goto($page.url.toString(), { - invalidateAll: true, - }) - }} + on:change={(p) => searchParam($page.url, 'page', p.detail.toString())} /> {/if}
diff --git a/src/routes/moderation/+page.svelte b/src/routes/moderation/+page.svelte index 9d1e808c..6436e3c5 100644 --- a/src/routes/moderation/+page.svelte +++ b/src/routes/moderation/+page.svelte @@ -51,8 +51,9 @@ {/each}
{:else} - - - No new reports - + {/if} diff --git a/src/routes/profile/(local_user)/blocks/+page.svelte b/src/routes/profile/(local_user)/blocks/+page.svelte index cc333960..edb0a09c 100644 --- a/src/routes/profile/(local_user)/blocks/+page.svelte +++ b/src/routes/profile/(local_user)/blocks/+page.svelte @@ -77,14 +77,12 @@
{:else} - - - No user blocks -

- Go to a user's profile and click "block" to stop seeing posts and - comments from them. -

-
+ {/if} {#if data.community_blocks.length > 0} @@ -106,23 +104,19 @@
{:else} - - - No community blocks -

- Go to a community's page and click "block" to stop seeing submissions - from it. -

-
+ {/if} {:else}
- - - No blocks -

- Go to a community or user's page to stop seeing submissions from it. -

-
+
{/if} diff --git a/src/routes/search/+page.svelte b/src/routes/search/+page.svelte index 6c1fbe0b..575ec0b8 100644 --- a/src/routes/search/+page.svelte +++ b/src/routes/search/+page.svelte @@ -65,10 +65,11 @@ {#if !data.results} - - - No results - + {:else} {#await data.streamed.object}
-

Create account

- {#if data.site_view.local_site.registration_mode == 'Closed'} -

Registrations are closed for this instance.

- {:else} + {#if data.site_view.local_site.registration_mode != 'Closed'} +

Create account

Submit + {:else} +
+ + + +
{/if} diff --git a/src/routes/u/[name]/+page.svelte b/src/routes/u/[name]/+page.svelte index 6b429c8f..63821842 100644 --- a/src/routes/u/[name]/+page.svelte +++ b/src/routes/u/[name]/+page.svelte @@ -33,6 +33,8 @@ import Menu from '$lib/components/ui/menu/Menu.svelte' import ShieldIcon from '$lib/components/lemmy/moderation/ShieldIcon.svelte' import MenuButton from '$lib/components/ui/menu/MenuButton.svelte' + import { searchParam } from '$lib/util.js' + import Placeholder from '$lib/components/ui/Placeholder.svelte' export let data @@ -123,7 +125,7 @@ bind:value={message} label="Message" placeholder="your hair looks nice today" - rows={3} + rows={4} />
- {#each data.items as item (item.counts.id)} - {#if isCommentView(item) && (data.type == 'all' || data.type == 'comments')} - - {:else if !isCommentView(item) && (data.type == 'all' || data.type == 'posts')} - - {/if} - {/each} + {#if data.items.length == 0} + + {:else} + {#each data.items as item (item.counts.id)} + {#if isCommentView(item) && (data.type == 'all' || data.type == 'comments')} + + {:else if !isCommentView(item) && (data.type == 'all' || data.type == 'posts')} + + {/if} + {/each} + {/if} { - $page.url.searchParams.set('page', p.detail.toString()) - goto($page.url.toString(), { - invalidateAll: true, - }) - }} + on:change={(p) => searchParam($page.url, 'page', p.detail.toString())} />