diff --git a/src/tui/keys.rs b/src/tui/keys.rs index 82f1900..0b28b91 100644 --- a/src/tui/keys.rs +++ b/src/tui/keys.rs @@ -1,6 +1,6 @@ //! Keyboard handling -use crossterm::event::{KeyCode, KeyEvent}; +use crossterm::event::{KeyCode, KeyEvent, KeyModifiers}; use super::state::{Mode, State}; @@ -18,8 +18,10 @@ pub async fn handle_key(state: &mut State, key_event: KeyEvent) { KeyCode::Esc | KeyCode::Char('q') => state.quit = true, _ => {} }, - Mode::Edit => match key_event.code { - KeyCode::Esc => state.mode = Mode::List, + Mode::Edit => match (key_event.modifiers, key_event.code) { + (KeyModifiers::NONE, KeyCode::Esc) => state.mode = Mode::List, + (KeyModifiers::NONE, KeyCode::Tab) => {} + (KeyModifiers::SHIFT, KeyCode::Tab) => {} _ => {} }, } diff --git a/src/tui/state.rs b/src/tui/state.rs index 6e1b0e2..a791b0c 100644 --- a/src/tui/state.rs +++ b/src/tui/state.rs @@ -74,28 +74,4 @@ impl State { } self.places_status = DataStatus::Fresh; } - - pub async fn fetch_places(&mut self) { - if let DataStatus::Fresh = self.places_status { - return; - } - let limit = (self.height as u8).saturating_sub(3); - let offset = (limit as u32) * self.page; - match self - .places_repository - .get_places_paginated(offset, limit) - .await - { - Ok(places) => { - self.places = places; - if !self.places.is_empty() { - self.selected_place.select(Some(0)); - } - } - Err(err) => { - tracing::error!("{err}"); - } - } - self.places_status = DataStatus::Fresh; - } } diff --git a/src/tui/ui.rs b/src/tui/ui.rs index f0fec97..ead1cf7 100644 --- a/src/tui/ui.rs +++ b/src/tui/ui.rs @@ -99,7 +99,7 @@ fn list_draw(state: &mut State, f: &mut Frame<'_>, area: Rect) { f.render_stateful_widget(places_table, area, &mut state.selected_place); } -fn edit_draw(state: &mut State, f: &mut Frame<'_>, area: Rect) {} +fn edit_draw(_state: &mut State, _f: &mut Frame<'_>, _area: Rect) {} #[expect(unstable_name_collisions)] fn footer_draw(state: &mut State, f: &mut Frame<'_>, area: Rect) {