feat: change the way placeholders work
This commit is contained in:
1 parent
8aa62b046e
commit
e86d436c86
12 files changed
+121
-96
No files matched your search
@@ -1,5 +1,6 @@
|
||||
<script lang="ts">
|
||||
import Spinner from '$lib/components/ui/loader/Spinner.svelte'
|
||||
import { Icon, type IconSource } from 'svelte-hero-icons'
|
||||
|
||||
type ButtonColor = keyof typeof buttonColor
|
||||
type ButtonSize = keyof typeof buttonSize
|
||||
@@ -66,6 +67,7 @@
|
||||
export let size: ButtonSize = 'md'
|
||||
export let rounded: ButtonRoundness = 'md'
|
||||
export let alignment: ButtonAlignment = 'center'
|
||||
export let icon: IconSource | undefined = undefined
|
||||
|
||||
export let loaderWidth: number | undefined = undefined
|
||||
|
||||
@@ -108,8 +110,10 @@
|
||||
? 16
|
||||
: 16}
|
||||
/>
|
||||
{:else}
|
||||
{:else if $$slots.icon}
|
||||
<slot name="icon" />
|
||||
{:else if icon}
|
||||
<Icon src={icon} size="16" mini />
|
||||
{/if}
|
||||
<slot />
|
||||
</div>
|
||||
@@ -148,8 +152,10 @@
|
||||
? 16
|
||||
: 16}
|
||||
/>
|
||||
{:else}
|
||||
{:else if $$slots.icon}
|
||||
<slot name="icon" />
|
||||
{:else if icon}
|
||||
<Icon src={icon} size="16" mini />
|
||||
{/if}
|
||||
<slot />
|
||||
</div>
|
||||
|
||||
@@ -12,10 +12,12 @@
|
||||
|
||||
{#if posts.length == 0}
|
||||
<div class="h-full grid place-items-center">
|
||||
<Placeholder>
|
||||
<Icon src={ArchiveBox} size="32" solid slot="icon" />
|
||||
<span slot="title">No posts</span>
|
||||
<Button href="/communities" class="mt-4" slot="action">
|
||||
<Placeholder
|
||||
icon={ArchiveBox}
|
||||
title="No posts"
|
||||
description="There are no posts that match this filter."
|
||||
>
|
||||
<Button href="/communities">
|
||||
<Icon src={Plus} size="16" mini slot="icon" />
|
||||
<span>Follow some communities</span>
|
||||
</Button>
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
export let label: string | undefined = undefined
|
||||
export let previewButton: boolean = false
|
||||
export let disabled: boolean = false
|
||||
export let rows: number = 4
|
||||
|
||||
export let beforePreview: (input: string) => string = (input) => input
|
||||
|
||||
@@ -241,6 +242,7 @@ overflow-hidden focus-within:border-black focus-within:dark:border-white transit
|
||||
}
|
||||
}
|
||||
}}
|
||||
{rows}
|
||||
{...$$restProps}
|
||||
/>
|
||||
{/if}
|
||||
|
||||
@@ -1,18 +1,29 @@
|
||||
<script lang="ts">
|
||||
import { Icon, type IconSource } from 'svelte-hero-icons'
|
||||
|
||||
export let icon: IconSource | undefined = undefined
|
||||
|
||||
export let title: string
|
||||
export let description: string | undefined = undefined
|
||||
</script>
|
||||
|
||||
<div
|
||||
class="text-slate-600 dark:text-zinc-400 flex flex-col justify-center items-center gap-1"
|
||||
class="text-slate-700 dark:text-zinc-300 flex flex-col justify-center items-center gap-2"
|
||||
>
|
||||
{#if $$slots.icon}
|
||||
{#if icon}
|
||||
<div
|
||||
class="bg-slate-100 border border-slate-200 dark:border-zinc-700 dark:bg-zinc-800 p-3 rounded-full"
|
||||
class="border border-slate-200 dark:border-zinc-700 dark:bg-zinc-800 p-3 rounded-full"
|
||||
>
|
||||
<slot name="icon" />
|
||||
<Icon src={icon} size="28" />
|
||||
</div>
|
||||
{/if}
|
||||
{#if $$slots.title}
|
||||
<h1 class="font-bold text-lg"><slot name="title" /></h1>
|
||||
{/if}
|
||||
{#if $$slots.description}
|
||||
<p class="text-sm text-center"><slot name="description" /></p>
|
||||
{/if}
|
||||
<slot name="action" />
|
||||
<div class="flex flex-col gap-1 text-center">
|
||||
<h1 class="text-slate-900 dark:text-zinc-100 text-lg font-medium">
|
||||
{title}
|
||||
</h1>
|
||||
{#if description}
|
||||
<p class="text-sm text-center font-normal">{description}</p>
|
||||
{/if}
|
||||
</div>
|
||||
<slot />
|
||||
</div>
|
||||
@@ -38,8 +38,9 @@
|
||||
</div>
|
||||
{/if}
|
||||
{:else}
|
||||
<Placeholder>
|
||||
<Icon src={ClipboardDocumentCheck} size="28" slot="icon" />
|
||||
<span slot="title">No new applications</span>
|
||||
</Placeholder>
|
||||
<Placeholder
|
||||
icon={ClipboardDocumentCheck}
|
||||
title="No new applications"
|
||||
description="Applications to join your instance will appear here."
|
||||
/>
|
||||
{/if}
|
||||
@@ -103,10 +103,12 @@
|
||||
</form>
|
||||
{:else}
|
||||
<div class="my-auto">
|
||||
<Placeholder>
|
||||
<Icon src={Plus} solid size="28" slot="icon" />
|
||||
<span slot="title">No taglines</span>
|
||||
<div slot="action" class="mt-4 max-w-xl w-full flex flex-col gap-2">
|
||||
<Placeholder
|
||||
icon={Plus}
|
||||
title="No taglines"
|
||||
description="A random tagline will appear when users visit your instance."
|
||||
>
|
||||
<div class="mt-4 max-w-xl w-full flex flex-col gap-2">
|
||||
<form
|
||||
class="flex flex-col gap-2 w-full"
|
||||
on:submit|preventDefault={() => {
|
||||
|
||||
@@ -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 @@
|
||||
<div class="flex flex-col gap-4 list-none my-4 flex-1">
|
||||
{#if !data.data || (data.data?.length ?? 0) == 0}
|
||||
<div class="mt-auto">
|
||||
<Placeholder>
|
||||
<Icon src={Inbox} size="28" slot="icon" />
|
||||
<span slot="title">No new notifications</span>
|
||||
</Placeholder>
|
||||
<Placeholder
|
||||
icon={Inbox}
|
||||
title="No new notifications"
|
||||
description="Messages, replies, and mentions will appear here."
|
||||
/>
|
||||
</div>
|
||||
{:else}
|
||||
{#each data.data as item}
|
||||
@@ -105,12 +107,7 @@
|
||||
{/each}
|
||||
<Pageination
|
||||
page={data.page}
|
||||
on:change={(p) => {
|
||||
$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}
|
||||
</div>
|
||||
@@ -51,8 +51,9 @@
|
||||
{/each}
|
||||
</div>
|
||||
{:else}
|
||||
<Placeholder>
|
||||
<Icon src={Inbox} size="28" slot="icon" />
|
||||
<span slot="title">No new reports</span>
|
||||
</Placeholder>
|
||||
<Placeholder
|
||||
icon={Inbox}
|
||||
title="No new reports"
|
||||
description="When submissions are reported, you can act on them here."
|
||||
/>
|
||||
{/if}
|
||||
@@ -77,14 +77,12 @@
|
||||
</EditableList>
|
||||
</div>
|
||||
{:else}
|
||||
<Placeholder>
|
||||
<Icon src={Check} size="48" slot="icon" />
|
||||
<span slot="title">No user blocks</span>
|
||||
<p slot="description">
|
||||
Go to a user's profile and click "block" to stop seeing posts and
|
||||
comments from them.
|
||||
</p>
|
||||
</Placeholder>
|
||||
<Placeholder
|
||||
description="Go to a user's profile and click 'block' to stop seeing posts and
|
||||
comments from them."
|
||||
title="No user blocks"
|
||||
icon={Check}
|
||||
/>
|
||||
{/if}
|
||||
|
||||
{#if data.community_blocks.length > 0}
|
||||
@@ -106,23 +104,19 @@
|
||||
</EditableList>
|
||||
</div>
|
||||
{:else}
|
||||
<Placeholder>
|
||||
<Icon src={Check} size="48" slot="icon" />
|
||||
<span slot="title">No community blocks</span>
|
||||
<p slot="description">
|
||||
Go to a community's page and click "block" to stop seeing submissions
|
||||
from it.
|
||||
</p>
|
||||
</Placeholder>
|
||||
<Placeholder
|
||||
description="Go to a community's page and click 'block' to stop seeing posts and
|
||||
comments from it."
|
||||
title="No community blocks"
|
||||
icon={Check}
|
||||
/>
|
||||
{/if}
|
||||
{:else}
|
||||
<div class="my-auto">
|
||||
<Placeholder>
|
||||
<Icon src={Check} size="48" slot="icon" />
|
||||
<span slot="title">No blocks</span>
|
||||
<p slot="description">
|
||||
Go to a community or user's page to stop seeing submissions from it.
|
||||
</p>
|
||||
</Placeholder>
|
||||
<Placeholder
|
||||
description="Go to a community or user's page to stop seeing submissions from it."
|
||||
title="No blocks"
|
||||
icon={Check}
|
||||
/>
|
||||
</div>
|
||||
{/if}
|
||||
@@ -65,10 +65,11 @@
|
||||
</div>
|
||||
</div>
|
||||
{#if !data.results}
|
||||
<Placeholder>
|
||||
<Icon src={MagnifyingGlass} size="28" solid slot="icon" />
|
||||
<span slot="title">No results</span>
|
||||
</Placeholder>
|
||||
<Placeholder
|
||||
icon={MagnifyingGlass}
|
||||
title="No results"
|
||||
description="Search across the fediverse"
|
||||
/>
|
||||
{:else}
|
||||
{#await data.streamed.object}
|
||||
<div
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
import Markdown from '$lib/components/markdown/Markdown.svelte'
|
||||
import Avatar from '$lib/components/ui/Avatar.svelte'
|
||||
import Card from '$lib/components/ui/Card.svelte'
|
||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||
import Spinner from '$lib/components/ui/loader/Spinner.svelte'
|
||||
import { toast } from '$lib/components/ui/toasts/toasts.js'
|
||||
import { getClient } from '$lib/lemmy.js'
|
||||
@@ -17,7 +18,9 @@
|
||||
ExclamationCircle,
|
||||
ExclamationTriangle,
|
||||
Icon,
|
||||
Plus,
|
||||
QuestionMarkCircle,
|
||||
XCircle,
|
||||
} from 'svelte-hero-icons'
|
||||
|
||||
export let data
|
||||
@@ -102,10 +105,8 @@
|
||||
{data.site_view.site.name}
|
||||
</span>
|
||||
|
||||
<h1 class="font-bold text-3xl">Create account</h1>
|
||||
{#if data.site_view.local_site.registration_mode == 'Closed'}
|
||||
<p class="mx-auto text-left">Registrations are closed for this instance.</p>
|
||||
{:else}
|
||||
{#if data.site_view.local_site.registration_mode != 'Closed'}
|
||||
<h1 class="font-bold text-3xl">Create account</h1>
|
||||
<TextInput
|
||||
bind:value={email}
|
||||
label="Email"
|
||||
@@ -198,5 +199,17 @@
|
||||
>
|
||||
Submit
|
||||
</Button>
|
||||
{:else}
|
||||
<div class="my-auto">
|
||||
<Placeholder
|
||||
icon={XCircle}
|
||||
title="Registrations closed"
|
||||
description="New account creation has been disabled on this instance."
|
||||
>
|
||||
<Button icon={Plus} href="https://join-lemmy.org">
|
||||
Find another instance
|
||||
</Button>
|
||||
</Placeholder>
|
||||
</div>
|
||||
{/if}
|
||||
</form>
|
||||
@@ -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}
|
||||
/>
|
||||
<Button
|
||||
color="primary"
|
||||
@@ -145,40 +147,33 @@
|
||||
options={['New', 'TopAll', 'Old']}
|
||||
optionNames={['New', 'Top', 'Old']}
|
||||
selected={data.sort}
|
||||
on:select={(e) => {
|
||||
$page.url.searchParams.set('sort', e.detail)
|
||||
goto($page.url.toString(), {
|
||||
invalidateAll: true,
|
||||
})
|
||||
}}
|
||||
on:select={(e) => searchParam($page.url, 'sort', e.detail, 'page')}
|
||||
/>
|
||||
<MultiSelect
|
||||
options={['all', 'posts', 'comments']}
|
||||
optionNames={['All', 'Posts', 'Comments']}
|
||||
selected={data.type}
|
||||
on:select={(e) => {
|
||||
$page.url.searchParams.set('type', e.detail)
|
||||
goto($page.url.toString(), {
|
||||
invalidateAll: true,
|
||||
})
|
||||
}}
|
||||
on:select={(e) => searchParam($page.url, 'type', e.detail, 'page')}
|
||||
/>
|
||||
</div>
|
||||
{#each data.items as item (item.counts.id)}
|
||||
{#if isCommentView(item) && (data.type == 'all' || data.type == 'comments')}
|
||||
<CommentItem comment={item} />
|
||||
{:else if !isCommentView(item) && (data.type == 'all' || data.type == 'posts')}
|
||||
<Post post={item} />
|
||||
{/if}
|
||||
{/each}
|
||||
{#if data.items.length == 0}
|
||||
<Placeholder
|
||||
icon={PencilSquare}
|
||||
title="No submissions"
|
||||
description="This user has no descriptions that match this filter."
|
||||
/>
|
||||
{:else}
|
||||
{#each data.items as item (item.counts.id)}
|
||||
{#if isCommentView(item) && (data.type == 'all' || data.type == 'comments')}
|
||||
<CommentItem comment={item} />
|
||||
{:else if !isCommentView(item) && (data.type == 'all' || data.type == 'posts')}
|
||||
<Post post={item} />
|
||||
{/if}
|
||||
{/each}
|
||||
{/if}
|
||||
<Pageination
|
||||
page={data.page}
|
||||
on:change={(p) => {
|
||||
$page.url.searchParams.set('page', p.detail.toString())
|
||||
goto($page.url.toString(), {
|
||||
invalidateAll: true,
|
||||
})
|
||||
}}
|
||||
on:change={(p) => searchParam($page.url, 'page', p.detail.toString())}
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in new issue
Block a user