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; + }
@@ -80,7 +128,7 @@
-

{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
+ + + + + + {#if post.metrics} + + + + + + + {/if} +
ID{post.id}
Author{post.author?.id}
Created Date{post.postDate}
Score{post.rating.likes - post.rating.dislikes}
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 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} - diff --git a/src/comp/rating.svelte b/src/comp/rating.svelte index 8c1efd1..7f9ec85 100644 --- a/src/comp/rating.svelte +++ b/src/comp/rating.svelte @@ -1,4 +1,6 @@

Posts

- + diff --git a/static/icon/chart-bar.svg b/static/icon/chart-bar.svg new file mode 100644 index 0000000..cee3bca --- /dev/null +++ b/static/icon/chart-bar.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/icon/database.svg b/static/icon/database.svg new file mode 100644 index 0000000..6771815 --- /dev/null +++ b/static/icon/database.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/icon/message.svg b/static/icon/message.svg new file mode 100644 index 0000000..eba8b73 --- /dev/null +++ b/static/icon/message.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/icon/user.svg b/static/icon/user.svg new file mode 100644 index 0000000..3bc2800 --- /dev/null +++ b/static/icon/user.svg @@ -0,0 +1 @@ + \ No newline at end of file