fix: pr body scrolling
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
use gpui::{AppContext, IntoElement, ParentElement, Styled, div, prelude::FluentBuilder};
|
||||
use gpui::{
|
||||
AppContext, InteractiveElement, IntoElement, ParentElement, StatefulInteractiveElement, Styled,
|
||||
div, prelude::FluentBuilder,
|
||||
};
|
||||
|
||||
use crate::{
|
||||
api::{self, issues::PullRequest},
|
||||
api::{self},
|
||||
app,
|
||||
component::{
|
||||
font_icon::{FontIcon, font_icon},
|
||||
@@ -57,7 +60,7 @@ impl PullRequestView {
|
||||
&self,
|
||||
pr: &api::issues::DetailedPullRequest,
|
||||
cx: &gpui::Context<Self>,
|
||||
) -> gpui::Div {
|
||||
) -> gpui::AnyElement {
|
||||
let theme = app::current_theme(cx);
|
||||
|
||||
let mut status_pill = div()
|
||||
@@ -121,6 +124,7 @@ impl PullRequestView {
|
||||
.size_full()
|
||||
.flex()
|
||||
.flex_col()
|
||||
.overflow_hidden()
|
||||
.child(
|
||||
div()
|
||||
.w_full()
|
||||
@@ -131,26 +135,40 @@ impl PullRequestView {
|
||||
.child(text(pr.title.clone()).w_full().text_xl().mb_2())
|
||||
.child(row),
|
||||
)
|
||||
.when_some(self.markdown_viewer.as_ref(), |it, viewer| {
|
||||
it.child(div().h_full().p_3p5().child(viewer.clone()))
|
||||
})
|
||||
.child(
|
||||
div().flex_1().min_h_0().w_full().child(
|
||||
div()
|
||||
.id("pr-body-content")
|
||||
.size_full()
|
||||
.overflow_y_scroll()
|
||||
.when_some(self.markdown_viewer.as_ref(), |it, viewer| {
|
||||
it.child(div().w_full().p_3p5().child(viewer.clone()))
|
||||
}),
|
||||
),
|
||||
)
|
||||
.into_any_element()
|
||||
}
|
||||
}
|
||||
|
||||
impl gpui::Render for PullRequestView {
|
||||
fn render(
|
||||
&mut self,
|
||||
window: &mut gpui::Window,
|
||||
_window: &mut gpui::Window,
|
||||
cx: &mut gpui::Context<Self>,
|
||||
) -> impl gpui::IntoElement {
|
||||
match &self.pull_request_query {
|
||||
div().size_full().child(match &self.pull_request_query {
|
||||
| Some(q) => match read_query(q, cx) {
|
||||
| QueryStatus::Loaded(pr) => self.pr_content(pr, cx),
|
||||
| QueryStatus::Err(e) => div().child(format!("{:?}", e)),
|
||||
| QueryStatus::Loading => div().child("loading pr content"),
|
||||
| QueryStatus::Err(e) => div()
|
||||
.size_full()
|
||||
.child(format!("{:?}", e))
|
||||
.into_any_element(),
|
||||
| QueryStatus::Loading => div()
|
||||
.size_full()
|
||||
.child("loading pr content")
|
||||
.into_any_element(),
|
||||
},
|
||||
|
||||
| None => div().child("no pr selected"),
|
||||
}
|
||||
| None => div().size_full().child("no pr selected").into_any_element(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,8 +66,7 @@ impl Screen {
|
||||
fn handle_issue_list_item_selected(
|
||||
&mut self,
|
||||
id: &api::issues::Id,
|
||||
cx: &mut gpui::Context<Self>,
|
||||
) {
|
||||
cx: &mut gpui::Context<Self>, ) {
|
||||
println!("handle issue list item selected: {:?}", id);
|
||||
self.pull_request_view.update(cx, |view, cx| {
|
||||
view.change_displayed_pull_request(id.clone(), cx);
|
||||
@@ -95,6 +94,7 @@ impl gpui::Render for Screen {
|
||||
.flex()
|
||||
.flex_row()
|
||||
.flex_1()
|
||||
.min_h_0()
|
||||
.w_full()
|
||||
.child(
|
||||
div()
|
||||
@@ -119,7 +119,9 @@ impl gpui::Render for Screen {
|
||||
div()
|
||||
.flex_1()
|
||||
.min_w_0()
|
||||
.min_h_0()
|
||||
.h_full()
|
||||
.overflow_hidden()
|
||||
.bg(theme.colors.surface)
|
||||
.border_l_1()
|
||||
.border_color(theme.colors.border)
|
||||
|
||||
Reference in New Issue
Block a user