From 20f3d98d637c5992c53f19590c15fa923f4eedcd Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Sat, 19 Apr 2025 14:48:48 +0200 Subject: Move katja into a separate repository --- cli/component.hpp | 76 ------------------------------------------------------- 1 file changed, 76 deletions(-) delete mode 100644 cli/component.hpp (limited to 'cli/component.hpp') diff --git a/cli/component.hpp b/cli/component.hpp deleted file mode 100644 index c419020..0000000 --- a/cli/component.hpp +++ /dev/null @@ -1,76 +0,0 @@ -#pragma once - -#include -#include -#include - -#include "katja/repository.hpp" -#include "katja/database.hpp" - -namespace katja -{ - class PageBase : public ftxui::ComponentBase - { - public: - virtual void Load() = 0; - }; - - using Page = std::shared_ptr; - using Pages = std::vector; - - class ScreenContainer final : public ftxui::ComponentBase - { - int menu_selected{ 0 }; - ftxui::Component menu; - ftxui::Component content; - std::vector menu_entries; - Pages menu_pages; - std::function on_enter; - - public: - ScreenContainer(std::vector> pages, std::function on_enter); - - ftxui::Element OnRender() override; - bool OnEvent(ftxui::Event event) override; - }; - - ftxui::Component Screen(std::vector> pages, std::function on_enter); - - class WelcomePage final : public PageBase - { - public: - void Load() override; - ftxui::Element OnRender() override; - }; - - class UpdatesPage final : public PageBase - { - std::vector updatable; - std::shared_ptr repository; - package_database database; - - public: - UpdatesPage(std::shared_ptr repository, package_database database); - - void Load() override; - ftxui::Element OnRender() override; - }; - - class SearchPage final : public PageBase - { - std::string needle; - ftxui::Component search_input; - ftxui::Component type_input; - std::shared_ptr repository; - std::string architecture; - std::vector search_results; - int search_type{ 0 }; - - public: - SearchPage(std::shared_ptr repository, const std::string& architecture); - - void Load() override; - ftxui::Element OnRender() override; - bool OnEvent(ftxui::Event event) override; - }; -} -- cgit v1.2.3