From fdea0bbbf606fcd8cfec1613a3aaf610bfb9b3cf Mon Sep 17 00:00:00 2001 From: Ogulcan Celik Date: Mon, 6 Apr 2026 16:00:34 +0300 Subject: fix(ui): add sidebar section headers and align workspace drag slots --- src/ui.rs | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'src/ui.rs') diff --git a/src/ui.rs b/src/ui.rs index 7b5f25b7..d8322f6f 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -145,7 +145,7 @@ pub(crate) fn compute_workspace_card_areas( let ws_h = (total_h + 1) / 2; let ws_area = Rect::new(content.x, content.y, content.width, ws_h as u16); let list_bottom = ws_area.y + ws_area.height.saturating_sub(1); - let mut row_y = ws_area.y; + let mut row_y = ws_area.y.saturating_add(2); let mut cards = Vec::new(); for (ws_idx, ws) in app.workspaces.iter().enumerate() { @@ -431,7 +431,7 @@ pub(crate) fn workspace_drop_indicator_row( if insert_idx == 0 { return cards .first() - .map(|card| card.rect.y) + .and_then(|card| card.rect.y.checked_sub(1)) .filter(|y| *y < list_bottom); } if let Some(card) = cards.get(insert_idx) { @@ -439,7 +439,7 @@ pub(crate) fn workspace_drop_indicator_row( } cards .last() - .map(|_| list_bottom.saturating_sub(1)) + .map(|card| card.rect.y.saturating_add(card.rect.height)) .filter(|y| *y < list_bottom) } @@ -512,9 +512,21 @@ fn render_workspace_list(app: &AppState, frame: &mut Frame, area: Rect, is_navig _ => None, }; - // Reserve last row for "new" button + // Section header + reserve last row for "new" button let list_bottom = area.y + area.height.saturating_sub(1); - let mut row_y = area.y; + if area.height > 0 { + frame.render_widget( + Paragraph::new(Line::from(vec![Span::styled( + " spaces", + Style::default().fg(p.overlay0).add_modifier(Modifier::BOLD), + )])), + Rect::new(area.x, area.y, area.width, 1), + ); + } + let mut row_y = area.y.saturating_add(1); + + // Blank line for breathing room + row_y = row_y.saturating_add(1); for (i, ws) in app.workspaces.iter().enumerate() { if row_y + 1 >= list_bottom { -- cgit v1.2.3