import { Component } from "inferno"; import { AddAdmin, AddModToCommunity, BanFromCommunity, BanPerson, BlockPerson, CommentId, CommunityModeratorView, CreateComment, CreateCommentLike, CreateCommentReport, DeleteComment, DistinguishComment, EditComment, GetComments, Language, MarkCommentReplyAsRead, MarkPersonMentionAsRead, PersonView, PurgeComment, PurgePerson, RemoveComment, SaveComment, TransferCommunity, } from "lemmy-js-client"; import { CommentNodeI, CommentViewType } from "../../interfaces"; import { CommentNode } from "./comment-node"; interface CommentNodesProps { nodes: CommentNodeI[]; moderators?: CommunityModeratorView[]; admins?: PersonView[]; maxCommentsShown?: number; noBorder?: boolean; noIndent?: boolean; viewOnly?: boolean; locked?: boolean; markable?: boolean; showContext?: boolean; showCommunity?: boolean; enableDownvotes?: boolean; viewType: CommentViewType; allLanguages: Language[]; siteLanguages: number[]; hideImages?: boolean; finished: Map; onSaveComment(form: SaveComment): void; onCommentReplyRead(form: MarkCommentReplyAsRead): void; onPersonMentionRead(form: MarkPersonMentionAsRead): void; onCreateComment(form: EditComment | CreateComment): void; onEditComment(form: EditComment | CreateComment): void; onCommentVote(form: CreateCommentLike): void; onBlockPerson(form: BlockPerson): void; onDeleteComment(form: DeleteComment): void; onRemoveComment(form: RemoveComment): void; onDistinguishComment(form: DistinguishComment): void; onAddModToCommunity(form: AddModToCommunity): void; onAddAdmin(form: AddAdmin): void; onBanPersonFromCommunity(form: BanFromCommunity): void; onBanPerson(form: BanPerson): void; onTransferCommunity(form: TransferCommunity): void; onFetchChildren?(form: GetComments): void; onCommentReport(form: CreateCommentReport): void; onPurgePerson(form: PurgePerson): void; onPurgeComment(form: PurgeComment): void; } export class CommentNodes extends Component { constructor(props: CommentNodesProps, context: any) { super(props, context); } render() { const maxComments = this.props.maxCommentsShown ?? this.props.nodes.length; return (
{this.props.nodes.slice(0, maxComments).map(node => ( ))}
); } }