feat(radarr): make the collection movie overview popup scrollable
A collection movie's overview renders in a popup that does not scroll, so a long overview overflows with no way to read the rest. The popup now scrolls. The popup owns its own ScrollableText, built from the selected collection movie's overview when it opens and torn down on Esc so a reopened popup starts at the top. Scrolling mutates only that owned state. The background renders the Collection record's overview and the movies table, neither of which carries a scroll offset, so they cannot scroll along with the popup. The popup also gains the loading and absent fallbacks the rest of the tree already has. Give the collection movie fixture an overview distinct from its collection's, and a multi-paragraph one, so the snapshots can tell the two records apart and a scrolled popup is distinguishable from an unscrolled one.
This commit is contained in:
24 files changed
+913
-66
No files matched your search
@@ -247,3 +247,9 @@ impl From<&RadarrData<'_>> for EditCollectionModal {
|
||||
edit_collection_modal
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
#[cfg_attr(test, derive(Debug))]
|
||||
pub struct MovieOverviewModal {
|
||||
pub overview: ScrollableText,
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
mod test {
|
||||
use crate::models::radarr_models::{Collection, MinimumAvailability, Movie, MovieMonitor};
|
||||
use crate::models::servarr_data::radarr::modals::{
|
||||
AddMovieModal, EditCollectionModal, EditIndexerModal, EditMovieModal,
|
||||
AddMovieModal, EditCollectionModal, EditIndexerModal, EditMovieModal, MovieOverviewModal,
|
||||
};
|
||||
use crate::models::servarr_data::radarr::radarr_data::RadarrData;
|
||||
use crate::models::servarr_data::radarr::radarr_data::radarr_test_utils::utils::create_test_radarr_data;
|
||||
@@ -254,4 +254,11 @@ mod test {
|
||||
assert_eq!(edit_collection_modal.monitored, Some(true));
|
||||
assert_eq!(edit_collection_modal.search_on_add, Some(true));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_movie_overview_modal_default() {
|
||||
let movie_overview_modal = MovieOverviewModal::default();
|
||||
|
||||
assert_is_empty!(movie_overview_modal.overview);
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,7 @@ use crate::models::radarr_models::{
|
||||
};
|
||||
use crate::models::servarr_data::modals::{EditIndexerModal, IndexerTestResultModalItem};
|
||||
use crate::models::servarr_data::radarr::modals::{
|
||||
AddMovieModal, EditCollectionModal, EditMovieModal, MovieDetailsModal,
|
||||
AddMovieModal, EditCollectionModal, EditMovieModal, MovieDetailsModal, MovieOverviewModal,
|
||||
};
|
||||
use crate::models::servarr_models::{DiskSpace, Indexer, QueueEvent, RootFolder};
|
||||
use crate::models::stateful_list::StatefulList;
|
||||
@@ -86,6 +86,7 @@ pub struct RadarrData<'a> {
|
||||
pub indexer_test_errors: Option<String>,
|
||||
pub indexer_test_all_results: Option<StatefulTable<IndexerTestResultModalItem>>,
|
||||
pub movie_details_modal: Option<MovieDetailsModal>,
|
||||
pub movie_overview_modal: Option<MovieOverviewModal>,
|
||||
pub prompt_confirm: bool,
|
||||
pub prompt_confirm_action: Option<RadarrEvent>,
|
||||
pub delete_movie_files: bool,
|
||||
@@ -158,6 +159,7 @@ impl<'a> Default for RadarrData<'a> {
|
||||
indexer_test_errors: None,
|
||||
indexer_test_all_results: None,
|
||||
movie_details_modal: None,
|
||||
movie_overview_modal: None,
|
||||
prompt_confirm: false,
|
||||
prompt_confirm_action: None,
|
||||
delete_movie_files: false,
|
||||
@@ -360,6 +362,10 @@ impl RadarrData<'_> {
|
||||
.movie_releases
|
||||
.sorting(vec![sort_option!(indexer_id)]);
|
||||
|
||||
let movie_overview_modal = MovieOverviewModal {
|
||||
overview: ScrollableText::with_string(collection_movie().overview.clone()),
|
||||
};
|
||||
|
||||
let mut radarr_data = RadarrData {
|
||||
disk_space_vec: vec![diskspace()],
|
||||
version: "1.2.3.4".to_owned(),
|
||||
@@ -378,6 +384,7 @@ impl RadarrData<'_> {
|
||||
indexer_test_errors: Some("error".into()),
|
||||
indexer_test_all_results: Some(indexer_test_results),
|
||||
movie_details_modal: Some(movie_details_modal),
|
||||
movie_overview_modal: Some(movie_overview_modal),
|
||||
delete_movie_files: true,
|
||||
..RadarrData::default()
|
||||
};
|
||||
|
||||
@@ -135,6 +135,7 @@ mod tests {
|
||||
assert_none!(&radarr_data.indexer_test_errors);
|
||||
assert_none!(&radarr_data.indexer_test_all_results);
|
||||
assert_none!(&radarr_data.movie_details_modal);
|
||||
assert_none!(&radarr_data.movie_overview_modal);
|
||||
assert_none!(&radarr_data.prompt_confirm_action);
|
||||
assert!(!radarr_data.prompt_confirm);
|
||||
assert!(!radarr_data.delete_movie_files);
|
||||
|
||||
Reference in new issue
Block a user