fix(gui): recent activity rows clip before the timestamp column; SHOT_HEIGHT for tall screenshots
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MtYEaR6M6Ybdhm6X98BWNu
This commit is contained in:
2 files changed
+52
-34
No files matched your search
@@ -433,39 +433,51 @@ fn recent(ui: &mut Ui, b: &Books, shell: &mut Shell<'_>) {
|
|||||||
}
|
}
|
||||||
shown += 1;
|
shown += 1;
|
||||||
let fresh = line.seq > b.fresh_from_seq && since_update < 8.0;
|
let fresh = line.seq > b.fresh_from_seq && since_update < 8.0;
|
||||||
let row = egui::Frame::new()
|
// One painted row: icon, the event (cut with an ellipsis
|
||||||
.fill(if fresh {
|
// before the timestamp column), the timestamp.
|
||||||
p.new_highlight
|
let (r, resp) = ui.allocate_exact_size(
|
||||||
} else {
|
egui::vec2(ui.available_width(), 30.0),
|
||||||
egui::Color32::TRANSPARENT
|
egui::Sense::click(),
|
||||||
})
|
);
|
||||||
.corner_radius(egui::CornerRadius::same(6))
|
if fresh {
|
||||||
.inner_margin(egui::Margin::symmetric(6, 3))
|
ui.painter()
|
||||||
.show(ui, |ui| {
|
.rect_filled(r, egui::CornerRadius::same(6), p.new_highlight);
|
||||||
ui.set_width(ui.available_width());
|
} else if resp.hovered() {
|
||||||
ui.horizontal(|ui| {
|
ui.painter()
|
||||||
ui.label(RichText::new(ev.icon).size(15.0).color(p.muted));
|
.rect_filled(r, egui::CornerRadius::same(6), p.hover);
|
||||||
let r = widgets::link(
|
}
|
||||||
ui,
|
if resp.hovered() {
|
||||||
RichText::new(&ev.text).font(theme::regular(13.0)),
|
ui.ctx().set_cursor_icon(egui::CursorIcon::PointingHand);
|
||||||
);
|
}
|
||||||
if r.clicked() {
|
let painter = ui.painter_at(r);
|
||||||
go =
|
let y = r.center().y;
|
||||||
Some(ev.route.clone().unwrap_or(Route::JournalEvent(line.seq)));
|
painter.text(
|
||||||
}
|
egui::pos2(r.left() + 8.0, y),
|
||||||
ui.with_layout(
|
egui::Align2::LEFT_CENTER,
|
||||||
egui::Layout::right_to_left(egui::Align::Center),
|
ev.icon,
|
||||||
|ui| {
|
egui::FontId::proportional(15.0),
|
||||||
ui.label(
|
p.muted,
|
||||||
RichText::new(fmt::timestamp(&line.ts))
|
);
|
||||||
.font(theme::regular(11.5))
|
let ts =
|
||||||
.color(p.faint),
|
painter.layout_no_wrap(fmt::timestamp(&line.ts), theme::regular(11.5), p.faint);
|
||||||
);
|
let ts_w = ts.size().x;
|
||||||
},
|
painter.galley(
|
||||||
);
|
egui::pos2(r.right() - 8.0 - ts_w, y - ts.size().y / 2.0),
|
||||||
});
|
ts,
|
||||||
});
|
p.faint,
|
||||||
let _ = (row, i);
|
);
|
||||||
|
widgets::clipped_text(
|
||||||
|
&painter,
|
||||||
|
egui::pos2(r.left() + 32.0, y),
|
||||||
|
&ev.text,
|
||||||
|
theme::regular(13.0),
|
||||||
|
p.text,
|
||||||
|
r.width() - 32.0 - ts_w - 28.0,
|
||||||
|
);
|
||||||
|
if resp.clicked() {
|
||||||
|
go = Some(ev.route.clone().unwrap_or(Route::JournalEvent(line.seq)));
|
||||||
|
}
|
||||||
|
let _ = i;
|
||||||
}
|
}
|
||||||
if shown == 0 {
|
if shown == 0 {
|
||||||
widgets::empty(ui, icon::CLOCK, "Nothing yet", "");
|
widgets::empty(ui, icon::CLOCK, "Nothing yet", "");
|
||||||
|
|||||||
@@ -76,7 +76,13 @@ fn screenshots() {
|
|||||||
}
|
}
|
||||||
let books = data::load_once(&source).unwrap();
|
let books = data::load_once(&source).unwrap();
|
||||||
let mut harness = Harness::builder()
|
let mut harness = Harness::builder()
|
||||||
.with_size(egui::vec2(1440.0, 920.0))
|
.with_size(egui::vec2(
|
||||||
|
1440.0,
|
||||||
|
std::env::var("SHOT_HEIGHT")
|
||||||
|
.ok()
|
||||||
|
.and_then(|h| h.parse().ok())
|
||||||
|
.unwrap_or(920.0),
|
||||||
|
))
|
||||||
.build_eframe(|cc| App::with_books(&cc.egui_ctx, books, dark, route.clone()));
|
.build_eframe(|cc| App::with_books(&cc.egui_ctx, books, dark, route.clone()));
|
||||||
harness.run_steps(4);
|
harness.run_steps(4);
|
||||||
let ctx = harness.ctx.clone();
|
let ctx = harness.ctx.clone();
|
||||||
|
|||||||
Reference in new issue
Block a user