gardesk/garfield / 4685c7a

Browse files

ui: always show bookmarks section with divider

Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
4685c7acc0775a9849c0a88d1dcf7432b74dbdfb
Parents
5e56143
Tree
ee16536

1 changed file

StatusFile+-
M garfield/src/ui/sidebar.rs 25 20
garfield/src/ui/sidebar.rsmodified
@@ -410,26 +410,31 @@ impl Sidebar {
410410
             y = self.render_item(renderer, i, y, is_hovered, &icon_style, &name_style, &hover_style)?;
411411
         }
412412
 
413
-        // Render bookmarks section if any
414
-        if !self.bookmarks.is_empty() {
415
-            // Separator
416
-            y += 8;
417
-            renderer.line(
418
-                (self.bounds.x + self.padding as i32) as f64,
419
-                y as f64,
420
-                (self.bounds.x + self.bounds.width as i32 - self.padding as i32) as f64,
421
-                y as f64,
422
-                theme.border,
423
-                1.0,
424
-            )?;
425
-            y += 8;
426
-
427
-            // Header
428
-            let header_x = self.bounds.x + self.padding as i32;
429
-            renderer.text("Bookmarks", header_x as f64, y as f64, &header_style)?;
430
-            y += (theme.font_size + 4.0) as i32;
431
-
432
-            // Bookmark items
413
+        // Always show separator and bookmarks section
414
+        y += 8;
415
+        renderer.line(
416
+            (self.bounds.x + self.padding as i32) as f64,
417
+            y as f64,
418
+            (self.bounds.x + self.bounds.width as i32 - self.padding as i32) as f64,
419
+            y as f64,
420
+            theme.border,
421
+            1.0,
422
+        )?;
423
+        y += 8;
424
+
425
+        // Header
426
+        let header_x = self.bounds.x + self.padding as i32;
427
+        renderer.text("Bookmarks", header_x as f64, y as f64, &header_style)?;
428
+        y += (theme.font_size + 4.0) as i32;
429
+
430
+        // Bookmark items (or hint if empty)
431
+        if self.bookmarks.is_empty() {
432
+            let hint_style = TextStyle::new()
433
+                .font_family(&theme.font_family)
434
+                .font_size(theme.font_size - 2.0)
435
+                .color(theme.item_foreground.with_alpha(0.4));
436
+            renderer.text("Ctrl+D to add", (header_x + 4) as f64, y as f64, &hint_style)?;
437
+        } else {
433438
             for i in 0..self.bookmarks.len() {
434439
                 let combined_index = self.places.len() + i;
435440
                 let is_hovered = self.hovered == Some(combined_index);