Move refresh status to centered popup
All checks were successful
Build and Release / build-and-release (push) Successful in 54s
All checks were successful
Build and Release / build-and-release (push) Successful in 54s
Display "Refreshing library..." in a centered popup overlay instead of showing it in the title bar. This makes the refresh status more prominent and cleaner.
This commit is contained in:
parent
7c083cfb0e
commit
be9ee8c005
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "cm-player"
|
||||
version = "0.1.31"
|
||||
version = "0.1.32"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
|
||||
@ -77,6 +77,11 @@ pub fn render(frame: &mut Frame, state: &mut AppState, player: &mut Player) -> (
|
||||
|
||||
render_status_bar(frame, state, player, main_chunks[2]);
|
||||
|
||||
// Show refreshing popup if scanning
|
||||
if state.is_refreshing {
|
||||
render_info_popup(frame, "Refreshing library...");
|
||||
}
|
||||
|
||||
// Show confirmation popup if needed
|
||||
if state.show_refresh_confirm {
|
||||
render_confirm_popup(frame, "Refresh library?", "This may take a while");
|
||||
@ -409,16 +414,7 @@ fn render_title_bar(frame: &mut Frame, state: &AppState, player: &mut Player, ar
|
||||
// Right side: Status • Progress • Volume • Search (if active)
|
||||
let mut right_spans = Vec::new();
|
||||
|
||||
if state.is_refreshing {
|
||||
// Show only "Refreshing library..." when refreshing
|
||||
right_spans.push(Span::styled(
|
||||
"Refreshing library... ",
|
||||
Style::default()
|
||||
.fg(Theme::background())
|
||||
.bg(background_color)
|
||||
.add_modifier(Modifier::BOLD)
|
||||
));
|
||||
} else {
|
||||
{
|
||||
// Status (bold when playing)
|
||||
let status_text = match player_state {
|
||||
PlayerState::Stopped => "Stopped",
|
||||
@ -724,6 +720,42 @@ fn render_progress_bar(frame: &mut Frame, _state: &AppState, player: &mut Player
|
||||
frame.render_widget(progress_widget, area);
|
||||
}
|
||||
|
||||
fn render_info_popup(frame: &mut Frame, message: &str) {
|
||||
// Create centered popup area - smaller than confirm popup
|
||||
let area = frame.area();
|
||||
let popup_width = 40;
|
||||
let popup_height = 3;
|
||||
|
||||
let popup_area = Rect {
|
||||
x: (area.width.saturating_sub(popup_width)) / 2,
|
||||
y: (area.height.saturating_sub(popup_height)) / 2,
|
||||
width: popup_width.min(area.width),
|
||||
height: popup_height.min(area.height),
|
||||
};
|
||||
|
||||
// Use Clear widget to completely erase the background
|
||||
frame.render_widget(Clear, popup_area);
|
||||
|
||||
// Render the popup block with solid background
|
||||
let block = Block::default()
|
||||
.borders(Borders::ALL)
|
||||
.style(Style::default()
|
||||
.bg(Theme::background())
|
||||
.fg(Theme::bright_foreground()));
|
||||
|
||||
let inner = block.inner(popup_area);
|
||||
frame.render_widget(block, popup_area);
|
||||
|
||||
// Render message centered
|
||||
let message_widget = Paragraph::new(message)
|
||||
.alignment(Alignment::Center)
|
||||
.style(Style::default()
|
||||
.fg(Theme::bright_foreground())
|
||||
.bg(Theme::background()));
|
||||
|
||||
frame.render_widget(message_widget, inner);
|
||||
}
|
||||
|
||||
fn render_confirm_popup(frame: &mut Frame, title: &str, message: &str) {
|
||||
// Create centered popup area
|
||||
let area = frame.area();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user