T24c: Agent, changes
- FileChangeCard: a proposed change to one file, its path and counts, Reject and Accept in a slot that keeps presses off the header; opened, the diff through a headless git::DiffViewer with its folds opening - MultiFileDiffReview: every file at once, the total counts, how many are reviewed, Reject all and Accept all; verdicts as collab::Decision - git::DiffViewer gains headless, leaving the file's header to its owner - CommandExecutionCard is terminal::CommandBlock - gallery: three proposed files and a command's block
This commit is contained in:
1 parent
859a9051d8
commit
0a44a2d905
9 files changed
+591
-26
No files matched your search
+30
-20
@@ -78,6 +78,7 @@ pub struct DiffViewer {
|
||||
open: Vec<usize>,
|
||||
on_open: Option<OnIndex>,
|
||||
on_layout: Option<OnLayout>,
|
||||
headless: bool,
|
||||
}
|
||||
|
||||
impl DiffViewer {
|
||||
@@ -96,9 +97,16 @@ impl DiffViewer {
|
||||
open: Vec::new(),
|
||||
on_open: None,
|
||||
on_layout: None,
|
||||
headless: false,
|
||||
}
|
||||
}
|
||||
|
||||
/// Leaves the file's header, its path, counts and layout, to the owner, as a change card draws it.
|
||||
pub fn headless(mut self) -> Self {
|
||||
self.headless = true;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn layout(mut self, layout: DiffLayout) -> Self {
|
||||
self.layout = layout;
|
||||
self
|
||||
@@ -308,26 +316,28 @@ impl RenderOnce for DiffViewer {
|
||||
.flex()
|
||||
.flex_col()
|
||||
.text_size(theme.text_size(TextSize::Sm))
|
||||
.child(
|
||||
div()
|
||||
.flex()
|
||||
.items_center()
|
||||
.gap_3()
|
||||
.px_2()
|
||||
.py_1p5()
|
||||
.border_b_1()
|
||||
.border_color(colors.border)
|
||||
.child(
|
||||
div()
|
||||
.flex_1()
|
||||
.min_w_0()
|
||||
.font_weight(FontWeight::MEDIUM)
|
||||
.text_color(colors.fg)
|
||||
.child(self.path),
|
||||
)
|
||||
.child(DiffStat::new(self.stat.0, self.stat.1))
|
||||
.child(layout),
|
||||
)
|
||||
.when(!self.headless, |view| {
|
||||
view.child(
|
||||
div()
|
||||
.flex()
|
||||
.items_center()
|
||||
.gap_3()
|
||||
.px_2()
|
||||
.py_1p5()
|
||||
.border_b_1()
|
||||
.border_color(colors.border)
|
||||
.child(
|
||||
div()
|
||||
.flex_1()
|
||||
.min_w_0()
|
||||
.font_weight(FontWeight::MEDIUM)
|
||||
.text_color(colors.fg)
|
||||
.child(self.path),
|
||||
)
|
||||
.child(DiffStat::new(self.stat.0, self.stat.1))
|
||||
.child(layout),
|
||||
)
|
||||
})
|
||||
.child(
|
||||
div()
|
||||
.flex_1()
|
||||
|
||||
Reference in new issue
Block a user