Fix thread page styling

This commit is contained in:
Jon Staab
2026-06-24 11:19:13 -07:00
parent 09adf33333
commit 1eb75f4ae7
4 changed files with 34 additions and 30 deletions
+1 -1
View File
@@ -3,7 +3,7 @@
</script> </script>
<code <code
class="w-full overflow-auto whitespace-pre rounded bg-neutral px-1 text-neutral-content" class="w-full overflow-auto whitespace-pre rounded bg-neutral px-1 text-neutral-content text-sm"
class:block={isBlock}> class:block={isBlock}>
{value.trim()} {value.trim()}
</code> </code>
+17 -11
View File
@@ -12,7 +12,7 @@
const {url, h, threads}: Props = $props() const {url, h, threads}: Props = $props()
</script> </script>
<section class="overflow-hidden rounded-box border border-base-content/15 bg-base-100 shadow-sm"> <section class="rounded-box border border-base-content/15 bg-base-100 shadow-sm">
<header <header
class="flex items-center justify-between gap-2 border-b border-base-content/15 bg-base-200/70 px-4 py-2.5"> class="flex items-center justify-between gap-2 border-b border-base-content/15 bg-base-200/70 px-4 py-2.5">
<h2 class="text-sm font-bold sm:text-base"> <h2 class="text-sm font-bold sm:text-base">
@@ -27,14 +27,20 @@
{threads.length === 1 ? "topic" : "topics"} {threads.length === 1 ? "topic" : "topics"}
</span> </span>
</header> </header>
<div <table class="w-full border-collapse">
class="hidden border-b border-base-content/10 bg-base-200/40 px-4 py-2 text-xs font-bold uppercase tracking-wide opacity-60 sm:grid sm:grid-cols-[1fr_8rem_5rem_8rem] sm:gap-x-4"> <thead
<span>Topic</span> class="hidden text-xs font-bold uppercase tracking-wide opacity-60 sm:table-header-group">
<span>Author</span> <tr class="border-b border-base-content/10 bg-base-200/40">
<span class="text-center">Replies</span> <th class="px-4 py-2 text-left font-bold">Topic</th>
<span class="text-right">Last post</span> <th class="w-32 px-4 py-2 text-left font-bold">Author</th>
</div> <th class="w-20 px-4 py-2 text-center font-bold">Replies</th>
{#each threads as event (event.id)} <th class="w-32 px-4 py-2 text-right font-bold">Last post</th>
<ThreadBoardItem {url} {event} /> </tr>
{/each} </thead>
<tbody>
{#each threads as event (event.id)}
<ThreadBoardItem {url} {event} />
{/each}
</tbody>
</table>
</section> </section>
+16 -16
View File
@@ -2,6 +2,7 @@
import {formatTimestamp, max} from "@welshman/lib" import {formatTimestamp, max} from "@welshman/lib"
import type {TrustedEvent} from "@welshman/util" import type {TrustedEvent} from "@welshman/util"
import {COMMENT, getTagValue} from "@welshman/util" import {COMMENT, getTagValue} from "@welshman/util"
import {goto} from "$app/navigation"
import Link from "@lib/components/Link.svelte" import Link from "@lib/components/Link.svelte"
import ProfileCircle from "@app/components/ProfileCircle.svelte" import ProfileCircle from "@app/components/ProfileCircle.svelte"
import ProfileName from "@app/components/ProfileName.svelte" import ProfileName from "@app/components/ProfileName.svelte"
@@ -20,29 +21,28 @@
const replyCount = $derived($replies.length) const replyCount = $derived($replies.length)
const lastActive = $derived(max([...$replies, event].map(e => e.created_at))) const lastActive = $derived(max([...$replies, event].map(e => e.created_at)))
const title = getTagValue("title", event.tags) const title = getTagValue("title", event.tags)
const path = makeThreadPath(url, event.id)
const goToThread = () => goto(path)
</script> </script>
<tr> <tr class="cursor-pointer hover:bg-base-200/40 text-sm" onclick={goToThread}>
<td> <td class="px-4 py-2 align-top">
<Link href={makeThreadPath(url, event.id)}> <Link href={path} class="ellipsize font-semibold">
<p class="ellipsize text-sm font-bold sm:text-base">{title || "Untitled thread"}</p> {title || "Untitled thread"}
<p class="ellipsize mt-0.5 text-xs opacity-60 sm:hidden">
by <ProfileName pubkey={event.pubkey} {url} />
</p>
</Link> </Link>
</td> </td>
<td> <td class="px-4 py-2 align-middle">
<ProfileCircle pubkey={event.pubkey} {url} size={6} /> <div class="flex items-center gap-2">
<span class="ellipsize text-sm"> <ProfileCircle pubkey={event.pubkey} {url} size={5} />
<ProfileName pubkey={event.pubkey} {url} /> <span class="ellipsize">
</span> <ProfileName pubkey={event.pubkey} {url} />
</span>
</div>
</td> </td>
<td> <td class="px-4 py-2 align-middle text-right">
<span class="opacity-60 sm:hidden">Replies · </span>
{replyCount} {replyCount}
</td> </td>
<td> <td class="whitespace-nowrap px-4 py-2 align-middle text-right">
<span class="opacity-60 sm:hidden">Last · </span>
{formatTimestamp(lastActive)} {formatTimestamp(lastActive)}
</td> </td>
</tr> </tr>
@@ -93,8 +93,6 @@
Looking for threads... Looking for threads...
{:else if threadFeed.items.length === 0} {:else if threadFeed.items.length === 0}
No threads found. No threads found.
{:else}
That's all!
{/if} {/if}
</Spinner> </Spinner>
</p> </p>