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