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