wip: pr file diffing

This commit is contained in:
2026-05-18 22:30:46 +08:00
parent aa99ba2596
commit 553af0290f
32 changed files with 1523 additions and 164 deletions

View File

@@ -13,10 +13,12 @@ use crate::{
text::text,
},
query::{self, QueryStatus, read_query, use_query},
screen::dashboard::pull_request_diff_view::PullRequestDiffView,
};
pub(crate) struct PullRequestView {
markdown_viewer: Option<gpui::Entity<MarkdownText>>,
diff_view: Option<gpui::Entity<PullRequestDiffView>>,
pull_request_query: Option<query::Entity<api::issues::FetchPullRequest>>,
}
@@ -27,6 +29,7 @@ struct Toolbar {}
pub fn new(_cx: &mut gpui::Context<PullRequestView>) -> PullRequestView {
PullRequestView {
markdown_viewer: None,
diff_view: None,
pull_request_query: None,
}
}
@@ -126,12 +129,9 @@ impl PullRequestView {
}
}
let merge_text = match (
pr.author.as_ref(),
pr.base_branch_name.as_ref(),
pr.head_branch_name.as_ref(),
) {
| (Some(author), Some(base_branch), Some(head_branch)) => {
let merge_text = pr.author.as_ref().map(|author| {
let base_branch = pr.base_branch_name.as_str();
let head_branch = pr.head_branch_name.as_str();
let str = format!(
"{} requested to merge {} into {}",
author.login, head_branch, base_branch
@@ -166,14 +166,11 @@ impl PullRequestView {
),
];
Some((
(
author,
gpui::StyledText::new(str).with_highlights(highlights),
))
}
| _ => None,
};
)
});
let metadata_line =
div()