34 lines
831 B
C++
34 lines
831 B
C++
#pragma once
|
|
|
|
#include <ftxui/component/component_base.hpp>
|
|
|
|
#include "katja/repository.hpp"
|
|
|
|
namespace katja
|
|
{
|
|
class UpdatesPage : public ftxui::ComponentBase
|
|
{
|
|
std::vector<package_identifier> updatable;
|
|
|
|
public:
|
|
explicit UpdatesPage(std::vector<package_identifier>&& updatable)
|
|
: updatable(std::move(updatable))
|
|
{
|
|
}
|
|
|
|
ftxui::Element Render() override
|
|
{
|
|
std::vector<std::shared_ptr<ftxui::Node>> lines;
|
|
|
|
for (const auto& package_identifier : this->updatable)
|
|
{
|
|
auto line = ftxui::text(package_identifier.to_string()) | color(ftxui::Color::SkyBlue2);
|
|
lines.push_back(line);
|
|
}
|
|
ftxui::Element summary = ftxui::text(" Updates (" + std::to_string(lines.size()) + ")");
|
|
|
|
return ftxui::window(summary, ftxui::vbox(lines));
|
|
}
|
|
};
|
|
}
|