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