feat: change background color

This commit is contained in:
2026-05-28 21:08:51 +01:00
parent f8a1c3f42b
commit 75c3b73665
4 changed files with 86 additions and 87 deletions

View File

@@ -122,8 +122,8 @@ impl PullRequestDiffView {
) { ) {
if let Some(diff) = { if let Some(diff) = {
match read_query(query, cx) { match read_query(query, cx) {
| QueryStatus::Loaded(diff) => Some(Arc::clone(diff)), | QueryStatus::Loaded(diff) => Some(Arc::clone(diff)),
| _ => None, | _ => None,
} }
} { } {
self.load_diff_view(diff, cx); self.load_diff_view(diff, cx);
@@ -158,16 +158,16 @@ impl PullRequestDiffView {
_ = cx _ = cx
.spawn(async move |weak, cx| match tokio::join!(t1, t2) { .spawn(async move |weak, cx| match tokio::join!(t1, t2) {
| (Some(old_side_highlights), Some(new_side_highlights)) => { | (Some(old_side_highlights), Some(new_side_highlights)) => {
_ = weak.update(cx, |this, cx| { _ = weak.update(cx, |this, cx| {
this.diff_view_state this.diff_view_state
.set_old_side_highlights(old_side_highlights); .set_old_side_highlights(old_side_highlights);
this.diff_view_state this.diff_view_state
.set_new_side_highlights(new_side_highlights); .set_new_side_highlights(new_side_highlights);
cx.notify(); cx.notify();
}); });
} }
| _ => {} | _ => {}
}) })
.detach(); .detach();
} }
@@ -189,30 +189,31 @@ impl gpui::Render for PullRequestDiffView {
.unwrap_or(QueryStatus::Loading); .unwrap_or(QueryStatus::Loading);
match content_diff { match content_diff {
| QueryStatus::Err(_) | QueryStatus::Loading => div() | QueryStatus::Err(_) | QueryStatus::Loading => div()
.size_full() .size_full()
.bg(theme.colors.surface) .bg(theme.colors.surface)
.p_4() .p_4()
.child(text("asd")), .child(text("asd")),
| QueryStatus::Loaded(_) => match &self.diff_view_content { | QueryStatus::Loaded(_) => match &self.diff_view_content {
| Some(content) => div() | Some(content) => div()
.size_full() .size_full()
.flex()
.flex_row()
.child(
div()
.flex() .flex()
.w_80() .flex_row()
.h_full() .child(
.border_r_1() div()
.border_color(theme.colors.border_muted) .flex()
.p_1() .w_80()
.child(self.file_tree.clone()), .h_full()
) .bg(theme.colors.surface_chrome)
.child(diff_view(self.diff_view_state.clone(), content.clone())), .border_r_1()
| None => div(), .border_color(theme.colors.border_muted)
}, .p_1()
.child(self.file_tree.clone()),
)
.child(diff_view(self.diff_view_state.clone(), content.clone())),
| None => div(),
},
} }
} }
} }

View File

@@ -128,7 +128,7 @@ impl PullRequestView {
.items_center() .items_center()
.justify_start() .justify_start()
.p_1() .p_1()
.bg(theme.colors.surface) .bg(theme.colors.surface_chrome)
.border_b_1() .border_b_1()
.border_color(theme.colors.border_muted) .border_color(theme.colors.border_muted)
.child( .child(
@@ -181,41 +181,41 @@ impl PullRequestView {
.rounded_full(); .rounded_full();
match pr.state { match pr.state {
| api::issues::PullRequestState::Open => { | api::issues::PullRequestState::Open => {
status_pill = status_pill status_pill = status_pill
.bg(theme.colors.success_solid) .bg(theme.colors.success_solid)
.child( .child(
font_icon(FontIcon::PullRequestArrow) font_icon(FontIcon::PullRequestArrow)
.size_3() .size_3()
.text_color(theme.colors.success_on_solid), .text_color(theme.colors.success_on_solid),
) )
.child( .child(
text("Open") text("Open")
.text_color(theme.colors.success_on_solid) .text_color(theme.colors.success_on_solid)
.text_xs(),
);
}
| api::issues::PullRequestState::Closed => {
status_pill = status_pill
.bg(theme.colors.danger_solid)
.child(
font_icon(FontIcon::PullRequestClosed)
.size_3()
.text_color(theme.colors.danger_on_solid),
)
.child(
text("Closed")
.text_color(theme.colors.danger_on_solid)
.text_xs(),
);
}
| api::issues::PullRequestState::Merged => {
status_pill = status_pill.bg(theme.colors.accent_solid).child(
text("Merged")
.text_color(theme.colors.accent_on_solid)
.text_xs(), .text_xs(),
); );
} }
| api::issues::PullRequestState::Closed => {
status_pill = status_pill
.bg(theme.colors.danger_solid)
.child(
font_icon(FontIcon::PullRequestClosed)
.size_3()
.text_color(theme.colors.danger_on_solid),
)
.child(
text("Closed")
.text_color(theme.colors.danger_on_solid)
.text_xs(),
);
}
| api::issues::PullRequestState::Merged => {
status_pill = status_pill.bg(theme.colors.accent_solid).child(
text("Merged")
.text_color(theme.colors.accent_on_solid)
.text_xs(),
);
}
} }
let merge_text = pr.author.as_ref().map(|author| { let merge_text = pr.author.as_ref().map(|author| {
@@ -354,25 +354,23 @@ impl gpui::Render for PullRequestView {
.flex_col() .flex_col()
.child(self.toolbar(cx)) .child(self.toolbar(cx))
.child(match &self.pull_request_query { .child(match &self.pull_request_query {
| Some(q) => { | Some(q) => match read_query(q, cx) {
match read_query(q, cx) { | QueryStatus::Loaded(pr) => match (&self.diff_view, self.current_tab) {
| QueryStatus::Loaded(pr) => match (&self.diff_view, self.current_tab) { | (Some(diff_view), Tab::DiffView) => diff_view.clone().into_any_element(),
| (Some(diff_view), Tab::DiffView) => diff_view.clone().into_any_element(), | _ => self.pr_content(pr, cx),
| _ => self.pr_content(pr, cx), },
| QueryStatus::Err(e) => div()
.size_full()
.child(format!("{:?}", e))
.into_any_element(),
| QueryStatus::Loading => div()
.size_full()
.child("loading pr content")
.into_any_element(),
}, },
| QueryStatus::Err(e) => div() | None => div().size_full().child("no pr selected").into_any_element(),
.size_full()
.child(format!("{:?}", e))
.into_any_element(),
| QueryStatus::Loading => div()
.size_full()
.child("loading pr content")
.into_any_element(),
}
}
| None => div().size_full().child("no pr selected").into_any_element(),
}) })
} }
} }

View File

@@ -70,7 +70,7 @@ impl gpui::Render for Screen {
.flex() .flex()
.flex_col() .flex_col()
.size_full() .size_full()
.bg(theme.colors.surface_chrome) .bg(theme.colors.background)
.child(self.titlebar.clone()) .child(self.titlebar.clone())
.child( .child(
div() div()

View File

@@ -50,7 +50,7 @@ impl gpui::Render for TitleBar {
.flex() .flex()
.px(g.safe_area.size.width) .px(g.safe_area.size.width)
.py_2() .py_2()
.bg(g.current_theme.colors.surface_chrome) .bg(g.current_theme.colors.background)
.text_color(g.current_theme.colors.text) .text_color(g.current_theme.colors.text)
.relative() .relative()
.child(repo_selector(cx)) .child(repo_selector(cx))