From 5a8499fd7baea013da87861d70ec11c692e3878b Mon Sep 17 00:00:00 2001 From: Xylight Date: Wed, 17 Jul 2024 11:46:41 -0700 Subject: [PATCH] misc: bump version --- package.json | 2 +- .../components/lemmy/comment/Comment.svelte | 198 +++++++++--------- src/lib/components/lemmy/comment/comments.ts | 2 + 3 files changed, 103 insertions(+), 99 deletions(-) diff --git a/package.json b/package.json index f43bfcc9..6bcff09b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "photon-lemmy", - "version": "1.31.0-fix.1", + "version": "1.31.1", "devDependencies": { "@catdadcode/svelte-adapter-bun": "^0.5.7", "@dicebear/core": "^8.0.1", diff --git a/src/lib/components/lemmy/comment/Comment.svelte b/src/lib/components/lemmy/comment/Comment.svelte index 2a39565d..6643beab 100644 --- a/src/lib/components/lemmy/comment/Comment.svelte +++ b/src/lib/components/lemmy/comment/Comment.svelte @@ -24,7 +24,7 @@ import { onMount } from 'svelte' import { t } from '$lib/translations' import { slide } from 'svelte/transition' - import { expoOut } from 'svelte/easing' + import { expoInOut, expoOut } from 'svelte/easing' export let node: CommentNodeI export let postId: number @@ -107,111 +107,113 @@ : ''} {highlight} {$$props.class}" id="#{node.comment_view.comment.id.toString()}" > - -
- - - - {#if node.comment_view.creator_is_moderator} - - {/if} - {#if node.comment_view.creator_is_admin} - - {/if} - - - {#if op} - OP - {/if} - - - - {#if node.comment_view.comment.updated} - - {/if} - {#if node.comment_view.comment.deleted || node.comment_view.comment.removed} - - {/if} - {#if node.comment_view.saved} - - {/if} - -
-
- {#if node.comment_view.comment.distinguished} -
(open = !open)} + class="flex flex-row cursor-pointer gap-2 items-center group text-[13px] flex-wrap w-full" + > + + + + {#if node.comment_view.creator_is_moderator} + + {/if} + {#if node.comment_view.creator_is_admin} + + {/if} + + + {#if op} + OP + {/if} + + + + {#if node.comment_view.comment.updated} + + {/if} + {#if node.comment_view.comment.deleted || node.comment_view.comment.removed} + {/if} + {#if node.comment_view.saved} + + {/if} + + + {#if open} +
- + {#if node.comment_view.comment.distinguished} +
+ {/if} +
+ +
+ {#if actions} +
+ (editing = true)} + disabled={node.comment_view.banned_from_community || + node.comment_view.post.locked} + /> +
+ {/if}
- {#if actions} -
- (editing = true)} - disabled={node.comment_view.banned_from_community || - node.comment_view.post.locked} + {#if replying} +
+

{$t('comment.reply')}

+ { + node.children = [ + { + children: [], + comment_view: e.detail.comment_view, + depth: node.depth + 1, + }, + ...node.children, + ] + replying = false + }} />
{/if} -
- {#if replying} -
-

{$t('comment.reply')}

- { - node.children = [ - { - children: [], - comment_view: e.detail.comment_view, - depth: node.depth + 1, - }, - ...node.children, - ] - replying = false - }} - /> +
+
- {/if} -
-
- + {/if} diff --git a/src/lib/components/lemmy/comment/comments.ts b/src/lib/components/lemmy/comment/comments.ts index 743d932a..50e72a8e 100644 --- a/src/lib/components/lemmy/comment/comments.ts +++ b/src/lib/components/lemmy/comment/comments.ts @@ -27,6 +27,7 @@ export function buildCommentsTree( baseDepth: number = 0, filter: (c: CommentView) => boolean = (c) => true ): CommentNodeI[] { + const start = performance.now() const map = new Map() let min_depth = Number.MAX_VALUE @@ -68,6 +69,7 @@ export function buildCommentsTree( } } + console.log(`Built tree in ${performance.now() - start}ms`) return tree }