review: say why a read-only signature field can't be signed

This commit is contained in:
Dylan M. Taylor committed 2026-11-08 20:58:46 -05:00
1 parent 343c0f92ad
commit 2fc0a8b6ba
1 file changed
+14 -2
+14 -2
View File
@@ -120,8 +120,20 @@ pub(crate) fn panel(ui: &mut egui::Ui, t: &Tokens, sigs: &[SignatureInfo], expan
egui::Frame::NONE.inner_margin(egui::Margin { left: 44, right: 4, top: 2, bottom: 8 }).show(ui, |ui| {
ui.spacing_mut().item_spacing.y = 3.0;
if !s.signed {
// The writer refuses a read-only field, so the panel does not offer to sign it.
if !s.read_only && widgets::pill_button(ui, tl!("Sign this field…"), true).clicked() {
// The writer refuses a read-only field, so the panel does not offer to sign it,
// and says why instead of showing an empty expansion.
if s.read_only {
ui.add(
egui::Label::new(
egui::RichText::new(tl!("This field is read-only, so it can't be signed."))
.font(theme::regular(11.5))
.color(t.text_muted),
)
.wrap(),
);
return;
}
if widgets::pill_button(ui, tl!("Sign this field…"), true).clicked() {
action = Some(PanelAction::Sign(s.field.clone()));
}
return;