fix: missing empty list placeholder

This commit is contained in:
axel 2025-04-20 22:35:37 +02:00
parent 456131602f
commit 2f0fd05d35
3 changed files with 13 additions and 4 deletions

View File

@ -2,7 +2,7 @@
import { Button } from 'bits-ui';
import IconPlus from '~icons/tabler/plus';
let { createHref = null, msgAdd = '', children } = $props();
let { createHref = null, msgAdd = '', empty = false, children } = $props();
</script>
{#if createHref}
@ -21,7 +21,8 @@
<div class="w-full sm:px-6 px-3 py-4 max-w-3xl mx-auto">
{#if children}
{@render children?.()}
{:else}
{/if}
{#if empty}
<div class="p-4 text-center text-neutral-700">
<p>Nothing here.</p>
{#if createHref}

View File

@ -28,7 +28,11 @@
});
</script>
<ListPage createHref={data.user.admin ? '/dash/devices/new' : null} msgAdd="Add Device">
<ListPage
createHref={data.user.admin ? '/dash/devices/new' : null}
empty={data.devices.length == 0}
msgAdd="Add Device"
>
<div class="flex gap-4 flex-wrap justify-center">
{#each data.devices as device}
<ResCard

View File

@ -8,7 +8,11 @@
store.pageTitle = 'Listing all groups';
</script>
<ListPage createHref={data.user.admin ? '/dash/groups/new' : null} msgAdd="Add Group">
<ListPage
createHref={data.user.admin ? '/dash/groups/new' : null}
empty={data.groups.length == 0}
msgAdd="Add Group"
>
<div class="flex gap-4 flex-wrap justify-center">
{#each data.groups as group}
<ResCard