Skip to content
Repos

DevPlaceApp

C++ 6.8 KB141 lines Opens in site

Directory Raw Download

#pragma once
// Spec: INV-posts sections 1-3 (feed, post, post parts), 5-9 (comments, reactions, votes, polls), 11 (report),
// 12 (model updates). Every string, metric, limit and duration of the posts area lives here, never inline.
#include <cstddef>

namespace dp::spec {

struct PostsText {
  // Feed (INV-posts 1.1)
  static constexpr const char* kFeedTitle = "Posts";
  static constexpr const char* kNewPost = "New post";
  // Post detail (2.1)
  static constexpr const char* kPostFallbackTitle = "Post";
  static constexpr const char* kReload = "Reload";
  static constexpr const char* kCommentsHeader = "Comments";
  static constexpr const char* kCommentButton = "Comment";
  static constexpr const char* kBottomPlaceholder = "Write a comment\xE2\x80\xA6";
  static constexpr const char* kReplyPlaceholder = "Write a reply\xE2\x80\xA6";
  static constexpr const char* kEditPlaceholder = "Edit your comment\xE2\x80\xA6";
  // Footer and comment actions (3.4, 5.2)
  static constexpr const char* kReplyToPost = "Reply to post";
  static constexpr const char* kEditPost = "Edit post";
  static constexpr const char* kDeletePost = "Delete post";
  static constexpr const char* kReplyToComment = "Reply to comment";
  static constexpr const char* kEditComment = "Edit comment";
  static constexpr const char* kDeleteComment = "Delete comment";
  static constexpr const char* kDeletePostQuestion = "Delete this post?";
  static constexpr const char* kDeleteCommentQuestion = "Delete this comment?";
  static constexpr const char* kDelete = "Delete";
  static constexpr const char* kCancel = "Cancel";
  static constexpr const char* kSubmit = "Submit";
  static constexpr const char* kCommentCountSuffix = " comments";
  // Reactions (7)
  static constexpr const char* kAddReaction = "Add reaction";
  static constexpr const char* kShowAllReactions = "Show all reactions";
  static constexpr const char* kMoreReactions = "\xE2\x80\xA6";
  // Polls (9)
  static constexpr const char* kVoteSingular = "vote";
  static constexpr const char* kVotePlural = "votes";
  // Report (11.2)
  static constexpr const char* kReportPrefix = "Report ";
  static constexpr const char* kReportSheetPrefix = "Report this ";
  static constexpr const char* kReportConfirm = "Report";
  static constexpr const char* kReasonsHeaderPrefix = "Why are you reporting this ";
  static constexpr const char* kDetailsHeader = "Details";
  static constexpr const char* kDetailsPlaceholder = "Add any details for the moderators (optional)";
  static constexpr const char* kReasonsFailedTitle = "Couldn't load reasons";
  static constexpr const char* kReasonsFailedBody = "Please check your connection and try again.";
  static constexpr const char* kRetry = "Retry";
  static constexpr const char* kThankYouTitle = "Thank you";
  static constexpr const char* kThankYouBodyPrefix = "This ";
  static constexpr const char* kThankYouBodySuffix = " has been reported for review.";
  static constexpr const char* kNounPost = "post";
  static constexpr const char* kNounComment = "comment";
  static constexpr const char* kOk = "OK";
};

struct PostsLayout {
  // FeedPostView (3.1)
  static constexpr float kHLineOpacity = 0.3f;
  static constexpr float kHLineHeight = 1;
  static constexpr float kCardSpacing = 8;
  static constexpr float kScreenPadding = 16;
  static constexpr float kFeedLoadMorePadding = 16;
  // Footer (3.4)
  static constexpr float kFooterSpacing = 12;
  static constexpr float kFooterActionSpacing = 24;
  static constexpr float kActionIconSize = 17;
  // Header (3.2)
  static constexpr float kHeaderCountSpacing = 4;
  static constexpr float kHeaderCountFont = 12;
  // Comments (5.2)
  static constexpr int kMaxIndentationLevel = 3;
  static constexpr float kIndentWidth = 16;
  static constexpr float kGuideLineOpacity = 0.3f;
  static constexpr float kGuideDash = 3;
  static constexpr float kCommentVPad = 8;
  static constexpr float kEditorCounterPad = 11;
  static constexpr float kEditorGap = 4;
  static constexpr float kEditorSpacing = 8;
  static constexpr int kEditorInitialLines = 3;
  static constexpr float kCommentsHeaderFont = 20;
  // FAB (1.2)
  static constexpr float kFabPadding = 16;
  static constexpr float kFabIconSize = 17;
  // Reaction chip (7)
  static constexpr float kChipHPad = 10;
  static constexpr float kChipVPad = 5;
  static constexpr float kChipMineFillOpacity = 0.15f;
  static constexpr float kChipBorderOpacity = 0.25f;
  static constexpr float kChipMineBorder = 1.5f;
  static constexpr float kChipBorder = 1;
  static constexpr float kChipFont = 14;
  static constexpr float kChipInnerSpacing = 4;
  static constexpr float kChipRowSpacing = 6;
  static constexpr float kAddReactionIcon = 15;
  static constexpr float kReactionPopoverWidth = 300;
  static constexpr float kReactionPopoverPad = 16;
  static constexpr float kReactionPopoverRowHeight = 36;
  // Vote (8)
  static constexpr float kVoteSpacing = 10;
  static constexpr float kVoteIcon = 15;
  static constexpr float kVoteCountFont = 14;
  // Poll (9)
  static constexpr float kPollSpacing = 10;
  static constexpr float kPollOptionSpacing = 6;
  static constexpr float kPollRowSpacing = 8;
  static constexpr float kPollOptionRadius = 10;
  static constexpr float kPollOptionHPad = 12;
  static constexpr float kPollOptionVPad = 10;
  static constexpr float kPollBorderOpacity = 0.25f;
  static constexpr float kPollUnselectedFill = 0.2f;
  static constexpr float kPollSelectedFill = 0.3f;
  static constexpr float kPollSelectedBorder = 1.5f;
  static constexpr float kPollBorder = 1;
  static constexpr float kPollTotalHPad = 4;
  // Report sheet (11.3)
  static constexpr int kReportDetailMinLines = 3;
  static constexpr int kReportDetailMaxLines = 8;
};

struct PostsTiming {
  static constexpr double kSmoothSeconds = 0.28;       // .smooth(duration: 0.28) reply and edit animations
  static constexpr double kFocusDelayMs = 50;          // composer focus delay (CommentEditorView)
  static constexpr double kScrollToCommentDelayMs = 50;
  static constexpr unsigned kDoubleTapMs = 300;       // window in which a second tap makes a double tap
  static constexpr double kScrollAnimationSeconds = 0.35;  // withAnimation default for scrollTo
  static constexpr unsigned kFeedPublishDelayMs = 300; // FeedVM.refresh publishes the new feed 300 ms later
  static constexpr double kFeedRefreshSettleSeconds = 0.6;
};

struct PostsLimits {
  static constexpr std::size_t kModelCacheEntries = 1024;   // per-target view model caches (vote, poll, report)
  static constexpr std::size_t kMaxRenderedComments = 4000; // flattened comment rows per list
  static constexpr std::size_t kMaxMentionParticipants = 200;
  static constexpr std::size_t kMaxPendingAttachments = 10; // ModelLimits::kMaxAttachmentsCount
  static constexpr std::size_t kMaxFeedCardsRendered = 2000;
  static constexpr std::size_t kMaxReactionChips = 64;
};

}  // namespace dp::spec
23.4ms