Fix round: readable selected segments, panels that fit, smaller fonts

- A selected segment is the accent with white text, in both themes.
- At three columns the row of "Where compiles went", "By language" and
  "Problems" is one modest height; the reasons table is its own panel,
  "Why compiles were not cacheable", stacked under "Speed" beside
  "Over time" and as tall together as it is. In the two-column and
  one-column layouts it follows "Where compiles went".
- Raw counters use every column; each value follows its key by 16 px,
  and a key ends in "..." only where the two do not fit.
- No blank row between a table's head and its first row.
- The five embedded fonts are subset to Latin text and the symbols the
  page uses with pyftsubset (hinting dropped); the wasm goes from
  5.49 MB to 4.11 MB.
This commit is contained in:
swaits committed 2026-11-28 13:40:27 -07:00
1 parent 03ffdf887a
commit 7e864ad749
11 files changed
+173 -106

No files matched your search

+62 -21
View File
@@ -523,27 +523,30 @@ fn single(ui: &mut egui::Ui, title: &str, body: impl FnOnce(&mut egui::Ui)) {
close_row(ui, &[taken]);
}
/// How tall a panel is that holds `rows` table rows under its title.
fn table_height(fixed: f32, rows: usize) -> f32 {
fixed + rows as f32 * theme::space::ROW
}
/// How tall the row of "Where compiles went", "By language" and "Problems" is:
/// enough for the tallest of the three, and never less than the usual height.
fn triptych_height(view: &View) -> f32 {
use theme::layout as l;
let languages = l::LANGUAGES_FIXED_HEIGHT + view.languages.len() as f32 * theme::space::ROW + 2.0 * theme::space::PANEL_PADDING;
let problems = l::PROBLEMS_FIXED_HEIGHT + view.problems.len() as f32 * l::PROBLEM_HEIGHT + 2.0 * theme::space::PANEL_PADDING;
l::TRIPTYCH_HEIGHT
.max(where_went::height(view.not_cached.len()))
.max(languages)
.max(problems)
.max(l::WHERE_FIXED_HEIGHT)
.max(table_height(l::LANGUAGES_FIXED_HEIGHT, view.languages.len()))
.max(problems_height(view))
}
/// How tall a panel with `histograms` build-time histograms in it is.
/// How tall "Speed" is.
fn speed_height(view: &View) -> f32 {
use theme::layout as l;
let with_histograms = view
.build_times
.iter()
.filter(|times| times.compiles > 0 && !times.bins.is_empty())
.count() as f32;
l::SPEED_FIXED_HEIGHT + with_histograms * l::HISTOGRAM_HEIGHT
.count();
table_height(l::SPEED_FIXED_HEIGHT, 0) + with_histograms as f32 * l::HISTOGRAM_HEIGHT
}
fn problems_height(view: &View) -> f32 {
@@ -551,17 +554,35 @@ fn problems_height(view: &View) -> f32 {
if view.problems.is_empty() {
88.0
} else {
l::PROBLEMS_FIXED_HEIGHT + view.problems.len() as f32 * l::PROBLEM_HEIGHT + 2.0 * theme::space::PANEL_PADDING
table_height(l::PROBLEMS_FIXED_HEIGHT, 0) + view.problems.len() as f32 * l::PROBLEM_HEIGHT
}
}
/// How tall the row of "Over time" is when "Speed" and "Why compiles were not
/// cacheable" are stacked beside it: the taller of the two sides.
fn charts_height(view: &View) -> f32 {
use theme::layout as l;
let stacked = speed_height(view)
+ theme::space::PANEL_GAP
+ where_went::reasons_height(view.not_cached.len());
l::CHARTS_HEIGHT.max(stacked)
}
/// How tall each chart of "Over time" is in a row `height` tall: the usual
/// height, plus the room a taller row leaves.
fn chart_height(height: f32) -> f32 {
let extra = (height - theme::layout::CHARTS_HEIGHT).max(0.0);
theme::drawing::CHART_HEIGHT + (extra / 2.0 - 2.0 * theme::space::LINE).max(0.0)
}
/// The whole page below the controls: a grid of panels.
fn page(ui: &mut egui::Ui, view: &View, asked: Range, hidden_languages: &mut Vec<String>) {
let p = theme::ui(ui);
use theme::layout as l;
let gap = theme::space::PANEL_GAP;
if let Some(error) = &view.server.error {
style::banner(ui, egui::RichText::new(format!("sccache is not working: {error}")), p.bad);
ui.add_space(theme::space::PANEL_GAP);
ui.add_space(gap);
}
let columns = theme::columns(ui.available_rect_before_wrap().width());
@@ -582,32 +603,52 @@ fn page(ui: &mut egui::Ui, view: &View, asked: Range, hidden_languages: &mut Vec
let (_, b) = style::panel(ui, b, "By language", |ui| where_went::languages(ui, view));
let (_, c) = style::panel(ui, c, "Problems", |ui| problems::section(ui, view));
close_row(ui, &[a, b, c]);
let [a, b] = row(ui, l::CHARTS_HEIGHT, &[2, 1]).try_into().expect("two panels");
let (_, a) = style::panel(ui, a, "Over time", |ui| overtime::section(ui, view, hidden_languages));
let (_, b) = style::panel(ui, b, "Speed", |ui| speed::section(ui, view));
close_row(ui, &[a, b]);
// "Over time" over two columns; "Speed" and the reasons stacked in the third, together as tall.
let height = charts_height(view);
let [wide, side] = row(ui, height, &[2, 1]).try_into().expect("two panels");
let speed = speed_height(view);
let speed_rect = egui::Rect::from_min_max(side.min, egui::pos2(side.right(), side.top() + speed));
let reasons_rect = egui::Rect::from_min_max(egui::pos2(side.left(), side.top() + speed + gap), side.max);
let (_, wide) = style::panel(ui, wide, "Over time", |ui| {
overtime::section(ui, view, hidden_languages, chart_height(height))
});
let (_, speed) = style::panel(ui, speed_rect, "Speed", |ui| speed::section(ui, view));
let (_, reasons) = style::panel(ui, reasons_rect, "Why compiles were not cacheable", |ui| {
where_went::reasons(ui, view)
});
close_row(ui, &[wide, speed, reasons]);
}
2 => {
let height = triptych_height(view);
let reasons = where_went::reasons_height(view.not_cached.len());
let height = l::TRIPTYCH_HEIGHT.max(l::WHERE_FIXED_HEIGHT).max(reasons);
let [a, b] = row(ui, height, &[1, 1]).try_into().expect("two panels");
let (_, a) = style::panel(ui, a, "Where compiles went", |ui| where_went::section(ui, view));
let (_, b) = style::panel(ui, b, "By language", |ui| where_went::languages(ui, view));
let (_, b) = style::panel(ui, b, "Why compiles were not cacheable", |ui| where_went::reasons(ui, view));
close_row(ui, &[a, b]);
let height = l::TRIPTYCH_HEIGHT.min(360.0).max(problems_height(view)).max(speed_height(view));
let height = l::TRIPTYCH_HEIGHT
.max(table_height(l::LANGUAGES_FIXED_HEIGHT, view.languages.len()))
.max(problems_height(view));
let [a, b] = row(ui, height, &[1, 1]).try_into().expect("two panels");
let (_, a) = style::panel(ui, a, "Problems", |ui| problems::section(ui, view));
let (_, b) = style::panel(ui, b, "Speed", |ui| speed::section(ui, view));
let (_, a) = style::panel(ui, a, "By language", |ui| where_went::languages(ui, view));
let (_, b) = style::panel(ui, b, "Problems", |ui| problems::section(ui, view));
close_row(ui, &[a, b]);
let [a] = row(ui, l::CHARTS_HEIGHT, &[2]).try_into().expect("one panel");
let (_, a) = style::panel(ui, a, "Over time", |ui| overtime::section(ui, view, hidden_languages));
let (_, a) = style::panel(ui, a, "Over time", |ui| {
overtime::section(ui, view, hidden_languages, theme::drawing::CHART_HEIGHT)
});
close_row(ui, &[a]);
single(ui, "Speed", |ui| speed::section(ui, view));
}
_ => {
// One column: the phone's order, each panel as tall as what it holds.
single(ui, "Problems", |ui| problems::section(ui, view));
single(ui, "Where compiles went", |ui| where_went::section(ui, view));
single(ui, "Why compiles were not cacheable", |ui| where_went::reasons(ui, view));
single(ui, "By language", |ui| where_went::languages(ui, view));
single(ui, "Over time", |ui| overtime::section(ui, view, hidden_languages));
single(ui, "Over time", |ui| {
overtime::section(ui, view, hidden_languages, theme::drawing::CHART_HEIGHT)
});
single(ui, "Speed", |ui| speed::section(ui, view));
}
}