pinakes-tui: add book management view and api key authentication

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I20f205d9e06a93a89e8f4433ed6f80576a6a6964
This commit is contained in:
raf 2026-03-08 00:42:34 +03:00
commit 66861b8a20
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF
18 changed files with 917 additions and 251 deletions

View file

@ -24,6 +24,7 @@ pub enum Action {
QueueView,
StatisticsView,
TasksView,
BooksView,
ScanTrigger,
Refresh,
NextTab,
@ -49,14 +50,20 @@ pub enum Action {
ClearSelection,
ToggleSelectionMode,
BatchDelete,
ConfirmBatchDelete,
BatchTag,
UpdateReadingProgress,
None,
}
#[expect(
clippy::missing_const_for_fn,
reason = "match arms return non-trivially constructed enum variants"
)]
pub fn handle_key(
key: KeyEvent,
in_input_mode: bool,
current_view: &View,
current_view: View,
) -> Action {
if in_input_mode {
match (key.code, key.modifiers) {
@ -101,6 +108,12 @@ pub fn handle_key(
_ => Action::None,
}
},
(KeyCode::Char('p'), _) => {
match current_view {
View::Detail => Action::UpdateReadingProgress,
_ => Action::None,
}
},
(KeyCode::Char('t'), _) => {
match current_view {
View::Tasks => Action::Toggle,
@ -116,6 +129,7 @@ pub fn handle_key(
}
},
(KeyCode::Char('a'), _) => Action::AuditView,
(KeyCode::Char('b'), _) => Action::BooksView,
(KeyCode::Char('S'), _) => Action::SettingsView,
(KeyCode::Char('B'), _) => Action::DatabaseView,
(KeyCode::Char('Q'), _) => Action::QueueView,