Skip to content
Repos

DevPlaceApp

C++ 814 B23 lines Opens in site

Directory Raw Download

#pragma once
// Spec: INV-posts 5.2 (CommentView). Guide lines, optional top divider, header, body or editor, attachments,
// vote and reaction row with actions, inline reply composer.
#include <optional>

#include "screens/comments/CommentsProps.hpp"

namespace dp {

struct CommentRowInfo {
  int level = 0;
  std::optional<int> previousLevel;
  bool showsTopDivider = false;
  bool own = false;  // the viewer wrote it: edit and delete are available
};

// Left padding of the divider: 16 + (max(level, previous) - level) * 16, levels capped at 3 (CommentView.swift:41-45).
float commentDividerLeading(int level, std::optional<int> previousLevel);
int commentEffectiveLevel(int level);

ui::ViewPtr CommentView(const Comment& comment, const CommentRowInfo& row, const CommentsProps& props);

}  // namespace dp
34.5ms