Refactor: Posts Page and Preview

This commit is contained in:
2024-05-14 00:28:54 +03:00
parent a9cc16e2e6
commit 8419bc248f
6 changed files with 240 additions and 57 deletions
+1
View File
@@ -23,6 +23,7 @@
display: flex;
flex-direction: column;
flex: 1;
padding: 32px;
}
</style>
+4 -31
View File
@@ -1,9 +1,7 @@
<script>
import Comment from "$comp/comment.svelte";
import Mention from "$comp/mention.svelte";
import UserItem from "$comp/useritem.svelte";
import Post from "$comp/page/post.svelte";
import { buildCommentTree } from "$lib/client/nodetree";
import { getNamedId, gotoNamedId } from "$lib/util";
import { gotoNamedId } from "$lib/util";
import { onMount } from "svelte";
/**
@@ -15,36 +13,11 @@
export let data;
$: post = data.post;
$: commentTree = buildCommentTree(data.comments);
onMount(() => {
gotoNamedId(post.id, post.name);
})
});
</script>
<style>
.post {
display: flex;
flex-direction: column;
}
h1 {
margin: 0;
text-align: center;
}
</style>
<div class="post">
<h1 class="taviraj-light">{post.name}</h1>
<UserItem user={post.author}></UserItem>
<p>{post.content}</p>
<div>
{#each commentTree as reply}
<Comment commentNode={reply}></Comment>
{/each}
</div>
</div>
<Post post={post} commentTree={commentTree}></Post>