feat(app): view-mode toolbar toggle with per-view override
This commit is contained in:
parent
ada5b6d802
commit
4b011f8584
1 changed files with 18 additions and 0 deletions
18
src/app.rs
18
src/app.rs
|
|
@ -4239,6 +4239,24 @@ impl App {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// View-mode toggle: ☰ List / ▢ Card / ◫ Grid. Writes a per-view
|
||||||
|
// override; a view with no override falls back to the global default.
|
||||||
|
ui.horizontal(|ui| {
|
||||||
|
ui.label(egui::RichText::new("View:").weak().small());
|
||||||
|
let current = self.view_mode_for(&self.sidebar_view);
|
||||||
|
for (mode, label) in [
|
||||||
|
(ViewMode::List, "☰ List"),
|
||||||
|
(ViewMode::Card, "▢ Card"),
|
||||||
|
(ViewMode::Grid, "◫ Grid"),
|
||||||
|
] {
|
||||||
|
if ui.selectable_label(current == mode, label).clicked() {
|
||||||
|
self.view_mode_overrides
|
||||||
|
.insert(self.sidebar_view.clone(), mode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
ui.separator();
|
||||||
|
|
||||||
let density = self.card_density;
|
let density = self.card_density;
|
||||||
let view_mode = self.view_mode_for(&self.sidebar_view);
|
let view_mode = self.view_mode_for(&self.sidebar_view);
|
||||||
egui::ScrollArea::vertical().auto_shrink([false, false]).show(ui, |ui| {
|
egui::ScrollArea::vertical().auto_shrink([false, false]).show(ui, |ui| {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue