diff --git a/src/tui/app/machine/fetch.rs b/src/tui/app/machine/fetch.rs index 9938bf2..fb48d1c 100644 --- a/src/tui/app/machine/fetch.rs +++ b/src/tui/app/machine/fetch.rs @@ -14,8 +14,11 @@ use musichoard::collection::{ use crate::tui::{ app::{ - machine::{App, AppInner, AppMachine}, AppMatchesInfo, AppPublic, AppState, IAppEventFetch, IAppInteractFetch - }, event::{Event, EventSender}, lib::interface::musicbrainz::{Error as MbError, IMusicBrainz} + machine::{App, AppInner, AppMachine}, + AppMatchesInfo, AppPublic, AppState, IAppEventFetch, IAppInteractFetch, + }, + event::{Event, EventSender}, + lib::interface::musicbrainz::{Error as MbError, IMusicBrainz}, }; use super::matches::AppMatches; @@ -70,7 +73,7 @@ impl AppMachine { AppMachine::error(inner, format!("fetch failed: {fetch_err}")).into() } }, - Err(try_recv_err) => match try_recv_err { + Err(recv_err) => match recv_err { TryRecvError::Disconnected => { if first { AppMachine::matches(inner, AppMatches::empty(fetch)).into() @@ -102,10 +105,6 @@ impl<'a> From<&'a mut AppMachine> for AppPublic<'a> { impl IAppInteractFetch for AppMachine { type APP = App; - fn proceed(self) -> Self::APP { - self.into() - } - fn abort(self) -> Self::APP { AppMachine::browse(self.inner).into() } diff --git a/src/tui/app/mod.rs b/src/tui/app/mod.rs index b931842..5dfaca6 100644 --- a/src/tui/app/mod.rs +++ b/src/tui/app/mod.rs @@ -92,7 +92,6 @@ pub trait IAppInteractSearch { pub trait IAppInteractFetch { type APP: IAppInteract; - fn proceed(self) -> Self::APP; fn abort(self) -> Self::APP; fn no_op(self) -> Self::APP; diff --git a/src/tui/ui/mod.rs b/src/tui/ui/mod.rs index 02f6d1e..dcf0f4a 100644 --- a/src/tui/ui/mod.rs +++ b/src/tui/ui/mod.rs @@ -131,6 +131,17 @@ impl Ui { UiWidget::render_overlay_widget("Reload", reload_text, area, false, frame); } + fn render_fetch_overlay(frame: &mut Frame) { + let area = OverlayBuilder::default().build(frame.size()); + UiWidget::render_overlay_widget( + "Fetching", + Paragraph::new(" -- fetching --"), + area, + false, + frame, + ) + } + fn render_matches_overlay( matches: Option<&AppMatchesInfo>, state: &mut WidgetState, @@ -162,11 +173,12 @@ impl IUi for Ui { Self::render_browse_frame(collection, selection, &state, frame); match state { - AppState::Info(_) => Self::render_info_overlay(collection, selection, frame), + AppState::Info(()) => Self::render_info_overlay(collection, selection, frame), + AppState::Reload(()) => Self::render_reload_overlay(frame), + AppState::Fetch(()) => Self::render_fetch_overlay(frame), AppState::Matches(public) => { Self::render_matches_overlay(public.matches, public.state, frame) } - AppState::Reload(_) => Self::render_reload_overlay(frame), AppState::Error(msg) => Self::render_error_overlay("Error", msg, frame), AppState::Critical(msg) => Self::render_error_overlay("Critical Error", msg, frame), _ => {}