aboutsummaryrefslogtreecommitdiff
path: root/cli/component.cpp
blob: 9e0593e9e6622b8330608044504b76295880b097 (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
#include "component.hpp"

namespace katja
{
    ftxui::Element WelcomePage::Render()
    {
        return ftxui::text("Select an action in the menu.");
    }

    UpdatesPage::UpdatesPage(std::vector<package_identifier>&& updatable)
        : updatable(std::move(updatable))
    {
    }

    ftxui::Element UpdatesPage::Render()
    {
        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));
    }
}