Consistency with other selectable lists
This commit is contained in:
parent
2c8754ce46
commit
2b92ab73e1
@ -1,15 +1,15 @@
|
||||
use musichoard::collection::album::Album;
|
||||
use ratatui::widgets::{List, ListItem};
|
||||
|
||||
use crate::tui::{lib::interface::musicbrainz::Match, ui::display::UiDisplay};
|
||||
use crate::tui::{app::WidgetState, lib::interface::musicbrainz::Match, ui::display::UiDisplay};
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct AlbumMatchesState<'a> {
|
||||
pub struct AlbumMatchesState<'a, 'b> {
|
||||
pub list: List<'a>,
|
||||
pub state: &'b mut WidgetState,
|
||||
}
|
||||
|
||||
impl<'a> AlbumMatchesState<'a> {
|
||||
pub fn new(matches: &[Match<Album>]) -> Self {
|
||||
impl<'a, 'b> AlbumMatchesState<'a, 'b> {
|
||||
pub fn new(matches: &[Match<Album>], state: &'b mut WidgetState) -> Self {
|
||||
let list = List::new(
|
||||
matches
|
||||
.iter()
|
||||
@ -18,6 +18,6 @@ impl<'a> AlbumMatchesState<'a> {
|
||||
.collect::<Vec<ListItem>>(),
|
||||
);
|
||||
|
||||
AlbumMatchesState { list }
|
||||
AlbumMatchesState { list, state }
|
||||
}
|
||||
}
|
||||
|
@ -293,8 +293,8 @@ impl Ui {
|
||||
) {
|
||||
let area = OverlayBuilder::default().build(frame.size());
|
||||
let matching_string = UiDisplay::display_matching_info(matching);
|
||||
let st = matches.map(AlbumMatchesState::new).unwrap_or_default();
|
||||
Self::render_overlay_list_widget(&matching_string, st.list, state, true, area, frame)
|
||||
let st = AlbumMatchesState::new(matches.unwrap_or_default(), state);
|
||||
Self::render_overlay_list_widget(&matching_string, st.list, st.state, true, area, frame)
|
||||
}
|
||||
|
||||
fn render_reload_overlay(frame: &mut Frame) {
|
||||
|
Loading…
Reference in New Issue
Block a user