Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ensure no popup is rendered on top the playback window #400

Merged
merged 2 commits into from
Mar 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ jobs:
matrix:
os: [macOS-latest, windows-latest, ubuntu-latest]
toolchain: [stable]
include:
- os: ubuntu-latest
toolchain: beta

runs-on: ${{ matrix.os }}

Expand Down Expand Up @@ -61,4 +58,3 @@ jobs:

- name: Cargo clippy without features
run: cargo clippy --no-default-features -- -D warnings

8 changes: 5 additions & 3 deletions spotify_player/src/ui/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,17 @@ fn render_application(
ui: &mut UIStateGuard,
rect: Rect,
) -> Result<()> {
// rendering order: help popup -> other popups -> playback window -> main layout
// rendering order: shortcut help popup -> playback window -> other popups -> main layout

let rect = popup::render_shortcut_help_popup(frame, state, ui, rect);

let (rect, is_active) = popup::render_popup(frame, state, ui, rect);

// render playback window before other popups to ensure no popup is rendered on top
// of the playback window
let (playback_rect, rect) = playback::split_rect_for_playback_window(rect, state);
playback::render_playback_window(frame, state, ui, playback_rect)?;

let (rect, is_active) = popup::render_popup(frame, state, ui, rect);

render_main_layout(is_active, frame, state, ui, rect)?;
Ok(())
}
Expand Down
16 changes: 4 additions & 12 deletions spotify_player/src/ui/popup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,20 +82,12 @@ pub fn render_popup(
(chunks[0], true)
}
PopupState::CommandHelp { .. } => {
// the command help popup will cover the entire main layout
let chunks =
Layout::vertical([Constraint::Fill(0), Constraint::Length(0)]).split(rect);

render_commands_help_popup(frame, state, ui, chunks[0]);
(chunks[1], false)
render_commands_help_popup(frame, state, ui, rect);
(Rect::default(), false)
}
PopupState::Queue { .. } => {
// the queue popup will cover the entire main layout
let chunks =
Layout::vertical([Constraint::Fill(0), Constraint::Length(0)]).split(rect);

render_queue_popup(frame, state, ui, chunks[0]);
(chunks[1], false)
render_queue_popup(frame, state, ui, rect);
(Rect::default(), false)
}
PopupState::ActionList(item, _) => {
let rect = render_list_popup(
Expand Down
Loading