Skip to content
Repos

DevPlaceApp

C++ 1.3 KB30 lines Opens in site

Directory Raw Download

#pragma once
// Spec: INV-social 16.2 (Profile layout parts): stat column, progress bar, info rows, web app footer.
#include <cstdint>
#include <string>

#include "ui/Views.hpp"

namespace dp {

class ProfileViews {
 public:
  // en_US grouping: 1234567 -> "1,234,567".
  static std::string grouped(std::int64_t value);
  // VStack(2): value 18 bold, uppercased label 14 FG_2.
  static ui::ViewPtr stat(const std::string& label, const std::string& value);
  // Linear ProgressView(value:), fraction clamped to 0..1.
  static ui::ViewPtr progressBar(double fraction);
  // "Progress to next level" and the percent text above the bar, padded vertically by 10.
  static ui::ViewPtr levelProgress(std::int64_t percent);
  // Section title (semibold FG_2).
  static ui::ViewPtr sectionTitle(const std::string& title);
  // HStack { title, Spacer, text trailing }.
  static ui::ViewPtr infoRow(const std::string& title, const std::string& text);
  // Same with a Link: the value is the raw link text in the accent color, only when the string forms a URL.
  static ui::ViewPtr linkRow(const std::string& title, const std::string& link);
  // Centered "For more info and options, visit this profile in the [web app](...)." with the link in the accent color.
  static ui::ViewPtr webAppInfo(const std::string& username);
};

}  // namespace dp
44.7ms