Skip to content
Repos

DevPlaceApp

C++ 1.1 KB24 lines Opens in site

Directory Raw Download

// Spec: FR-CLI-02. Screen ids of the posts area: feed, post, report, comment-editor; plus the Routes.hpp factories.
#include "app/ScreenRegistry.hpp"
#include "screens/Routes.hpp"
#include "screens/comments/CommentEditorScreen.hpp"
#include "screens/components/ReportScreen.hpp"
#include "screens/feed/FeedScreen.hpp"
#include "screens/post/PostScreen.hpp"
#include "spec/PostsSpec.hpp"

namespace dp {

ui::ScreenPtr makeFeedScreen() { return std::make_shared<FeedScreen>(false); }

ui::ScreenPtr makePostScreen(PostDestination destination) { return std::make_shared<PostScreen>(std::move(destination)); }

void registerFeedScreens(ScreenRegistry& r) {
  // Standalone feed loads its own first page: nothing else does when a single screen is hosted.
  r.add("feed", [] { return std::make_shared<FeedScreen>(true); });
  r.add("post", [] { return makePostScreen(PostDestination{"a-post-with-several-attachments", std::nullopt}); });
  r.add("report", [] { return std::make_shared<ReportScreen>(ReportViewModel::shared(TargetType::Post, "mock-post")); }, true);
  r.add("comment-editor", [] { return std::make_shared<CommentEditorScreen>(); }, true);
}

}  // namespace dp
47.1ms