Compare commits

..

No commits in common. "cbc0f1b44e8e8a61fd063c640f4008c30cfbe63b" and "f1ef0162d766617a58c0f09ba2e4153c148cf83b" have entirely different histories.

View file

@ -24,7 +24,19 @@
<div class="alert alert-error mb-4" role="alert">{form.message}</div> <div class="alert alert-error mb-4" role="alert">{form.message}</div>
{/if} {/if}
{#snippet actions(page: (typeof data.pages)[number])} <div class="overflow-x-auto rounded-box bg-base-100 shadow">
<table class="table">
<thead>
<tr><th>Slug</th><th>Title</th><th>Status</th><th class="text-right">Actions</th></tr>
</thead>
<tbody>
{#each data.pages as page (page.id)}
<tr>
<td class="font-mono">{page.slug}</td>
<td>{page.title}</td>
<td><span class="badge" class:badge-success={page.published}>{page.published ? 'Published' : 'Draft'}</span></td>
<td>
<div class="flex flex-wrap justify-end gap-2">
<a class="btn btn-sm" href={`/pages/${page.slug}`}>Edit</a> <a class="btn btn-sm" href={`/pages/${page.slug}`}>Edit</a>
{#if siteUrl && page.published} {#if siteUrl && page.published}
<a class="btn btn-sm" href={publicUrl(page.slug)} target="_blank" rel="noopener" title="Open on the live site">View</a> <a class="btn btn-sm" href={publicUrl(page.slug)} target="_blank" rel="noopener" title="Open on the live site">View</a>
@ -38,43 +50,7 @@
<input type="hidden" name="id" value={page.id} /> <input type="hidden" name="id" value={page.id} />
<button class="btn btn-sm btn-error btn-outline" type="submit">Delete</button> <button class="btn btn-sm btn-error btn-outline" type="submit">Delete</button>
</form> </form>
{/snippet}
{#snippet status(page: (typeof data.pages)[number])}
<span class="badge" class:badge-success={page.published}>{page.published ? 'Published' : 'Draft'}</span>
{/snippet}
<!-- Phones: one card per page, buttons under the title (a four-column table didn't fit). -->
<ul class="divide-y divide-base-200 rounded-box bg-base-100 shadow md:hidden">
{#each data.pages as page (page.id)}
<li class="p-4">
<div class="flex items-start justify-between gap-3">
<a class="min-w-0" href={`/pages/${page.slug}`}>
<span class="block font-semibold break-words">{page.title}</span>
<span class="block font-mono text-sm break-all text-base-content/60">/{page.slug}</span>
</a>
<span class="shrink-0">{@render status(page)}</span>
</div> </div>
<div class="mt-3 flex flex-wrap gap-2">{@render actions(page)}</div>
</li>
{:else}
<li class="py-10 text-center text-base-content/60">No pages yet — create your first one.</li>
{/each}
</ul>
<div class="hidden overflow-x-auto rounded-box bg-base-100 shadow md:block">
<table class="table">
<thead>
<tr><th>Slug</th><th>Title</th><th>Status</th><th class="text-right">Actions</th></tr>
</thead>
<tbody>
{#each data.pages as page (page.id)}
<tr>
<td class="font-mono">{page.slug}</td>
<td>{page.title}</td>
<td>{@render status(page)}</td>
<td>
<div class="flex flex-wrap justify-end gap-2 xl:flex-nowrap">{@render actions(page)}</div>
</td> </td>
</tr> </tr>
{:else} {:else}