Move pending labels beside row controls
This commit is contained in:
parent
94a5caa30b
commit
c0716e80e1
|
|
@ -1847,17 +1847,13 @@ impl App {
|
|||
.max(ui.spacing().interact_size.y + pending_height);
|
||||
let response = ui.vertical(|ui| {
|
||||
ui.set_min_height(row_height);
|
||||
let response = ui.add(
|
||||
ui.add(
|
||||
egui::Label::new(RichText::new(format!("{}{}",
|
||||
if row.row == 0 { "Gap".into() } else { row.row.to_string() },
|
||||
if modified || pending { " ✎" } else { "" }
|
||||
)).color(color))
|
||||
.sense(egui::Sense::click()),
|
||||
);
|
||||
if pending {
|
||||
ui.colored_label(PREVIEW_PENDING, "Pending apply");
|
||||
}
|
||||
response
|
||||
)
|
||||
}).inner;
|
||||
let response = if pending {
|
||||
response.on_hover_text(
|
||||
|
|
@ -1988,24 +1984,27 @@ impl App {
|
|||
ui.set_min_height(row_height);
|
||||
if let Some(key) = &row.gap_key {
|
||||
Self::gap_resolution_control(ui, &mut profile, key);
|
||||
return;
|
||||
} else {
|
||||
ui.push_id(("schedule_kind", row.row), |ui| {
|
||||
let detected = if self.dirty {
|
||||
None
|
||||
} else if ignored {
|
||||
Some("Ignore")
|
||||
} else {
|
||||
match row.kind.as_str() {
|
||||
"event" => Some("Event"),
|
||||
"marker" => Some("Marker"),
|
||||
kind if kind.starts_with("Gap") => Some("Gap"),
|
||||
kind if kind.starts_with("Note") => Some("Note"),
|
||||
_ => None,
|
||||
}
|
||||
};
|
||||
Self::row_kind_control(ui, &mut profile, row.row, detected)
|
||||
});
|
||||
}
|
||||
if pending {
|
||||
ui.label(RichText::new("Pending apply").small().color(PREVIEW_PENDING));
|
||||
}
|
||||
ui.push_id(("schedule_kind", row.row), |ui| {
|
||||
let detected = if self.dirty {
|
||||
None
|
||||
} else if ignored {
|
||||
Some("Ignore")
|
||||
} else {
|
||||
match row.kind.as_str() {
|
||||
"event" => Some("Event"),
|
||||
"marker" => Some("Marker"),
|
||||
kind if kind.starts_with("Gap") => Some("Gap"),
|
||||
kind if kind.starts_with("Note") => Some("Note"),
|
||||
_ => None,
|
||||
}
|
||||
};
|
||||
Self::row_kind_control(ui, &mut profile, row.row, detected)
|
||||
});
|
||||
});
|
||||
ui.end_row();
|
||||
let row_rect = egui::Rect::from_min_max(row_top,
|
||||
|
|
@ -2286,7 +2285,13 @@ mod tests {
|
|||
.iter()
|
||||
.any(|(text, _)| text == "Pending schedule changes")
|
||||
);
|
||||
assert!(labels.iter().any(|(text, _)| text == "Pending apply"));
|
||||
let pending = labels
|
||||
.iter()
|
||||
.find(|(text, _)| text == "Pending apply")
|
||||
.unwrap()
|
||||
.1;
|
||||
let gap_row = labels.iter().find(|(text, _)| text == "Gap ✎").unwrap().1;
|
||||
assert!(pending.left() > gap_row.right());
|
||||
let a = pipeline::analyze(&app.tables[0], &profile, &AtomicBool::new(false), |_, _| {});
|
||||
assert!(a.rundown.as_ref().unwrap().gaps.is_empty());
|
||||
let rows = preview_rows(&a, Some(&app.tables[0]));
|
||||
|
|
@ -2943,7 +2948,6 @@ mod tests {
|
|||
.iter()
|
||||
.any(|(text, _)| text == "Pending schedule changes")
|
||||
);
|
||||
assert!(labels.iter().any(|(text, _)| text == "Pending apply"));
|
||||
assert!(labels.iter().any(|(text, _)| {
|
||||
text == "Pending apply · this correction is not reflected in the timing or issues yet"
|
||||
}));
|
||||
|
|
@ -2964,6 +2968,13 @@ mod tests {
|
|||
vec![egui::Event::PointerMoved(egui::pos2(0.0, 0.0))],
|
||||
);
|
||||
let labels = render(&mut app, &ctx, size, vec![]);
|
||||
let pending = labels
|
||||
.iter()
|
||||
.find(|(text, _)| text == "Pending apply")
|
||||
.unwrap()
|
||||
.1;
|
||||
let row_number = labels.iter().find(|(text, _)| text == "2 ✎").unwrap().1;
|
||||
assert!(pending.left() > row_number.right());
|
||||
let edit = labels
|
||||
.iter()
|
||||
.find(|(s, _)| s == "Edit row…")
|
||||
|
|
|
|||
Loading…
Reference in New Issue