Show full threads with replies

This commit is contained in:
dtonon 2026-04-06 17:19:38 +01:00
parent 75d1d16cf1
commit 994e76313e
3 changed files with 187 additions and 139 deletions

View file

@ -1,9 +1,9 @@
<script lang="ts">
import { onMount } from "svelte";
import type { Post } from "$lib/mock";
type PostLike = { createdAt: number };
type Props = {
posts: Post[];
posts: PostLike[];
postEls: (HTMLElement | null)[];
topOffset: number;
};
@ -52,15 +52,15 @@
: "",
);
function formatShortDate(iso: string) {
return new Date(iso).toLocaleDateString("en-US", {
function formatShortDate(ts: number) {
return new Date(ts * 1000).toLocaleDateString("en-US", {
month: "short",
day: "numeric",
});
}
function formatDate(iso: string) {
return new Date(iso).toLocaleDateString("en-US", {
function formatDate(ts: number) {
return new Date(ts * 1000).toLocaleDateString("en-US", {
month: "short",
day: "numeric",
year: "numeric",