Rearrange includes
All checks were successful
Cargo CI / Build and Test (pull_request) Successful in 1m55s
Cargo CI / Lint (pull_request) Successful in 1m4s

This commit is contained in:
Wojciech Kozlowski 2024-08-29 16:59:50 +02:00
parent 284556f756
commit 220e569bda

View File

@ -8,24 +8,29 @@ mod reload;
mod style; mod style;
mod widgets; mod widgets;
use browse::{AlbumArea, AlbumState, ArtistArea, ArtistState, FrameArea, TrackArea, TrackState};
use display::UiDisplay;
use info::{AlbumOverlay, ArtistOverlay};
use matches::AlbumMatchesState;
use minibuffer::Minibuffer;
use musichoard::collection::{album::Album, track::Track, Collection};
use overlay::{OverlayBuilder, OverlaySize};
use ratatui::{ use ratatui::{
layout::{Alignment, Rect}, layout::{Alignment, Rect},
widgets::{Paragraph, Wrap}, widgets::{Paragraph, Wrap},
Frame, Frame,
}; };
use widgets::UiWidget;
use musichoard::collection::{album::Album, Collection};
use crate::tui::{ use crate::tui::{
app::{AppPublicState, AppState, Category, IAppAccess, Selection, WidgetState}, app::{AppPublicState, AppState, Category, IAppAccess, Selection, WidgetState},
lib::interface::musicbrainz::Match, lib::interface::musicbrainz::Match,
ui::reload::ReloadMenu, ui::{
browse::{
AlbumArea, AlbumState, ArtistArea, ArtistState, FrameArea, TrackArea, TrackState,
},
display::UiDisplay,
info::{AlbumOverlay, ArtistOverlay},
matches::AlbumMatchesState,
minibuffer::Minibuffer,
overlay::{OverlayBuilder, OverlaySize},
reload::ReloadMenu,
widgets::UiWidget,
},
}; };
pub trait IUi { pub trait IUi {
@ -81,11 +86,10 @@ impl Ui {
Self::render_artist_column(artist_state, areas.artist, frame); Self::render_artist_column(artist_state, areas.artist, frame);
let no_albums: Vec<Album> = vec![];
let albums = selection let albums = selection
.state_album(artists) .state_album(artists)
.map(|st| st.list) .map(|st| st.list)
.unwrap_or_else(|| &no_albums); .unwrap_or_default();
let album_state = AlbumState::new( let album_state = AlbumState::new(
active == Category::Album, active == Category::Album,
albums, albums,
@ -94,11 +98,10 @@ impl Ui {
Self::render_album_column(album_state, areas.album, frame); Self::render_album_column(album_state, areas.album, frame);
let no_tracks: Vec<Track> = vec![];
let tracks = selection let tracks = selection
.state_track(artists) .state_track(artists)
.map(|st| st.list) .map(|st| st.list)
.unwrap_or_else(|| &no_tracks); .unwrap_or_default();
let track_state = TrackState::new( let track_state = TrackState::new(
active == Category::Track, active == Category::Track,
tracks, tracks,