Reasons: one line each, click to open; stack the small panels beside tall reasons

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
swaitsandClaude Sonnet 5.5 committed 2026-11-28 18:23:28 -07:00
1 parent 0759cbaa25
commit 30643390a7
4 files changed
+217 -50

No files matched your search

+35 -12
View File
@@ -5,6 +5,7 @@ use std::time::Duration;
use eframe::egui;
use sccache_dash_api::{Range, View};
use crate::disclosure;
use crate::fmt;
use crate::theme;
use crate::{cards, extras, net, overtime, problems, raw, speed, style, where_went};
@@ -631,18 +632,40 @@ fn page(ui: &mut egui::Ui, view: &View, asked: Range, hidden_languages: &mut Vec
2 => {
let half = style::span_width(ui, 2, 1);
let reasons = where_went::reasons_height(ui, view, half);
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, "Why compiles were not cacheable", |ui| where_went::reasons(ui, view));
close_row(ui, &[a, b]);
let height = l::TRIPTYCH_HEIGHT
.max(table_height(l::LANGUAGES_FIXED_HEIGHT, view.languages.len()))
.max(problems_height(ui, view, half));
let [a, b] = row(ui, height, &[1, 1]).try_into().expect("two panels");
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 (where_h, languages_h) = (
l::TRIPTYCH_HEIGHT.max(l::WHERE_FIXED_HEIGHT),
table_height(l::LANGUAGES_FIXED_HEIGHT, view.languages.len()),
);
let problems_h = problems_height(ui, view, half);
// Stacked, "By language" is its own row, so it also holds its head line.
let languages_h = languages_h.max(table_height(l::LANGUAGES_FIXED_HEIGHT, view.languages.len() + 1));
let stacked = where_h + languages_h + problems_h + 2.0 * gap;
if disclosure::stack_beside(where_h, stacked, reasons) {
// The reasons are tall: the three small panels stack beside them, the last one filling what is left.
let [left, right] = row(ui, stacked.max(reasons), &[1, 1]).try_into().expect("two panels");
let cut = |top: f32, bottom: f32| {
egui::Rect::from_min_max(egui::pos2(left.left(), top), egui::pos2(left.right(), bottom))
};
let a = cut(left.top(), left.top() + where_h);
let b = cut(a.bottom() + gap, a.bottom() + gap + languages_h);
let c = cut(b.bottom() + gap, left.bottom());
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 (_, c) = style::panel(ui, c, "Problems", |ui| problems::section(ui, view));
let (_, d) = style::panel(ui, right, "Why compiles were not cacheable", |ui| where_went::reasons(ui, view));
close_row(ui, &[a, b, c, d]);
} else {
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, "Why compiles were not cacheable", |ui| where_went::reasons(ui, view));
close_row(ui, &[a, b]);
let height = l::TRIPTYCH_HEIGHT.max(languages_h).max(problems_h);
let [a, b] = row(ui, height, &[1, 1]).try_into().expect("two panels");
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, theme::drawing::CHART_HEIGHT)