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