From fa56d0252dce5771bc196484998d839f75faac5d Mon Sep 17 00:00:00 2001 From: dtonon Date: Tue, 7 Apr 2026 12:36:37 +0100 Subject: [PATCH] Improve the timeline UI and spacing --- src/lib/components/ThreadScrubber.svelte | 29 +++++++--- src/routes/thread/[id]/+page.svelte | 69 ++++++++++++++++-------- 2 files changed, 71 insertions(+), 27 deletions(-) diff --git a/src/lib/components/ThreadScrubber.svelte b/src/lib/components/ThreadScrubber.svelte index a4c7645..55a4d01 100644 --- a/src/lib/components/ThreadScrubber.svelte +++ b/src/lib/components/ThreadScrubber.svelte @@ -6,9 +6,15 @@ posts: PostLike[]; postEls: (HTMLElement | null)[]; topOffset: number; + visible?: boolean; }; - let { posts, postEls, topOffset }: Props = $props(); + let { + posts, + postEls, + topOffset, + visible = $bindable(false), + }: Props = $props(); let scrollEl = $state(null); let trackEl = $state(null); @@ -23,6 +29,9 @@ let dragStartScrollTop = 0; const isOverflowing = $derived(scrollHeight > clientHeight); + $effect(() => { + visible = isOverflowing; + }); const maxScroll = $derived(Math.max(scrollHeight - clientHeight, 1)); const thumbHeight = $derived( Math.max((clientHeight / scrollHeight) * trackHeight, 28), @@ -60,11 +69,13 @@ } function formatDate(ts: number) { - return new Date(ts * 1000).toLocaleDateString("en-US", { + const date = new Date(ts * 1000); + const monthDay = date.toLocaleDateString("en-US", { month: "short", day: "numeric", - year: "numeric", }); + const year = date.toLocaleDateString("en-US", { year: "numeric" }); + return `${monthDay}\n${year}`; } function update() { @@ -131,11 +142,15 @@