aboutsummaryrefslogtreecommitdiff
path: root/src/app.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/app.rs')
-rw-r--r--src/app.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/app.rs b/src/app.rs
index b4e6456..fb18558 100644
--- a/src/app.rs
+++ b/src/app.rs
@@ -4,6 +4,12 @@ use ratatui_textarea::TextArea;
use crate::gentoo::{Package, portage::Portage};
#[derive(Debug)]
+pub enum ViewState {
+ Dashboard,
+ InstalledPackages,
+}
+
+#[derive(Debug)]
#[allow(dead_code)]
pub struct App<'a> {
portage: Portage,
@@ -14,6 +20,7 @@ pub struct App<'a> {
search_indexes: Option<Vec<usize>>,
pub search_indexes_len: Option<usize>,
pub current_search_index: Option<usize>,
+ pub view: ViewState,
}
#[allow(dead_code)]
@@ -28,6 +35,7 @@ impl<'a> App<'a> {
search_indexes: None,
current_search_index: None,
search_indexes_len: None,
+ view: ViewState::Dashboard,
}
}
@@ -50,6 +58,13 @@ impl<'a> App<'a> {
self.search_found = None;
}
+ pub fn cycle_current_tab(&mut self) {
+ match self.view {
+ ViewState::Dashboard => self.view = ViewState::InstalledPackages,
+ ViewState::InstalledPackages => self.view = ViewState::Dashboard,
+ }
+ }
+
pub fn search(&mut self) -> bool {
let indexes: Vec<usize> = self
.portage