Split ui.rs into modules based on UI element #200

Merged
wojtek merged 13 commits from 135---split-ui-rs-into-modules-based-on-ui-element into main 2024-08-29 17:21:52 +02:00
Showing only changes of commit 220e569bda - Show all commits

View File

@ -8,24 +8,29 @@ mod reload;
mod style;
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::{
layout::{Alignment, Rect},
widgets::{Paragraph, Wrap},
Frame,
};
use widgets::UiWidget;
use musichoard::collection::{album::Album, Collection};
use crate::tui::{
app::{AppPublicState, AppState, Category, IAppAccess, Selection, WidgetState},
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 {
@ -81,11 +86,10 @@ impl Ui {
Self::render_artist_column(artist_state, areas.artist, frame);
let no_albums: Vec<Album> = vec![];
let albums = selection
.state_album(artists)
.map(|st| st.list)
.unwrap_or_else(|| &no_albums);
.unwrap_or_default();
let album_state = AlbumState::new(
active == Category::Album,
albums,
@ -94,11 +98,10 @@ impl Ui {
Self::render_album_column(album_state, areas.album, frame);
let no_tracks: Vec<Track> = vec![];
let tracks = selection
.state_track(artists)
.map(|st| st.list)
.unwrap_or_else(|| &no_tracks);
.unwrap_or_default();
let track_state = TrackState::new(
active == Category::Track,
tracks,