forked from coracle/flotilla
Fix thread page styling
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
</script>
|
||||
|
||||
<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}>
|
||||
{value.trim()}
|
||||
</code>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
const {url, h, threads}: Props = $props()
|
||||
</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
|
||||
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">
|
||||
@@ -27,14 +27,20 @@
|
||||
{threads.length === 1 ? "topic" : "topics"}
|
||||
</span>
|
||||
</header>
|
||||
<div
|
||||
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">
|
||||
<span>Topic</span>
|
||||
<span>Author</span>
|
||||
<span class="text-center">Replies</span>
|
||||
<span class="text-right">Last post</span>
|
||||
</div>
|
||||
{#each threads as event (event.id)}
|
||||
<ThreadBoardItem {url} {event} />
|
||||
{/each}
|
||||
<table class="w-full border-collapse">
|
||||
<thead
|
||||
class="hidden text-xs font-bold uppercase tracking-wide opacity-60 sm:table-header-group">
|
||||
<tr class="border-b border-base-content/10 bg-base-200/40">
|
||||
<th class="px-4 py-2 text-left font-bold">Topic</th>
|
||||
<th class="w-32 px-4 py-2 text-left font-bold">Author</th>
|
||||
<th class="w-20 px-4 py-2 text-center font-bold">Replies</th>
|
||||
<th class="w-32 px-4 py-2 text-right font-bold">Last post</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{#each threads as event (event.id)}
|
||||
<ThreadBoardItem {url} {event} />
|
||||
{/each}
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
import {formatTimestamp, max} from "@welshman/lib"
|
||||
import type {TrustedEvent} from "@welshman/util"
|
||||
import {COMMENT, getTagValue} from "@welshman/util"
|
||||
import {goto} from "$app/navigation"
|
||||
import Link from "@lib/components/Link.svelte"
|
||||
import ProfileCircle from "@app/components/ProfileCircle.svelte"
|
||||
import ProfileName from "@app/components/ProfileName.svelte"
|
||||
@@ -20,29 +21,28 @@
|
||||
const replyCount = $derived($replies.length)
|
||||
const lastActive = $derived(max([...$replies, event].map(e => e.created_at)))
|
||||
const title = getTagValue("title", event.tags)
|
||||
const path = makeThreadPath(url, event.id)
|
||||
const goToThread = () => goto(path)
|
||||
</script>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<Link href={makeThreadPath(url, event.id)}>
|
||||
<p class="ellipsize text-sm font-bold sm:text-base">{title || "Untitled thread"}</p>
|
||||
<p class="ellipsize mt-0.5 text-xs opacity-60 sm:hidden">
|
||||
by <ProfileName pubkey={event.pubkey} {url} />
|
||||
</p>
|
||||
<tr class="cursor-pointer hover:bg-base-200/40 text-sm" onclick={goToThread}>
|
||||
<td class="px-4 py-2 align-top">
|
||||
<Link href={path} class="ellipsize font-semibold">
|
||||
{title || "Untitled thread"}
|
||||
</Link>
|
||||
</td>
|
||||
<td>
|
||||
<ProfileCircle pubkey={event.pubkey} {url} size={6} />
|
||||
<span class="ellipsize text-sm">
|
||||
<ProfileName pubkey={event.pubkey} {url} />
|
||||
</span>
|
||||
<td class="px-4 py-2 align-middle">
|
||||
<div class="flex items-center gap-2">
|
||||
<ProfileCircle pubkey={event.pubkey} {url} size={5} />
|
||||
<span class="ellipsize">
|
||||
<ProfileName pubkey={event.pubkey} {url} />
|
||||
</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<span class="opacity-60 sm:hidden">Replies · </span>
|
||||
<td class="px-4 py-2 align-middle text-right">
|
||||
{replyCount}
|
||||
</td>
|
||||
<td>
|
||||
<span class="opacity-60 sm:hidden">Last · </span>
|
||||
<td class="whitespace-nowrap px-4 py-2 align-middle text-right">
|
||||
{formatTimestamp(lastActive)}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -93,8 +93,6 @@
|
||||
Looking for threads...
|
||||
{:else if threadFeed.items.length === 0}
|
||||
No threads found.
|
||||
{:else}
|
||||
That's all!
|
||||
{/if}
|
||||
</Spinner>
|
||||
</p>
|
||||
|
||||
Reference in New Issue
Block a user