feat(gui): the status card's heading carries the live state; one row fewer, so the sidebar fits the owner's 519 again

The heading row is the badge and name with the live dot and word at the right; the event ends the journal chain line. Folded, the card is the heading alone (or the heading over the failure line). The rail's badge carries the dot. The four sidenav tests are at their original sizes, the minimum window height is 400, and the goldens and snapshots are regenerated.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
swaitsandClaude Sonnet 5.5 committed 2026-11-20 19:39:01 -07:00
1 parent d3d5effafc
commit d8ff776a52
10 files changed
+306 -207

No files matched your search

+203 -157
View File
@@ -902,28 +902,33 @@ impl CompanyView {
let live = self.loader.is_some() || self.live_label;
let checks = checks(b);
let ok = checks.iter().all(|c| c.0);
let (r, resp) = ui.allocate_exact_size(
vec2(32.0, ui.spacing().interact_size.y + 4.0),
Sense::hover(),
);
// The company's badge, its live dot on the badge's
// corner (a warning there when a check failed); its
// name, state, event and checks on hover.
let (r, resp) =
ui.allocate_exact_size(vec2(RAIL_BADGE, RAIL_BADGE), Sense::hover());
head.paint(ui, r, 6);
let corner = r.right_bottom() - vec2(1.0, 1.0);
ui.painter().circle_filled(corner, 6.0, p.sidebar);
if ok {
let pulse = (ui.input(|i| i.time) - self.updated_at < 2.0) as u8 as f32;
ui.painter().circle_filled(
r.center(),
corner,
4.0 + pulse,
if live { p.positive } else { p.faint },
);
} else {
ui.painter().text(
r.center(),
corner,
egui::Align2::CENTER_CENTER,
icon::WARNING_CIRCLE,
egui::FontId::proportional(18.0),
egui::FontId::proportional(13.0),
p.negative,
);
}
let mut tip = format!(
"{} · event {}",
"{}\n{} · event {}",
head.title,
if live { "Live" } else { "Snapshot" },
b.seq()
);
@@ -938,13 +943,6 @@ impl CompanyView {
));
}
resp.on_hover_text(tip);
// The company, above its status (the footer is laid
// out bottom up): its badge alone, its name on hover.
ui.add_space(2.0);
let (r, resp) =
ui.allocate_exact_size(vec2(RAIL_BADGE, RAIL_BADGE), Sense::hover());
head.paint(ui, r, 6);
resp.on_hover_text(&head.title);
}
});
memo.measured(ui, "rail", fit.form(), footer.response.rect);
@@ -1709,19 +1707,109 @@ impl CardHead {
}
/// The card's heading row: the badge, small, and the name, cut with
/// an ellipsis to the card's width.
fn row(&self, ui: &mut Ui) -> egui::Response {
ui.horizontal(|ui| {
let (r, _) = ui.allocate_exact_size(vec2(CARD_BADGE, CARD_BADGE), Sense::hover());
self.paint(ui, r, 4);
ui.add(
egui::Label::new(RichText::new(&self.title).font(theme::semibold(12.5))).truncate(),
)
})
.inner
/// an ellipsis to the room the live mark leaves, and at the right
/// that mark: the dot and "Live" (or "Snapshot"), pulsing for two
/// seconds after an update. `after` is what the folded card, which
/// has no line of its own, adds after the word: its event and the
/// seal; the fullest that leaves the name [`NAME_MIN`] is drawn, and
/// what was drawn comes back with the name's response.
fn row(&self, ui: &mut Ui, since_update: f64, live: bool, after: Option<&After>) -> Drawn {
let p = pal(ui.ctx());
let status = if live { "Live" } else { "Snapshot" };
let font = theme::semibold(12.0);
let small = theme::regular(11.5);
let gap = ui.spacing().item_spacing.x;
let w = |ui: &Ui, text: &str, font: &egui::FontId| {
ui.fonts_mut(|f| {
f.layout_no_wrap(text.to_string(), font.clone(), p.text)
.size()
.x
})
};
let word = w(ui, status, &font);
let avail = ui.available_width() - CARD_BADGE - 2.0 * gap;
// The fullest mark that leaves the name its least room.
let (event, seal) = match after {
None => (None, None),
Some(a) => {
let tail = |ev: bool, seal: bool| {
let mut x = 0.0;
if ev {
x += MARK_GAP + w(ui, &a.event, &small);
}
if let (true, Some(sl)) = (seal, a.seal) {
x += MARK_GAP + w(ui, sl, &small);
}
x
};
let (ev, seal) = [(true, true), (true, false), (false, true), (false, false)]
.into_iter()
.find(|&(ev, sl)| avail - 8.0 - MARK_GAP - word - tail(ev, sl) >= NAME_MIN)
.unwrap_or((false, false));
(ev.then_some(a.event.as_str()), a.seal.filter(|_| seal))
}
};
let mark_w = 8.0
+ MARK_GAP
+ word
+ event.map_or(0.0, |e| MARK_GAP + w(ui, e, &small))
+ seal.map_or(0.0, |s| MARK_GAP + w(ui, s, &small));
let room = (avail - mark_w).max(0.0);
let name = ui
.horizontal(|ui| {
let (r, _) = ui.allocate_exact_size(vec2(CARD_BADGE, CARD_BADGE), Sense::hover());
self.paint(ui, r, 4);
let name = ui
.allocate_ui_with_layout(
vec2(room, CARD_BADGE),
Layout::left_to_right(Align::Center),
|ui| {
ui.add(
egui::Label::new(
RichText::new(&self.title).font(theme::semibold(12.5)),
)
.truncate(),
)
},
)
.inner;
ui.spacing_mut().item_spacing.x = MARK_GAP;
let (r, _) = ui.allocate_exact_size(vec2(8.0, 8.0), Sense::hover());
let pulse = (since_update < 2.0) as u8 as f32;
let color = if live { p.positive } else { p.faint };
ui.painter().circle_filled(r.center(), 4.0 + pulse, color);
ui.label(RichText::new(status).font(font));
for t in event.into_iter().chain(seal) {
ui.label(RichText::new(t).font(small.clone()).color(p.muted));
}
name
})
.inner;
Drawn {
name,
event: event.is_some(),
}
}
}
/// The folded card's words after "Live" in its heading.
struct After {
event: String,
seal: Option<&'static str>,
}
/// What [`CardHead::row`] drew after the live word.
struct Drawn {
name: egui::Response,
event: bool,
}
/// The least room the card's heading leaves the name before the folded
/// card's event, then its seal, are left to the tooltip.
const NAME_MIN: f32 = 10.0;
/// The space between the live mark's parts.
const MARK_GAP: f32 = 4.0;
/// The status card: whether the books are live, their newest event, and
/// the integrity checks. Folded (a short window), one line, the checks
/// in its tooltip.
@@ -1744,22 +1832,13 @@ fn live_status(
.inner_margin(Margin::same(10))
.show(ui, |ui| {
ui.set_width(ui.available_width());
ui.horizontal(|ui| {
let (r, _) = ui.allocate_exact_size(vec2(8.0, 8.0), Sense::hover());
let pulse = (since_update < 2.0) as u8 as f32;
let color = if live { p.positive } else { p.faint };
ui.painter().circle_filled(r.center(), 4.0 + pulse, color);
ui.label(
RichText::new(if live { "Live" } else { "Snapshot" })
.font(theme::semibold(12.0)),
);
ui.label(
RichText::new(format!("· event {}", b.seq()))
.font(theme::regular(12.0))
.color(p.muted),
);
});
for (ok, text, tip) in checks(b) {
// The event ends the card's last line, the journal chain's.
for (i, (ok, text, tip)) in checks(b).into_iter().enumerate() {
let text = if i == 0 {
format!("{text} · event {}", b.seq())
} else {
text
};
let (glyph, color) = if ok {
(icon::SEAL_CHECK, p.muted)
} else {
@@ -1772,7 +1851,7 @@ fn live_status(
.color(color),
)
.on_hover_text(tip);
if text == "Journal chain verified" {
if i == 0 {
r.context_menu(|ui| {
crate::widgets::copy_item(ui, "Copy journal head", &b.head);
crate::widgets::copy_item(
@@ -1785,16 +1864,19 @@ fn live_status(
}
// The footer is laid out bottom up, so what is added last is
// the card's top: the heading, over what the card always said.
head.row(ui).on_hover_text(&head.title);
head.row(ui, since_update, live, None)
.name
.on_hover_text(&head.title);
});
}
/// The status card folded to its summary line ("● Live · event 559 ·
/// ✓ verified", or the check that failed), the three checks on hover
/// and the card's copy menu on a right click. The line is the fullest
/// of [`summaries`] that fits the card, so it is never cut off: a failed
/// check's name outranks the event and the word "Live" (review,
/// 2026-10-22: cut to "⊘ Datab…" it hid what failed).
/// The status card folded. Every check passing, it is its heading alone:
/// the badge, the name, and at the right "● Live · event 559 ✓", the
/// event and the seal given up (to the tooltip) only for the name's
/// least room. A check failed, a line under the heading names it, the
/// event at its end ([`summaries`]). The three checks are on hover and
/// the card's copy menu on a right click. A failed check's name outranks
/// the event (review, 2026-10-22: cut to "⊘ Datab…" it hid what failed).
fn folded_status(ui: &mut Ui, b: &Books, since_update: f64, live: bool, head: &CardHead) {
let p = pal(ui.ctx());
let checks = checks(b);
@@ -1809,28 +1891,26 @@ fn folded_status(ui: &mut Ui, b: &Books, since_update: f64, live: bool, head: &C
let room = ui.available_width() - 2.0 * 10.0 - 2.0;
let gap = 5.0;
let width = |s: &Summary| {
let w = |text: &str, font: egui::FontId| {
ui.fonts_mut(|f| f.layout_no_wrap(text.to_string(), font, p.text).size().x)
let w = |text: &str| {
ui.fonts_mut(|f| {
f.layout_no_wrap(text.to_string(), theme::regular(12.0), p.text)
.size()
.x
})
};
let mut x = 8.0 + gap + w(s.verdict(), theme::regular(12.0));
if s.status {
x += gap + w(status, theme::semibold(12.0));
}
let mut x = w(s.verdict());
if s.event {
x += gap + w(&event, theme::regular(12.0));
x += gap + w(&event);
}
x
};
let all = summaries(&failed);
let line = all
.iter()
.find(|s| width(s) <= room)
.unwrap_or_else(|| all.last().expect("a summary"));
let color = if failed.is_empty() {
p.muted
} else {
p.negative
};
let line = (!failed.is_empty()).then(|| {
all.iter()
.find(|s| width(s) <= room)
.unwrap_or_else(|| all.last().expect("a summary"))
});
let mut event_shown = false;
let card = Frame::new()
.fill(p.surface)
.stroke(Stroke::new(1.0, p.border))
@@ -1838,32 +1918,40 @@ fn folded_status(ui: &mut Ui, b: &Books, since_update: f64, live: bool, head: &C
.inner_margin(Margin::same(10))
.show(ui, |ui| {
ui.set_width(ui.available_width());
ui.horizontal(|ui| {
ui.spacing_mut().item_spacing.x = gap;
let (r, _) = ui.allocate_exact_size(vec2(8.0, 8.0), Sense::hover());
let pulse = (since_update < 2.0) as u8 as f32;
let dot = if live { p.positive } else { p.faint };
ui.painter().circle_filled(r.center(), 4.0 + pulse, dot);
if line.status {
ui.label(RichText::new(status).font(theme::semibold(12.0)));
}
if line.event {
ui.label(
RichText::new(&event)
.font(theme::regular(12.0))
.color(p.muted),
);
}
ui.label(
RichText::new(line.verdict())
.font(theme::regular(12.0))
.color(color),
);
});
if let Some(line) = line {
// As tall as the card's other lines (a label's row), not a
// button's.
ui.scope(|ui| {
ui.spacing_mut().interact_size.y = 0.0;
ui.horizontal(|ui| {
ui.spacing_mut().item_spacing.x = gap;
ui.label(
RichText::new(line.verdict())
.font(theme::regular(12.0))
.color(p.negative),
);
if line.event {
ui.label(
RichText::new(&event)
.font(theme::regular(12.0))
.color(p.muted),
);
}
});
});
event_shown = line.event;
}
// Bottom up, so last is the top: the heading. Its hover is the
// card's (below): the card is one target, whose tooltip begins
// with the name.
head.row(ui);
// The heading carries the event when the line does not (and
// the seal when there is no line: the line's words say it).
let after = After {
event: event.clone(),
seal: line.is_none().then_some(icon::SEAL_CHECK),
};
let drawn = head.row(ui, since_update, live, (!event_shown).then_some(&after));
event_shown |= drawn.event;
});
let resp = ui.interact(
card.response.rect,
@@ -1872,7 +1960,7 @@ fn folded_status(ui: &mut Ui, b: &Books, since_update: f64, live: bool, head: &C
);
resp.on_hover_ui(|ui| {
ui.label(RichText::new(&head.title).font(theme::semibold(12.0)));
if !(line.status && line.event) {
if !event_shown {
ui.label(
RichText::new(format!("{status} {event}"))
.font(theme::regular(11.5))
@@ -1898,70 +1986,42 @@ fn folded_status(ui: &mut Ui, b: &Books, since_update: f64, live: bool, head: &C
});
}
/// One way to say the folded card's line: whether it names the status
/// ("Live") and the event, and its verdict.
/// One way to say the folded card's failure line: whether it carries the
/// event, and its verdict.
#[derive(Clone, Debug, PartialEq)]
struct Summary {
status: bool,
event: bool,
verdict: String,
}
impl Summary {
/// The verdict as drawn: right after the dot it needs no "·".
fn verdict(&self) -> &str {
if self.status {
&self.verdict
} else {
self.verdict.trim_start_matches("· ")
}
&self.verdict
}
}
/// The folded card's lines, fullest first, given the checks that
/// `failed`. All passing, the event outranks the word "verified" (the
/// seal says it). A failure is named before anything else is kept: the
/// event goes first, then "Live" (the dot's colour says it), and only
/// then is the name shortened to a count. Whatever the line leaves out
/// its tooltip says.
/// The folded card's failure lines, fullest first, given the checks that
/// `failed`. A failure is named before anything else is kept: the event
/// goes first, and only then is the name shortened to a count. Whatever
/// the line leaves out its tooltip says. "Live" is never left out: it is
/// the heading's.
fn summaries(failed: &[&str]) -> Vec<Summary> {
let s = |status, event, verdict: String| Summary {
status,
event,
verdict,
let s = |event, verdict: String| Summary { event, verdict };
let named = format!("{} {}", icon::WARNING_CIRCLE, failed.join(", "));
let counted = match failed.len() {
1 => format!("{} check failed", icon::WARNING_CIRCLE),
n => format!("{} {n} checks failed", icon::WARNING_CIRCLE),
};
match failed {
[] => {
let full = format!("· {} verified", icon::SEAL_CHECK);
let seal = format!("· {}", icon::SEAL_CHECK);
vec![
s(true, true, full.clone()),
s(true, true, seal.clone()),
s(true, false, full),
s(true, false, seal.clone()),
s(false, false, seal),
]
}
names => {
let named = format!("· {} {}", icon::WARNING_CIRCLE, names.join(", "));
let counted = match names.len() {
1 => format!("· {} check failed", icon::WARNING_CIRCLE),
n => format!("· {} {n} checks failed", icon::WARNING_CIRCLE),
};
let short = match names.len() {
1 => format!("· {} failed", icon::WARNING_CIRCLE),
n => format!("· {} {n} failed", icon::WARNING_CIRCLE),
};
vec![
s(true, true, named.clone()),
s(true, false, named.clone()),
s(false, false, named),
s(true, false, counted.clone()),
s(false, false, counted),
s(false, false, short),
]
}
}
let short = match failed.len() {
1 => format!("{} failed", icon::WARNING_CIRCLE),
n => format!("{} {n} failed", icon::WARNING_CIRCLE),
};
vec![
s(true, named.clone()),
s(false, named),
s(false, counted),
s(false, short),
]
}
/// The integrity checks the sidebar shows: (ok, label, explanation).
@@ -2077,7 +2137,7 @@ mod tests {
fn a_folded_card_names_a_failure_before_keeping_anything_else() {
let lines = summaries(&["Database differs"]);
// Every line says it failed; the name goes only after the event
// and the word "Live" have.
// has.
assert!(
lines
.iter()
@@ -2087,23 +2147,9 @@ mod tests {
.iter()
.take_while(|l| l.verdict.contains("Database differs"))
.count();
assert_eq!(named, 3);
assert!(!lines[named - 1].status && !lines[named - 1].event);
assert_eq!(named, 2);
assert!(lines[0].event && !lines[named - 1].event);
assert!(lines[named..].iter().all(|l| l.verdict.contains("failed")));
// Passing, the line is never a failure's and keeps its seal.
let ok = summaries(&[]);
assert!(
ok.iter().all(|l| l.verdict.contains(icon::SEAL_CHECK)
&& !l.verdict.contains(icon::WARNING_CIRCLE))
);
assert_eq!(
ok[0],
Summary {
status: true,
event: true,
verdict: format!("· {} verified", icon::SEAL_CHECK),
}
);
assert!(
summaries(&["a", "b"])
.last()
+2 -3
View File
@@ -141,9 +141,8 @@ pub fn run(
.with_app_id("wanderbooks")
.with_inner_size([1440.0, 920.0])
// Small on purpose: tiling window managers hand out small slots
// regardless, and every screen lays itself out to fit. The
// height is the window's below the tab bar (tabs::BAR_H).
.with_min_inner_size([360.0, 400.0 + tabs::BAR_H]),
// regardless, and every screen lays itself out to fit.
.with_min_inner_size([360.0, 400.0]),
// The platform's place for app settings, never the books' folder
// (prefs.rs).
persistence_path: prefs::prepare(),
Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 43 KiB

@@ -1 +1 @@
58e68b1eeb0e1329
3c4f6342d0987b34
+37 -19
View File
@@ -373,8 +373,7 @@ fn grid(scale: f32) {
for side in [Pane::Sidebar, Pane::Rail] {
let mut h = f.harness(footer, Route::Projects, side.width(), 920.0, scale);
for px in (300..=920).step_by(20) {
// The tab bar takes BAR_H points of the window; D-78.
let pt = px as f32 / scale + BAR_H;
let pt = px as f32 / scale;
h.set_size(vec2(side.width(), pt));
h.run_steps(4);
let tag = format!("{footer:?} {side:?} {px}px @{scale}");
@@ -415,8 +414,7 @@ fn no_link_is_ever_under_the_footer_at_scale_2() {
fn at_1479x519_every_link_shows_unscrolled() {
let f = Fixture::new();
for footer in FOOTERS {
// The tab bar takes BAR_H points of the window; D-78.
let mut h = f.harness(footer, Route::Projects, 1479.0, 519.0 + BAR_H, 1.0);
let mut h = f.harness(footer, Route::Projects, 1479.0, 519.0, 1.0);
let (view, _, scrolls) = drawn(&h, Pane::Sidebar);
assert!(!scrolls, "{footer:?}: the links scroll");
for s in Section::ALL {
@@ -445,16 +443,19 @@ fn at_1479x519_every_link_shows_unscrolled() {
}
}
/// Folded, the card is one line that fits the card whole (never cut to
/// "Datab…"), naming the check that failed; hovered, it shows the three
/// checks.
/// Folded, the card is its heading alone, "Live · event N" at its right,
/// the seal after it, when every check passes; when one failed, a line
/// under the heading names it, whole (never cut to "Datab…"), the event
/// at its end. Either way it says Live or Snapshot and the event, and
/// hovered it shows the three checks.
#[test]
fn the_folded_card_shows_its_checks_on_hover() {
let f = Fixture::new();
for (footer, verdict, checks) in [
for (footer, verdict, word, checks) in [
(
Footer::Owners,
"verified",
"event 6",
"Live",
[
"Journal chain verified",
"Database matches journal",
@@ -463,8 +464,7 @@ fn the_folded_card_shows_its_checks_on_hover() {
),
(
Footer::Snapshot,
// Its line is "Snapshot · event 555 · (seal)": no room for
// "verified", which the seal says.
"event 6",
"Snapshot",
[
"Journal chain verified",
@@ -475,6 +475,7 @@ fn the_folded_card_shows_its_checks_on_hover() {
(
Footer::Differs,
"Database differs",
"Live",
[
"Journal chain verified",
"Database differs",
@@ -484,6 +485,7 @@ fn the_folded_card_shows_its_checks_on_hover() {
(
Footer::Unreadable,
"Database unreadable",
"Live",
[
"Journal chain verified",
"Database unreadable",
@@ -493,6 +495,7 @@ fn the_folded_card_shows_its_checks_on_hover() {
(
Footer::Damaged,
"2 files damaged",
"Live",
[
"Journal chain verified",
"Database matches journal",
@@ -517,10 +520,28 @@ fn the_folded_card_shows_its_checks_on_hover() {
);
let (_, footer_rect, _) = drawn(&h, Pane::Sidebar);
let line = h.get_by_label_contains(verdict);
let card = line.rect();
let card = h.get_by_label_contains(word).rect();
// The live word is in the heading, above the line when there
// is one; the event is on the line, or after the word.
assert!(line.rect().bottom() <= footer_rect.bottom(), "{tag}");
if verdict.starts_with("event") {
assert!(
(line.rect().center().y - card.center().y).abs() < 4.0,
"{tag}: the event is after the live word"
);
} else {
assert!(
line.rect().top() > card.bottom() - 4.0,
"{tag}: a line under the heading"
);
assert!(
h.query_all_by_label_contains("event ").count() >= 1,
"{tag}: the failure line ends with the event"
);
}
// Every piece of the line lies inside the card's margins: a
// piece cut off or running out would reach past them.
for piece in ["Live", "Snapshot", "event 5", verdict] {
for piece in [word, "event ", verdict] {
for n in h.query_all_by_label_contains(piece) {
let r = n.rect();
if r.left() < Pane::Sidebar.panel() && r.top() >= footer_rect.top() {
@@ -549,8 +570,7 @@ fn the_rail_at_519_shows_every_link_unscrolled() {
let f = Fixture::new();
for footer in FOOTERS {
for route in [Route::Projects, Route::Overview, Route::Journal] {
// The tab bar takes BAR_H points of the window; D-78.
let h = f.harness(footer, route.clone(), 900.0, 519.0 + BAR_H, 1.0);
let h = f.harness(footer, route.clone(), 900.0, 519.0, 1.0);
let tag = format!("{footer:?} {route:?}");
let (view, _, scrolls) = drawn(&h, Pane::Rail);
assert!(!scrolls, "{tag}: the rail's links scroll");
@@ -642,9 +662,7 @@ fn going_somewhere_scrolls_its_link_into_view() {
#[test]
fn a_tall_sidebar_is_unchanged() {
let f = Fixture::new();
// The tab bar takes BAR_H points of the window, and the sidebar is
// what is below it; D-78.
let mut h = f.harness(Footer::Owners, Route::Overview, 1440.0, 920.0 + BAR_H, 1.0);
let mut h = f.harness(Footer::Owners, Route::Overview, 1440.0, 920.0, 1.0);
let dir = Path::new(env!("CARGO_MANIFEST_DIR")).join("tests/goldens");
let shapes = sidebar_shapes(&h);
let bless = std::env::var("SIDENAV_BLESS").is_ok();
@@ -763,7 +781,7 @@ fn sidenav_screenshots() {
}
// The folded card's tooltip.
let mut h = f.harness(Footer::Owners, Route::Projects, 1479.0, 519.0, 1.0);
if let Some(n) = h.query_by_label_contains("event 5") {
if let Some(n) = h.query_by_label_contains("event ") {
let c = n.rect().center();
h.hover_at(c);
h.run_steps(30);
Binary file not shown.

Before

Width:  |  Height:  |  Size: 90 KiB

After

Width:  |  Height:  |  Size: 90 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 93 KiB

After

Width:  |  Height:  |  Size: 94 KiB

+38
View File
@@ -1536,6 +1536,35 @@ fn the_status_card_shows_the_company_in_front_and_follows_the_tab() {
.collect::<Vec<_>>()
};
assert_eq!(card_names(&h), ["Alpha Co"], "dark {dark}");
// The heading carries the live word, at the name's row; the event
// ends the journal chain line, the card's last, and no row of its
// own is left.
let card_texts = |h: &Harness<'_, App>| -> Vec<(egui::Pos2, String)> {
placed(h)
.into_iter()
.filter(|(at, _)| at.x < 224.0 && at.y > 120.0)
.collect()
};
let texts_now = card_texts(&h);
let name_y = texts_now.iter().find(|(_, t)| t == "Alpha Co").unwrap().0.y;
let live = texts_now
.iter()
.find(|(_, t)| t == "Live" || t == "Snapshot")
.expect("the live word is on the card");
assert!(
(live.0.y - name_y).abs() < 6.0,
"the live word is in the heading"
);
assert!(
texts_now
.iter()
.any(|(_, t)| t.contains("Journal chain verified") && t.contains("· event ")),
"the event ends the journal chain line"
);
assert!(
!texts_now.iter().any(|(_, t)| t.starts_with("· event")),
"no row of its own for the event"
);
assert_eq!(
card_badge(&h, "alpha").len(),
1,
@@ -1590,6 +1619,15 @@ fn the_rail_shows_the_badge_alone_with_the_name_on_hover() {
h.hover_at(badge[0].center());
h.run_steps(30);
assert!(shows(&h, "Alpha Co"), "the name is on hover");
assert!(shows(&h, "· event "), "the event is on hover");
assert!(
shows(&h, "Live") || shows(&h, "Snapshot"),
"the state is on hover"
);
assert!(
shows(&h, "Journal chain verified"),
"the checks are on hover"
);
}
#[test]
+10 -5
View File
@@ -130,16 +130,21 @@ has no header, its first link sits under the bar (`top_slot` in
where the assistant's connection state is drawn later), and the Overview
opens with its summary sentence, not a heading with the name. The company
is named once more, at the opposite corner: the status card at the foot of
the sidebar begins with a heading row, the badge (small) and the name, cut
with an ellipsis and whole on hover, over the lines it always had; the
rail shows the badge alone, its name on hover. Each company has one badge
the sidebar begins with a heading row: the badge (small) and the name, cut
with an ellipsis and whole on hover, and at the right the live dot and
"Live" (or "Snapshot"). The journal chain line, the card's last, ends with
"· event N"; there is no row of its own for the state. Folded (a short
window) the card is the heading alone, "● Live · event N" (and the seal
when the name keeps room), or, when a check failed, the heading over one
line naming it. The rail shows the badge with the live dot on its corner
(a warning there when a check failed), the name, state, event and checks on
hover. Each company has one badge
hue of eight (`theme::BADGE_HUES`, light and dark), chosen by a stable
hash of the id of its books (`theme::hue_index`, FNV-1a modulo eight: a
function of the id alone, so a company keeps its colour on every machine
and after a rename); its tab and its card draw the same one, and the
active tab's accent line stays the theme's. The bar's height (`tabs::BAR_H`) is taken from the
window, so the smallest window the viewer allows is the 400 points below
the bar plus the bar. A tab is the company's badge and name, as wide as
window; the viewer's smallest window is 400 points high, as before the bar. A tab is the company's badge and name, as wide as
that between a least and a greatest width; the "+" follows the last tab
and stays at the right edge, the tabs scrolling, when they overflow. The
app remembers each company's name when its books load (`company.<root>.<id>.name`
+15 -22
View File
@@ -4417,16 +4417,10 @@ in `company.rs`; the scheme tests, in `scheme_menu.rs`. The tab bar runs
across the top of the window *above* the sidebar (D-78): a tab is the
top level, and the layout shows that the sidebar belongs to the company in
it. The bar takes `tabs::BAR_H` (36 points) of the window's height, which
the sidebar had to spare nowhere at the owner's 519 points. So the four
`sidenav.rs` tests that size a window for the sidebar add `BAR_H` to their
window heights, through the constant the bar uses (`at_1479x519_…`,
`the_rail_at_519_…`, the grid's heights in `grid`, and
`a_tall_sidebar_is_unchanged` at 920), each with a comment, and no
assertion in them changed; the viewer's smallest window is 400 points plus
`BAR_H` (`lib.rs`). The last one's pixel golden is untouched: the sidebar
below the bar, cropped from `BAR_H` down, is pixel for pixel the old
image; its shapes hash was recomputed, because the shapes now sit `BAR_H`
lower, and covers only the shapes clipped below the bar. In `tabs.rs`, the
the sidebar had to spare nowhere at the owner's 519 points. The status
card gave the height back (see "The sidebar tests' window sizes are
restored" below); the golden's crop and shapes hash cover only what is below
the bar. In `tabs.rs`, the
three tests that click a closed company in the "+" list by its id now click
it by its name, which the list shows once the company has been open; the
list's empty words are now "Every company is already open." The ten
@@ -4544,18 +4538,17 @@ shown to fail: `preferences_written_before_the_keys_had_a_root_are_read_and_not_
`books_outside_any_data_root_are_kept_under_their_folder`, whose second
folder is also told apart by its books' identity.
**The sidebar tests' window sizes were not restored.** With the `+ BAR_H`
taken off the four `sidenav.rs` sites the sidebar has 36 points less than
the owner's 519 gave it before the bar, and three of the four fail at the
original size: `at_1479x519_every_link_shows_unscrolled` (the links scroll;
the window must be 534 high for them not to, 15 points short),
`the_rail_at_519_shows_every_link_unscrolled` (the rail must be 530, 11
short) and the grid test at 520 px (`no_link_is_ever_under_the_footer_at_scale_1`:
the same 15 points); `a_tall_sidebar_is_unchanged` fails its shapes hash,
which the shorter sidebar changes, as expected. The tests were left as they
are, the minimum window height (`lib.rs`) and the goldens untouched, and
the 15 (sidebar) and 11 (rail) points are the owner's to decide: take them
from the sidebar's rows or keep the bar's 36 points in the window sizes.
**The sidebar tests' window sizes are restored.** The status card gave back
the bar's height by one row: its heading carries the live dot and word
("Live", "Snapshot") and the old last row is gone, the event moving to the
end of the journal chain line (folded: after the live word in the heading,
or at the end of the failure line). The four `sidenav.rs` tests are at their
original sizes (1479x519, the rail at 519, the grid at 520 px, the tall
sidebar at 1440x920) with every assertion unchanged, and the minimum window
height is 400 again. The failing-check folded line is a label's row high,
like the card's other lines, not a button's; nothing else was tightened.
`the_folded_card_shows_its_checks_on_hover` and the two card tests in
`tabs.rs` assert where the live word and the event sit in each state.
## P12: the checklists