feat(readarr): handle the book details tabs and open the edition details popup
Add BookDetailsHandler, covering the editions, history and manual search tables, the automatic search, manual download and delete book file prompts, and tab movement across the book details modal. Selecting an edition builds the EditionDetailsModal client side from the already loaded row and pushes the popup block. Readarr has no edition detail endpoint, so there is no network request and no event to dispatch. The delete book file prompt is guarded on the book files table being populated. Unlike Lidarr, where a track row carries its own file id, an edition carries none and the file id comes from a separate table that can be empty while editions are present.
This commit is contained in:
5 files changed
+1601
-4
No files matched your search
@@ -20,8 +20,11 @@ use crate::handlers::table_handler::{TableHandlingConfig, handle_table};
|
||||
use crate::models::Route;
|
||||
|
||||
mod author_details_handler;
|
||||
mod book_details_handler;
|
||||
|
||||
pub(in crate::handlers::readarr_handlers) use author_details_handler::AuthorDetailsHandler;
|
||||
pub(in crate::handlers::readarr_handlers) use {
|
||||
author_details_handler::AuthorDetailsHandler, book_details_handler::BookDetailsHandler,
|
||||
};
|
||||
|
||||
#[cfg(test)]
|
||||
#[path = "library_handler_tests.rs"]
|
||||
@@ -63,13 +66,19 @@ impl<'a, 'b> KeyEventHandler<'a, 'b, ActiveReadarrBlock> for LibraryHandler<'a,
|
||||
AuthorDetailsHandler::new(self.key, self.app, self.active_readarr_block, self.context)
|
||||
.handle();
|
||||
}
|
||||
_ if BookDetailsHandler::accepts(self.active_readarr_block) => {
|
||||
BookDetailsHandler::new(self.key, self.app, self.active_readarr_block, self.context)
|
||||
.handle();
|
||||
}
|
||||
_ => self.handle_key_event(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn accepts(active_block: ActiveReadarrBlock) -> bool {
|
||||
AuthorDetailsHandler::accepts(active_block) || LIBRARY_BLOCKS.contains(&active_block)
|
||||
AuthorDetailsHandler::accepts(active_block)
|
||||
|| BookDetailsHandler::accepts(active_block)
|
||||
|| LIBRARY_BLOCKS.contains(&active_block)
|
||||
}
|
||||
|
||||
fn ignore_special_keys(&self) -> bool {
|
||||
|
||||
Reference in new issue
Block a user