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) = {
match read_query(query, cx) {
| QueryStatus::Loaded(diff) => Some(Arc::clone(diff)),
| _ => None,
| QueryStatus::Loaded(diff) => Some(Arc::clone(diff)),
| _ => None,
}
} {
self.load_diff_view(diff, cx);
@@ -158,16 +158,16 @@ impl PullRequestDiffView {
_ = cx
.spawn(async move |weak, cx| match tokio::join!(t1, t2) {
| (Some(old_side_highlights), Some(new_side_highlights)) => {
_ = weak.update(cx, |this, cx| {
this.diff_view_state
.set_old_side_highlights(old_side_highlights);
this.diff_view_state
.set_new_side_highlights(new_side_highlights);
cx.notify();
});
}
| _ => {}
| (Some(old_side_highlights), Some(new_side_highlights)) => {
_ = weak.update(cx, |this, cx| {
this.diff_view_state
.set_old_side_highlights(old_side_highlights);
this.diff_view_state
.set_new_side_highlights(new_side_highlights);
cx.notify();
});
}
| _ => {}
})
.detach();
}
@@ -189,30 +189,31 @@ impl gpui::Render for PullRequestDiffView {
.unwrap_or(QueryStatus::Loading);
match content_diff {
| QueryStatus::Err(_) | QueryStatus::Loading => div()
.size_full()
.bg(theme.colors.surface)
.p_4()
.child(text("asd")),
| QueryStatus::Err(_) | QueryStatus::Loading => div()
.size_full()
.bg(theme.colors.surface)
.p_4()
.child(text("asd")),
| QueryStatus::Loaded(_) => match &self.diff_view_content {
| Some(content) => div()
.size_full()
.flex()
.flex_row()
.child(
div()
| QueryStatus::Loaded(_) => match &self.diff_view_content {
| Some(content) => div()
.size_full()
.flex()
.w_80()
.h_full()
.border_r_1()
.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(),
},
.flex_row()
.child(
div()
.flex()
.w_80()
.h_full()
.bg(theme.colors.surface_chrome)
.border_r_1()
.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()
.justify_start()
.p_1()
.bg(theme.colors.surface)
.bg(theme.colors.surface_chrome)
.border_b_1()
.border_color(theme.colors.border_muted)
.child(
@@ -181,41 +181,41 @@ impl PullRequestView {
.rounded_full();
match pr.state {
| api::issues::PullRequestState::Open => {
status_pill = status_pill
.bg(theme.colors.success_solid)
.child(
font_icon(FontIcon::PullRequestArrow)
.size_3()
.text_color(theme.colors.success_on_solid),
)
.child(
text("Open")
.text_color(theme.colors.success_on_solid)
| api::issues::PullRequestState::Open => {
status_pill = status_pill
.bg(theme.colors.success_solid)
.child(
font_icon(FontIcon::PullRequestArrow)
.size_3()
.text_color(theme.colors.success_on_solid),
)
.child(
text("Open")
.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(),
);
}
| 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| {
@@ -354,25 +354,23 @@ impl gpui::Render for PullRequestView {
.flex_col()
.child(self.toolbar(cx))
.child(match &self.pull_request_query {
| Some(q) => {
match read_query(q, cx) {
| QueryStatus::Loaded(pr) => match (&self.diff_view, self.current_tab) {
| (Some(diff_view), Tab::DiffView) => diff_view.clone().into_any_element(),
| _ => self.pr_content(pr, cx),
| Some(q) => match read_query(q, cx) {
| QueryStatus::Loaded(pr) => match (&self.diff_view, self.current_tab) {
| (Some(diff_view), Tab::DiffView) => diff_view.clone().into_any_element(),
| _ => 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()
.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(),
| None => div().size_full().child("no pr selected").into_any_element(),
})
}
}

View File

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

View File

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