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[];
27 siteLanguages: number[];
31 export class CommentNodes extends Component<CommentNodesProps, any> {
32 constructor(props: any, context: any) {
33 super(props, context);
37 let maxComments = this.props.maxCommentsShown.unwrapOr(
38 this.props.nodes.length
42 <div className="comments">
43 {this.props.nodes.slice(0, maxComments).map(node => (
45 key={node.comment_view.comment.id}
47 noBorder={this.props.noBorder}
48 noIndent={this.props.noIndent}
49 viewOnly={this.props.viewOnly}
50 locked={this.props.locked}
51 moderators={this.props.moderators}
52 admins={this.props.admins}
53 markable={this.props.markable}
54 showContext={this.props.showContext}
55 showCommunity={this.props.showCommunity}
56 enableDownvotes={this.props.enableDownvotes}
57 viewType={this.props.viewType}
58 allLanguages={this.props.allLanguages}
59 siteLanguages={this.props.siteLanguages}
60 hideImages={this.props.hideImages}