]> Untitled Git - lemmy-ui.git/blob - src/shared/components/comment/comment-nodes.tsx
Make pages use query params instead of route params where appropriate (#977)
[lemmy-ui.git] / src / shared / components / comment / comment-nodes.tsx
1 import { Component } from "inferno";
2 import {
3   CommentNode as CommentNodeI,
4   CommunityModeratorView,
5   Language,
6   PersonViewSafe,
7 } from "lemmy-js-client";
8 import { CommentViewType } from "../../interfaces";
9 import { CommentNode } from "./comment-node";
10
11 interface CommentNodesProps {
12   nodes: CommentNodeI[];
13   moderators?: CommunityModeratorView[];
14   admins?: PersonViewSafe[];
15   maxCommentsShown?: number;
16   noBorder?: boolean;
17   noIndent?: boolean;
18   viewOnly?: boolean;
19   locked?: boolean;
20   markable?: boolean;
21   showContext?: boolean;
22   showCommunity?: boolean;
23   enableDownvotes?: boolean;
24   viewType: CommentViewType;
25   allLanguages: Language[];
26   siteLanguages: number[];
27   hideImages?: boolean;
28 }
29
30 export class CommentNodes extends Component<CommentNodesProps, any> {
31   constructor(props: CommentNodesProps, context: any) {
32     super(props, context);
33   }
34
35   render() {
36     let maxComments = this.props.maxCommentsShown ?? this.props.nodes.length;
37
38     return (
39       <div className="comments">
40         {this.props.nodes.slice(0, maxComments).map(node => (
41           <CommentNode
42             key={node.comment_view.comment.id}
43             node={node}
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}
58           />
59         ))}
60       </div>
61     );
62   }
63 }