From b1e3b6eab78e1d1fedf61bca4c149763d388d57d Mon Sep 17 00:00:00 2001 From: vrubelroman Date: Sun, 25 Oct 2026 01:59:34 +0300 Subject: [PATCH] Library: New game and Paste PGN first in the title row; the chooser's search only for a long list Co-Authored-By: Claude Opus 5.5 --- apps/desktop/src/library.rs | 13 +++++++------ apps/desktop/src/own_db.rs | 4 +++- docs/design/library-layout.md | 1 + 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/apps/desktop/src/library.rs b/apps/desktop/src/library.rs index 2a8dd44..9baafe8 100644 --- a/apps/desktop/src/library.rs +++ b/apps/desktop/src/library.rs @@ -664,9 +664,9 @@ impl Library { if let Some(p) = pick { self.select_db(&p, ui.ctx()); } - self.shelf_actions(ui, true, actions); - ui.add_space(GROUP_GAP - ui.spacing().item_spacing.x); self.game_buttons(ui, icons, actions); + ui.add_space(GROUP_GAP - ui.spacing().item_spacing.x); + self.shelf_actions(ui, true, actions); ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| { self.app_buttons(ui, icons, actions); }); @@ -691,7 +691,7 @@ impl Library { } } - /// "♟ New game · 📋 Paste PGN" after the database actions: what to put in, together. + /// "♟ New game · 📋 Paste PGN" before the database actions: what to put in, together. fn game_buttons(&self, ui: &mut Ui, icons: bool, actions: &mut Vec) { let label = |full: &'static str, icon: &'static str| if icons { icon } else { full }; let hint = |full: &str, hint: &str| shelf_hint(icons, full, hint); @@ -720,7 +720,8 @@ impl Library { fn shelf(&mut self, ui: &mut Ui, databases: &[PathBuf], actions: &mut Vec) { ui.add_space(8.0); // The title row (library-layout.md §1.4): «Databases», then what to put in — the - // database actions and, apart, the game ones; the program's on the right. + // game ones first (used daily), then, apart, the database actions; the program's + // on the right. // Narrowing: the database actions fold to «+ ▾ 🌐» first (databases are added // seldom), then the other buttons show icons, then the title goes. let avail = ui.available_width(); @@ -744,9 +745,9 @@ impl Library { ui.heading(tr("Databases")); ui.add_space(16.0 - ui.spacing().item_spacing.x); } - self.shelf_actions(ui, folded, actions); - ui.add_space(GROUP_GAP - ui.spacing().item_spacing.x); self.game_buttons(ui, icons, actions); + ui.add_space(GROUP_GAP - ui.spacing().item_spacing.x); + self.shelf_actions(ui, folded, actions); ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| { self.app_buttons(ui, icons, actions); }); diff --git a/apps/desktop/src/own_db.rs b/apps/desktop/src/own_db.rs index fce35cc..f3b2bf4 100644 --- a/apps/desktop/src/own_db.rs +++ b/apps/desktop/src/own_db.rs @@ -315,7 +315,9 @@ impl Chooser { ui.label(RichText::new(&self.title).weak()); } ui.add_space(6.0); - let many = self.rows.len() > 8; + // The field that narrows the list, for a long list only (of the databases + // offered, not of the whole shelf). + let many = self.rows.iter().filter(|r| r.block.is_none()).count() > 8; if many { let edit = ui.add( egui::TextEdit::singleline(&mut self.search) diff --git a/docs/design/library-layout.md b/docs/design/library-layout.md index c256a0a..0aa7414 100644 --- a/docs/design/library-layout.md +++ b/docs/design/library-layout.md @@ -392,3 +392,4 @@ - 2026-10-25: первая версия. - 2026-10-25: по решению владельца «♟ Новая партия» и «📋 Вставить PGN» стоят слева, после действий с базами (через промежуток 16): слева всё, чем наполняют библиотеку; справа — только программа: «⚙ Настройки» и кнопка обновления. В пустой базе «+ Партия» одна — главная кнопка посередине (в шапке её нет). В «Новой базе» «Изменить папку…» — отдельной строкой под «Файл:». +- 2026-10-25: по решению владельца порядок слева: «♟ Новая партия», «📋 Вставить PGN», промежуток, затем действия с базами. Поле «Найти базу» в «Добавить в базу» — только когда предлагаемых баз больше восьми.