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