blob: a6c1f0df7f0ff5562dbd4b4cf601139c33e26235 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
#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));
}
};
}
|