Skip to content
Repos

DevPlaceApp

C++ 1.0 KB25 lines Opens in site

Directory Raw Download

#pragma once
// Spec: INV-posts 3.1 (FeedPostView). One card of the feed: hairline, header, content, poll, first attachment,
// footer, reply composer, recent comments, hairline. Taps open the post, double taps vote or edit.
#include <functional>
#include <optional>
#include <string>

#include "model/Post.hpp"
#include "screens/comments/CommentsSession.hpp"
#include "screens/post/PostEnvironment.hpp"
#include "ui/Views.hpp"

namespace dp {

struct FeedPostContext {
  CommentsSession* session = nullptr;                                                  // required
  PostEnvironment env;
  std::string composerAnchorKey;                                                       // AnchorMark key of the open composer
  std::function<void(const std::string& slug, const std::optional<std::string>& scrollToCommentId)> onSelect;
  std::function<void(const Post&)> onEdit;                                             // presents the edit screen
};

ui::ViewPtr FeedPostView(const Post& post, const FeedPostContext& ctx);

}  // namespace dp
43.7ms