-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Manganato): implement search page provider
- Loading branch information
1 parent
76f10ba
commit c7e1457
Showing
10 changed files
with
794 additions
and
344 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
use crossterm::event::KeyCode; | ||
|
||
use crate::backend::manga_provider::{EventHandler, FiltersHandler}; | ||
use crate::backend::tui::Events; | ||
|
||
#[derive(Debug, Clone)] | ||
pub struct ManganatoFilterState {} | ||
|
||
#[derive(Debug, Clone)] | ||
pub struct ManganatoFiltersProvider { | ||
is_open: bool, | ||
filter: ManganatoFilterState, | ||
} | ||
|
||
impl ManganatoFiltersProvider { | ||
pub fn new(filter: ManganatoFilterState) -> Self { | ||
Self { | ||
is_open: false, | ||
filter, | ||
} | ||
} | ||
} | ||
|
||
impl EventHandler for ManganatoFiltersProvider { | ||
fn handle_events(&mut self, events: crate::backend::tui::Events) { | ||
match events { | ||
Events::Key(key) => match key.code { | ||
KeyCode::Char('f') => self.toggle(), | ||
_ => {}, | ||
}, | ||
_ => {}, | ||
} | ||
} | ||
} | ||
|
||
impl FiltersHandler for ManganatoFiltersProvider { | ||
type InnerState = ManganatoFilterState; | ||
|
||
fn toggle(&mut self) { | ||
self.is_open = !self.is_open; | ||
} | ||
|
||
fn is_open(&self) -> bool { | ||
self.is_open | ||
} | ||
|
||
fn is_typing(&self) -> bool { | ||
false | ||
} | ||
|
||
fn get_state(&self) -> &Self::InnerState { | ||
&self.filter | ||
} | ||
} |
Oops, something went wrong.