1 import { Component } from "inferno";
3 CommentNode as CommentNodeI,
4 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?: CommunityModeratorView[];
14 admins?: PersonViewSafe[];
15 maxCommentsShown?: number;
21 showContext?: boolean;
22 showCommunity?: boolean;
23 enableDownvotes?: boolean;
24 viewType: CommentViewType;
25 allLanguages: Language[];
26 siteLanguages: number[];
30 export class CommentNodes extends Component<CommentNodesProps, any> {
31 constructor(props: CommentNodesProps, context: any) {
32 super(props, context);
36 let maxComments = this.props.maxCommentsShown ?? this.props.nodes.length;
39 <div className="comments">
40 {this.props.nodes.slice(0, maxComments).map(node => (
42 key={node.comment_view.comment.id}
44 noBorder={this.props.noBorder}
45 noIndent={this.props.noIndent}
46 viewOnly={this.props.viewOnly}
47 locked={this.props.locked}
48 moderators={this.props.moderators}
49 admins={this.props.admins}
50 markable={this.props.markable}
51 showContext={this.props.showContext}
52 showCommunity={this.props.showCommunity}
53 enableDownvotes={this.props.enableDownvotes}
54 viewType={this.props.viewType}
55 allLanguages={this.props.allLanguages}
56 siteLanguages={this.props.siteLanguages}
57 hideImages={this.props.hideImages}