diff --git a/src/app/comment/Comment.tsx b/src/app/comment/Comment.tsx
index dd1b466..4d2e559 100644
--- a/src/app/comment/Comment.tsx
+++ b/src/app/comment/Comment.tsx
@@ -23,6 +23,7 @@ import {
} from "@/app/comment/commentActions";
import { LazyChildComments } from "@/app/comment/LazyChildComments";
import { CommentTree } from "@/app/comment/CommentTree";
+import { ShowMoreCommentsLink } from "@/app/comment/ShowMoreCommentsLink";
export const Comment = (props: {
readonly commentView: CommentView;
@@ -33,6 +34,7 @@ export const Comment = (props: {
readonly addPostLink?: boolean;
readonly voteConfig: VoteConfig;
readonly markdown: MarkdownProps;
+ readonly renderedDepth?: number;
/**
* Only needed when rendering comment trees, no need to pass for flat comment lists
*/
@@ -90,6 +92,7 @@ export const Comment = (props: {
props.commentView.comment.creator_id ===
props.loggedInUser?.local_user_view.person.id;
+ const renderedDepth = props.renderedDepth ?? 0;
return (
))}
- {props.node && (
-
- {props.node.children.map((node) => (
-
0 && (
+ <>
+ = 3,
+ "sm:hidden lg:block": renderedDepth >= 4,
+ "lg:hidden xl:block": renderedDepth >= 5,
+ "xl:hidden 2xl:block": renderedDepth >= 6,
+ })}
+ >
+ {props.node.children.map((node) => (
+
+ ))}
+
- ))}
-
-
+
+ {renderedDepth >= 3 && (
+ = 6,
+ })}
+ >
+
+
+ )}
+ >
)}
diff --git a/src/app/comment/CommentTree.tsx b/src/app/comment/CommentTree.tsx
index 3081da9..d5d3201 100644
--- a/src/app/comment/CommentTree.tsx
+++ b/src/app/comment/CommentTree.tsx
@@ -11,6 +11,7 @@ export const CommentTree = memo(
readonly highlightRoot?: boolean;
readonly voteConfig: VoteConfig;
readonly loggedInUser?: MyUserInfo;
+ readonly renderedDepth?: number;
}) => {
return (
diff --git a/src/app/comment/LazyChildComments.tsx b/src/app/comment/LazyChildComments.tsx
index f8e7795..dd46d3d 100644
--- a/src/app/comment/LazyChildComments.tsx
+++ b/src/app/comment/LazyChildComments.tsx
@@ -9,11 +9,13 @@ import { CommentTree } from "@/app/comment/CommentTree";
import { MouseEvent, useState } from "react";
import { VoteConfig } from "@/app/(ui)/vote/getVoteConfig";
import { MyUserInfo } from "lemmy-js-client";
+import { ShowMoreCommentsLink } from "@/app/comment/ShowMoreCommentsLink";
export const LazyChildComments = (props: {
readonly node: CommentNode;
readonly voteConfig: VoteConfig;
readonly loggedInUser?: MyUserInfo;
+ readonly renderedDepth?: number;
}) => {
const [loadedComments, setLoadedComments] = useState(
null,
@@ -26,9 +28,7 @@ export const LazyChildComments = (props: {
return null;
}
- const onLoadMore = async (e: MouseEvent) => {
- e.preventDefault();
- e.nativeEvent.stopImmediatePropagation();
+ const onLoadMore = async () => {
const commentTrees = await buildCommentTreesAction(
{
parent_id: props.node.commentView.comment.id,
@@ -45,15 +45,10 @@ export const LazyChildComments = (props: {
if (loadedComments === null) {
return (
-
- {"Show more comments "}
-
-
+ rootId={props.node.commentView.comment.id}
+ />
);
}
@@ -62,6 +57,7 @@ export const LazyChildComments = (props: {
key={node.commentView.comment.id}
loggedInUser={props.loggedInUser}
node={node}
+ renderedDepth={props.renderedDepth}
voteConfig={props.voteConfig}
/>
));
diff --git a/src/app/comment/ShowMoreCommentsLink.tsx b/src/app/comment/ShowMoreCommentsLink.tsx
new file mode 100644
index 0000000..5cab9be
--- /dev/null
+++ b/src/app/comment/ShowMoreCommentsLink.tsx
@@ -0,0 +1,29 @@
+import { ArrowRightIcon } from "@heroicons/react/16/solid";
+import { MouseEvent } from "react";
+
+export const ShowMoreCommentsLink = (props: {
+ readonly rootId: number;
+ onClick?(): Promise;
+}) => {
+ let onClick = undefined;
+
+ if (props.onClick) {
+ onClick = (e: MouseEvent) => {
+ e.preventDefault();
+ e.nativeEvent.stopImmediatePropagation();
+ props.onClick!();
+ };
+ }
+
+ return (
+
+ {"Show more comments "}
+
+
+ );
+};
diff --git a/src/app/u/UserLink.tsx b/src/app/u/UserLink.tsx
index 9e80f86..304b3ab 100644
--- a/src/app/u/UserLink.tsx
+++ b/src/app/u/UserLink.tsx
@@ -18,12 +18,12 @@ export const UserLink = (props: Props) => {
return (
-
+
{creatorFormattedName}
{props.showOpBadge && (