diff --git a/src/comp/actionbar.svelte b/src/comp/actionbar.svelte
index 106e538..b63a90e 100644
--- a/src/comp/actionbar.svelte
+++ b/src/comp/actionbar.svelte
@@ -1,5 +1,6 @@
+
+
+
+
diff --git a/src/comp/page/post.svelte b/src/comp/page/post.svelte
index 6dc8fc9..a6b75e2 100644
--- a/src/comp/page/post.svelte
+++ b/src/comp/page/post.svelte
@@ -3,7 +3,11 @@
import Ago from "$comp/ago.svelte";
import Avatar from "$comp/avatar.svelte";
import CommentList from "$comp/commentlist.svelte";
+ import Iconvalue from "$comp/iconvalue.svelte";
import Mention from "$comp/mention.svelte";
+ import Tablericon from "$comp/tablericon.svelte";
+ import { round10 } from "expected-round";
+ import moment from "moment";
/**
* @type {import("$types/base").Post}
@@ -15,7 +19,17 @@
*/
export let commentTree = null;
- $: isPreview = commentTree == null;
+ /**
+ * @type {boolean}
+ */
+ export let showMetrics = false;
+
+ let showStats = false;
+
+ function togglePostStats(/** @type {MouseEvent | TouchEvent} */ e) {
+ e.stopPropagation();
+ showStats = !showStats;
+ }
- {post.name}
+ {post.name}
@@ -88,7 +136,37 @@
{post.content}
-
+
+ {#if showMetrics && post.metrics}
+ {post.metrics.commentCount}
+ {post.metrics.userCount}
+ {round10(post.metrics.relevancy, -2)}
+ {/if}
+
+
+
+
+ {#if showStats}
+
+
Debug stats
+
+ | ID | {post.id} |
+ | Author | {post.author?.id} |
+ | Created Date | {post.postDate} |
+ | Score | {post.rating.likes - post.rating.dislikes} |
+ {#if post.metrics}
+ | Comment Count | {post.metrics.commentCount} |
+ | User Count | {post.metrics.userCount} |
+ | Latest Activity | {post.metrics.latestActivity} |
+ | Engagement | {post.metrics.engagement} |
+ | Age | {post.metrics.age} |
+ | Relevancy | {round10(post.metrics.relevancy, -5)} |
+ {/if}
+
+
+ {/if}
{#if commentTree}
diff --git a/src/comp/postlist.svelte b/src/comp/postlist.svelte
index 51bacc8..efcbed2 100644
--- a/src/comp/postlist.svelte
+++ b/src/comp/postlist.svelte
@@ -9,8 +9,10 @@
*/
export let posts = [];
- /** @type {import("$types/base").Post | null} */
- $: currentPreview = null;
+ /**
+ * @type {import('$types/base').Post | null}
+ */
+ export let glancePost = null;
/** @type {boolean[]} */
$: hidden = Array(posts.length).fill(false);
@@ -19,33 +21,33 @@
/** @type {import("$types/base").Post} */
const post = e.detail.post;
- currentPreview = post;
-
posts.forEach((p, index) => {
hidden[index] = p == post;
});
- goto(`/posts?glance=${currentPreview.id}`, {
+ goto(`/posts?glance=${post.id}`, {
replaceState: true,
noScroll: true
});
}
- function dismiss() {
- currentPreview = null;
+ function dismiss(/** @type {MouseEvent | TouchEvent} */ e) {
+ e.stopPropagation();
hidden = Array(posts.length).fill(false);
- // goto(`/posts`, {
- // replaceState: true,
- // noScroll: true
- // });
+ goto(`/posts`, {
+ replaceState: true,
+ noScroll: true
+ });
}
- function expand() {
- if (currentPreview == null) return;
+ function expand(/** @type {MouseEvent | TouchEvent} */ e) {
+ if (glancePost == null) return;
+
+ e.stopPropagation();
- goto(`/posts/${getNamedId(currentPreview.id, currentPreview.name)}`, {
+ goto(`/posts/${getNamedId(glancePost.id, glancePost.name)}`, {
replaceState: false
});
}
@@ -109,10 +111,10 @@
{/each}
-