pinakes-tui: cover more API routes in the TUI crate

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: Id14b6f82d3b9f3c27bee9c214a1bdedc6a6a6964
This commit is contained in:
raf 2026-03-21 02:19:55 +03:00
commit 8129c5a6e7
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF
8 changed files with 1866 additions and 67 deletions

View file

@ -53,6 +53,29 @@ pub enum Action {
ConfirmBatchDelete,
BatchTag,
UpdateReadingProgress,
// Playlists
PlaylistsView,
CreatePlaylist,
DeletePlaylist,
RemoveFromPlaylist,
ShufflePlaylist,
AddToPlaylist,
// Social / detail
ToggleFavorite,
RateMedia,
AddComment,
EnrichMedia,
ToggleSubtitles,
// Transcode
ToggleTranscodes,
CancelTranscode,
// Admin
AdminView,
AdminTabNext,
AdminTabPrev,
DeleteUser,
DeleteDevice,
TestWebhook,
None,
}
@ -98,6 +121,8 @@ pub fn handle_key(
(KeyCode::Char('d'), _) => {
match current_view {
View::Tags | View::Collections => Action::DeleteSelected,
View::Playlists => Action::DeletePlaylist,
View::Admin => Action::DeleteUser,
_ => Action::Delete,
}
},
@ -111,16 +136,22 @@ pub fn handle_key(
(KeyCode::Char('p'), _) => {
match current_view {
View::Detail => Action::UpdateReadingProgress,
_ => Action::None,
_ => Action::PlaylistsView,
}
},
(KeyCode::Char('t'), _) => {
match current_view {
View::Tasks => Action::Toggle,
View::Detail => Action::ToggleTranscodes,
_ => Action::TagView,
}
},
(KeyCode::Char('c'), _) => Action::CollectionView,
(KeyCode::Char('c'), _) => {
match current_view {
View::Detail => Action::AddComment,
_ => Action::CollectionView,
}
},
// Multi-select: Ctrl+A for SelectAll (must come before plain 'a')
(KeyCode::Char('a'), KeyModifiers::CONTROL) => {
match current_view {
@ -130,15 +161,22 @@ pub fn handle_key(
},
(KeyCode::Char('a'), _) => Action::AuditView,
(KeyCode::Char('b'), _) => Action::BooksView,
(KeyCode::Char('S'), _) => Action::SettingsView,
(KeyCode::Char('S'), _) => {
match current_view {
View::Playlists => Action::ShufflePlaylist,
_ => Action::SettingsView,
}
},
(KeyCode::Char('B'), _) => Action::DatabaseView,
(KeyCode::Char('Q'), _) => Action::QueueView,
(KeyCode::Char('X'), _) => Action::StatisticsView,
(KeyCode::Char('A'), _) => Action::AdminView,
// Use plain D/T for views in non-library contexts, keep for batch ops in
// library/search
(KeyCode::Char('D'), _) => {
match current_view {
View::Library | View::Search => Action::BatchDelete,
View::Admin => Action::DeleteDevice,
_ => Action::DuplicatesView,
}
},
@ -157,9 +195,24 @@ pub fn handle_key(
},
(KeyCode::Char('s'), _) => Action::ScanTrigger,
(KeyCode::Char('r'), _) => Action::Refresh,
(KeyCode::Char('n'), _) => Action::CreateTag,
(KeyCode::Char('+'), _) => Action::TagMedia,
(KeyCode::Char('-'), _) => Action::UntagMedia,
(KeyCode::Char('n'), _) => {
match current_view {
View::Playlists => Action::CreatePlaylist,
_ => Action::CreateTag,
}
},
(KeyCode::Char('+'), _) => {
match current_view {
View::Library | View::Search => Action::AddToPlaylist,
_ => Action::TagMedia,
}
},
(KeyCode::Char('-'), _) => {
match current_view {
View::Playlists => Action::RemoveFromPlaylist,
_ => Action::UntagMedia,
}
},
(KeyCode::Char('v'), _) => {
match current_view {
View::Database => Action::Vacuum,
@ -169,11 +222,52 @@ pub fn handle_key(
(KeyCode::Char('x'), _) => {
match current_view {
View::Tasks => Action::RunNow,
View::Detail => Action::CancelTranscode,
_ => Action::None,
}
},
(KeyCode::Tab, _) => Action::NextTab,
(KeyCode::BackTab, _) => Action::PrevTab,
(KeyCode::Char('f'), _) => {
match current_view {
View::Detail => Action::ToggleFavorite,
_ => Action::None,
}
},
(KeyCode::Char('R'), _) => {
match current_view {
View::Detail => Action::RateMedia,
_ => Action::None,
}
},
(KeyCode::Char('E'), _) => {
match current_view {
View::Detail => Action::EnrichMedia,
_ => Action::None,
}
},
(KeyCode::Char('U'), _) => {
match current_view {
View::Detail => Action::ToggleSubtitles,
_ => Action::None,
}
},
(KeyCode::Char('w'), _) => {
match current_view {
View::Admin => Action::TestWebhook,
_ => Action::None,
}
},
(KeyCode::Tab, _) => {
match current_view {
View::Admin => Action::AdminTabNext,
_ => Action::NextTab,
}
},
(KeyCode::BackTab, _) => {
match current_view {
View::Admin => Action::AdminTabPrev,
_ => Action::PrevTab,
}
},
(KeyCode::PageUp, _) => Action::PageUp,
(KeyCode::PageDown, _) => Action::PageDown,
// Multi-select keys