1 import { Option } from "@sniptt/monads";
2 import { Component } from "inferno";
3 import { CommunityModeratorView, PersonViewSafe } from "lemmy-js-client";
4 import { CommentNode as CommentNodeI } from "../../interfaces";
5 import { CommentNode } from "./comment-node";
7 interface CommentNodesProps {
9 moderators: Option<CommunityModeratorView[]>;
10 admins: Option<PersonViewSafe[]>;
11 maxCommentsShown: Option<number>;
17 showContext?: boolean;
18 showCommunity?: boolean;
19 enableDownvotes?: boolean;
22 export class CommentNodes extends Component<CommentNodesProps, any> {
23 constructor(props: any, context: any) {
24 super(props, context);
28 let maxComments = this.props.maxCommentsShown.unwrapOr(
29 this.props.nodes.length
33 <div className="comments">
34 {this.props.nodes.slice(0, maxComments).map(node => (
36 key={node.comment_view.comment.id}
38 noBorder={this.props.noBorder}
39 noIndent={this.props.noIndent}
40 viewOnly={this.props.viewOnly}
41 locked={this.props.locked}
42 moderators={this.props.moderators}
43 admins={this.props.admins}
44 markable={this.props.markable}
45 showContext={this.props.showContext}
46 showCommunity={this.props.showCommunity}
47 enableDownvotes={this.props.enableDownvotes}