feat: sort and filter pull requests by review state

This commit is contained in:
Valdemar Lorenzen
2026-10-21 12:41:17 +02:00
parent 5c08aa0a67
commit 37b47ebc8a
7 changed files with 206 additions and 7 deletions
+17 -6
View File
@@ -3397,6 +3397,7 @@ fn draw_diff(
.and_then(|catalog| catalog.notice.as_deref())
}
});
let stacked_review_controls = pull_requests && content.width < 68 && content.height >= 8;
let [
stage_area,
tabs_area,
@@ -3406,7 +3407,11 @@ fn draw_diff(
results,
help,
] = Layout::vertical([
Constraint::Length(u16::from(content.height >= 5)),
Constraint::Length(if stacked_review_controls {
2
} else {
u16::from(content.height >= 5)
}),
Constraint::Length(u16::from(content.height >= 4)),
Constraint::Length(1),
Constraint::Length(u16::from(notice.is_some() && content.height >= 3)),
@@ -3420,11 +3425,15 @@ fn draw_diff(
.as_ref()
.map_or("not selected", |revision| revision.label.as_str());
let stage_text = if pull_requests {
if diff.pull_request_partial() {
"Partial search · Select a loaded pull request".into()
} else {
"Select a pull request to compare its branch changes".into()
}
let sort = match diff.pull_request_priority {
crate::diff::PullRequestReviewScope::All => "Newest".into(),
scope => format!("{} first", scope.label()),
};
format!(
"Review: {} · Ctrl+f{}Sort: {sort} · Ctrl+s",
diff.pull_request_filter.label(),
if stacked_review_controls { "\n" } else { " " },
)
} else {
format!(
"{} · Ctrl+b toggle · Before: {}",
@@ -3522,6 +3531,8 @@ fn draw_diff(
diff.category,
&diff.query,
diff.comparison_mode as u8,
diff.pull_request_filter,
diff.pull_request_priority,
diff.catalog
.as_ref()
.map(|catalog| (catalog.entries.as_ptr(), catalog.entries.len())),