refactor: Improved and simplified the implementation of history details for both Sonarr and Lidarr

This commit is contained in:
2026-01-13 12:36:21 -07:00
parent ad9e2b3671
commit e1a25bfaf2
18 changed files with 377 additions and 486 deletions
+3 -24
View File
@@ -2,16 +2,10 @@ use crate::app::App;
use crate::models::Route;
use crate::models::servarr_data::sonarr::sonarr_data::{ActiveSonarrBlock, SEASON_DETAILS_BLOCKS};
use crate::models::sonarr_models::{
DownloadRecord, DownloadStatus, Episode, SonarrHistoryEventType, SonarrHistoryItem, SonarrRelease,
DownloadRecord, DownloadStatus, Episode, SonarrHistoryItem, SonarrRelease,
};
use crate::ui::sonarr_ui::library::episode_details_ui::EpisodeDetailsUi;
use crate::ui::sonarr_ui::sonarr_ui_utils::{
create_download_failed_history_event_details,
create_download_folder_imported_history_event_details,
create_episode_file_deleted_history_event_details,
create_episode_file_renamed_history_event_details, create_grabbed_history_event_details,
create_no_data_history_event_details,
};
use crate::ui::sonarr_ui::sonarr_ui_utils::create_history_event_details;
use crate::ui::styles::ManagarrStyle;
use crate::ui::styles::secondary_style;
use crate::ui::utils::{
@@ -548,22 +542,7 @@ fn draw_history_item_details_popup(f: &mut Frame<'_>, app: &mut App<'_>, area: R
SonarrHistoryItem::default()
};
let line_vec = match current_selection.event_type {
SonarrHistoryEventType::Grabbed => create_grabbed_history_event_details(current_selection),
SonarrHistoryEventType::DownloadFolderImported => {
create_download_folder_imported_history_event_details(current_selection)
}
SonarrHistoryEventType::DownloadFailed => {
create_download_failed_history_event_details(current_selection)
}
SonarrHistoryEventType::EpisodeFileDeleted => {
create_episode_file_deleted_history_event_details(current_selection)
}
SonarrHistoryEventType::EpisodeFileRenamed => {
create_episode_file_renamed_history_event_details(current_selection)
}
_ => create_no_data_history_event_details(current_selection),
};
let line_vec = create_history_event_details(current_selection);
let text = Text::from(line_vec);
let message = Message::new(text)