From 75c3b73665bd76e062307a4b68a677415fcb3543 Mon Sep 17 00:00:00 2001 From: Kenneth Date: Thu, 28 May 2026 21:08:51 +0100 Subject: [PATCH] feat: change background color --- .../dashboard/pull_request_diff_view.rs | 69 ++++++------ src/screen/dashboard/pull_request_view.rs | 100 +++++++++--------- src/screen/dashboard/screen.rs | 2 +- src/screen/dashboard/titlebar.rs | 2 +- 4 files changed, 86 insertions(+), 87 deletions(-) diff --git a/src/screen/dashboard/pull_request_diff_view.rs b/src/screen/dashboard/pull_request_diff_view.rs index 10911b7..7aa9a55 100644 --- a/src/screen/dashboard/pull_request_diff_view.rs +++ b/src/screen/dashboard/pull_request_diff_view.rs @@ -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(), + }, } } } diff --git a/src/screen/dashboard/pull_request_view.rs b/src/screen/dashboard/pull_request_view.rs index f6ff4ec..b268b11 100644 --- a/src/screen/dashboard/pull_request_view.rs +++ b/src/screen/dashboard/pull_request_view.rs @@ -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(), }) } } diff --git a/src/screen/dashboard/screen.rs b/src/screen/dashboard/screen.rs index c873917..d877079 100644 --- a/src/screen/dashboard/screen.rs +++ b/src/screen/dashboard/screen.rs @@ -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() diff --git a/src/screen/dashboard/titlebar.rs b/src/screen/dashboard/titlebar.rs index a235fd2..47220ab 100644 --- a/src/screen/dashboard/titlebar.rs +++ b/src/screen/dashboard/titlebar.rs @@ -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))