#pragma once // Spec: INV-posts 5.1 (CommentsView parameters). Callbacks are optional; an empty callback hides the matching control. #include #include #include #include #include "model/Comment.hpp" #include "model/UploadResponse.hpp" #include "model/UserSearch.hpp" #include "screens/comments/CommentRef.hpp" #include "screens/comments/CommentsSession.hpp" #include "screens/post/PostEnvironment.hpp" namespace dp { struct CommentsProps { const std::vector* comments = nullptr; int baseIndentationLevel = 0; bool linksToProfile = true; std::optional maxAttachments; std::function onSingleTap; std::function onDoubleTap; std::function onReact; std::function onDelete; // wired for own comments only std::function onEdit; // wired for own comments only std::function onReply; std::optional replyingCommentId; // Comment.id() of the open reply composer ui::Binding replyText; std::function&)> onReplyAttachmentsChange; std::function onSubmitReply; std::function onCancelReply; std::vector mentionParticipants; bool showsDividers = false; bool showsLeadingDivider = false; std::string rowAnchorPrefix; // when set, every row is marked with AnchorMark(prefix + Comment.id()) std::string composerAnchorKey; // AnchorMark key for the open composer CommentsSession* session = nullptr; // required PostEnvironment env; }; // Flattened row of the tree: comment pointer and indentation level. struct IndentedComment { const Comment* comment; int level; }; // Depth first flatten, capped at PostsLimits::kMaxRenderedComments rows (comments.indented(startingAt:)). std::vector flattenComments(const std::vector& comments, int startingLevel); } // namespace dp