Skip to content

Commit

Permalink
feat(layout): minor adjustment to layout config
Browse files Browse the repository at this point in the history
This addresses the first request in aome510#535. The change is mainly in
adjusting how the borders are drawn.
  • Loading branch information
DOD-101 committed Aug 14, 2024
1 parent c3e9a4e commit efd1ab8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
4 changes: 2 additions & 2 deletions spotify_player/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -328,8 +328,8 @@ impl Default for LayoutConfig {

impl LayoutConfig {
fn check_values(&self) -> anyhow::Result<()> {
if self.library.album_percent + self.library.playlist_percent > 99 {
anyhow::bail!("Invalid library layout: summation of album_percent and playlist_percent cannot be greater than 99!");
if self.library.album_percent + self.library.playlist_percent > 100 {
anyhow::bail!("Invalid library layout: summation of album_percent and playlist_percent cannot be greater than 100!");
} else {
Ok(())
}
Expand Down
12 changes: 10 additions & 2 deletions spotify_player/src/ui/page.rs
Original file line number Diff line number Diff line change
Expand Up @@ -341,14 +341,22 @@ pub fn render_library_page(
let playlist_rect = construct_and_render_block(
"Playlists",
&ui.theme,
Borders::TOP | Borders::LEFT | Borders::BOTTOM,
if chunks[1].area() != 0 {
Borders::TOP | Borders::LEFT | Borders::BOTTOM
} else {
Borders::ALL
},
frame,
chunks[0],
);
let album_rect = construct_and_render_block(
"Albums",
&ui.theme,
Borders::TOP | Borders::LEFT | Borders::BOTTOM,
if chunks[2].area() != 0 {
Borders::TOP | Borders::LEFT | Borders::BOTTOM
} else {
Borders::ALL
},
frame,
chunks[1],
);
Expand Down

0 comments on commit efd1ab8

Please sign in to comment.