great moves (task 27) design review: windows as high as their content, the summary in the middle, the button's text colour, bold signs, the subtitle's separator, the games that cannot be reviewed said

This commit is contained in:
vrubelroman 2026-11-27 17:27:10 +03:00
parent e46c98848c
commit 70422ce635
3 changed files with 49 additions and 7 deletions

View file

@ -156,7 +156,7 @@ impl StartDialog {
.show(ctx, |ui| {
ui.set_width(520.0);
let about = format!(
"{name} · {} {}",
"{name} · {} · {}",
crate::i18n::games(self.records.len()),
self.about
);
@ -164,7 +164,7 @@ impl StartDialog {
.on_hover_text(&about);
ui.add_space(8.0);
// Two lines kept for the counts: the window does not jump when they come.
ui.allocate_ui(egui::vec2(520.0, 40.0), |ui| match &self.counted {
ui.allocate_ui(egui::vec2(520.0, 60.0), |ui| match &self.counted {
None => {
ui.horizontal(|ui| {
ui.spinner();
@ -191,6 +191,20 @@ impl StartDialog {
};
ui.label(trf(key, &[("games", &crate::i18n::games(c.reviewed.len()))]));
}
// Why the list here is shorter than the table's.
if !c.skipped.is_empty() {
let mut reasons: Vec<&str> =
c.skipped.iter().map(|(_, s)| s.reason()).collect();
reasons.sort_unstable();
reasons.dedup();
ui.label(
RichText::new(trf(
"{k} cannot be reviewed ({reason})",
&[("k", &c.skipped.len()), ("reason", &reasons.join(", "))],
))
.weak(),
);
}
}
});
ui.add_space(6.0);
@ -199,7 +213,9 @@ impl StartDialog {
&[("p", &crate::review::processes())],
));
ui.add_space(8.0);
ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| {
// Its own height, not the window's: the buttons sit under the text.
ui.horizontal(|ui| {
ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| {
let ready = self.counted.is_some();
let start = ui.add_enabled(ready, egui::Button::new(tr("Start")));
if start.clicked() || (ready && ui.input(|i| i.key_pressed(Key::Enter))) {
@ -219,6 +235,7 @@ impl StartDialog {
{
out = Some(StartOutcome::Summary);
}
});
});
});
if out.is_none() && ctx.input(|i| i.key_pressed(Key::Escape)) {
@ -386,6 +403,9 @@ impl Summary {
let width = (ctx.content_rect().width() - 40.0).min(600.0);
egui::Window::new(title)
.id(egui::Id::new("brilliant_summary"))
// In the middle: the «!!» column it sums up stays in sight.
.pivot(egui::Align2::CENTER_CENTER)
.default_pos(ctx.content_rect().center())
.open(&mut open)
.collapsible(false)
.resizable(false)
@ -637,7 +657,9 @@ impl Summary {
}
}
ui.add_space(6.0);
ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| {
// Its own height, not the window's: the buttons sit under the text.
ui.horizontal(|ui| {
ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| {
if ui.button(tr("Close")).clicked() {
out = Some(SummaryAction::Close);
}
@ -663,6 +685,7 @@ impl Summary {
filter: Box::new(self.filter.clone()),
});
}
});
});
});
if !open || (out.is_none() && ctx.input(|i| i.key_pressed(Key::Escape))) {

View file

@ -20800,6 +20800,17 @@ const ROWS: &[[&str; 9]] = &[
"Qidiruv to‘xtatildi · tahlil qilindi: {n} dan {i}",
"Іздеу тоқтатылды · талданды: {n} ішінен {i}",
],
[
"{k} cannot be reviewed ({reason})",
"{k} нельзя разобрать ({reason})",
"{k} ne peuvent pas être analysées ({reason})",
"{k} können nicht analysiert werden ({reason})",
"{k} no se pueden analizar ({reason})",
"{k} non si possono analizzare ({reason})",
"{k} não podem ser analisadas ({reason})",
"{k} tasini tahlil qilib bo‘lmaydi ({reason})",
"{k} талдауға болмайды ({reason})",
],
];
#[cfg(test)]

View file

@ -1897,10 +1897,11 @@ impl LargeView {
body.clone()
};
job.append("!! ", 0.0, egui::TextFormat::simple(bold, teal));
// The button's own text colour (it lightens under the pointer).
job.append(
rest,
0.0,
egui::TextFormat::simple(body.clone(), ui.visuals().text_color()),
egui::TextFormat::simple(body.clone(), Color32::PLACEHOLDER),
);
let enabled = blocked.is_none();
let r = ui.add_enabled(enabled, egui::Button::new(job).small());
@ -3534,7 +3535,7 @@ fn marks_cell(ui: &mut Ui, entry: Option<crate::brilliant::Entry>, running: bool
}
} else {
(
"·",
"•",
ui.visuals().weak_text_color(),
tr("Reviewed: no brilliant or great moves").to_owned(),
)
@ -3548,7 +3549,14 @@ fn marks_cell(ui: &mut Ui, entry: Option<crate::brilliant::Entry>, running: bool
} else {
color
};
ui.add(egui::Label::new(RichText::new(text).strong().color(color)).selectable(false))
// Ubuntu-B, as the other signs of moves.
let bold = egui::FontId::new(13.0, egui::FontFamily::Name("bold".into()));
let font = if ui.fonts_mut(|f| f.families().contains(&bold.family)) {
bold
} else {
egui::FontId::proportional(13.0)
};
ui.add(egui::Label::new(RichText::new(text).font(font).color(color)).selectable(false))
.on_hover_text(hint);
},
);