Add tabs to the cockpit
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
Isaac Mills 2025-07-20 00:44:28 -06:00
parent 852fba7b05
commit 6cac22c9d8
Signed by: fnmain
GPG key ID: B67D7410F33A0F61
4 changed files with 73 additions and 7 deletions

View file

@ -2,6 +2,7 @@ use std::{cell::RefCell, rc::Rc};
use ratzilla::{
backend::canvas::CanvasBackendOptions,
event::KeyCode,
ratatui::{
widgets::{Block, Borders},
Terminal,
@ -31,7 +32,16 @@ pub fn run(grid_id: &str) {
.unwrap();
let terminal = Terminal::new(backend).unwrap();
let app = Rc::new(RefCell::new(App::default()));
let app = Rc::new(RefCell::new(App::new()));
terminal.on_key_event({
let app = Rc::clone(&app);
move |event| match event.code {
KeyCode::Left => app.borrow_mut().prev_tab(),
KeyCode::Right => app.borrow_mut().next_tab(),
_ => {}
}
});
terminal.draw_web({
let app = Rc::clone(&app);