diff --git a/src/asset/font_icon/eye.svg b/src/asset/font_icon/eye.svg new file mode 100644 index 0000000..6696613 --- /dev/null +++ b/src/asset/font_icon/eye.svg @@ -0,0 +1 @@ + diff --git a/src/asset/font_icon/git_merge.svg b/src/asset/font_icon/git_merge.svg new file mode 100644 index 0000000..1d71061 --- /dev/null +++ b/src/asset/font_icon/git_merge.svg @@ -0,0 +1 @@ + diff --git a/src/asset/font_icon/refresh_cw.svg b/src/asset/font_icon/refresh_cw.svg new file mode 100644 index 0000000..694f0bf --- /dev/null +++ b/src/asset/font_icon/refresh_cw.svg @@ -0,0 +1 @@ + diff --git a/src/asset/font_icon/star.svg b/src/asset/font_icon/star.svg new file mode 100644 index 0000000..e1342f7 --- /dev/null +++ b/src/asset/font_icon/star.svg @@ -0,0 +1 @@ + diff --git a/src/component/font_icon.rs b/src/component/font_icon.rs index bcaa2b5..00b8cd6 100644 --- a/src/component/font_icon.rs +++ b/src/component/font_icon.rs @@ -38,7 +38,11 @@ define_font_icons!( List, PullRequestArrow, PullRequestClosed, - PullRequestDraft + PullRequestDraft, + GitMerge, + Eye, + RefreshCw, + Star, ); #[derive(gpui::IntoElement)] diff --git a/src/screen/dashboard/pull_request_view.rs b/src/screen/dashboard/pull_request_view.rs index a4ee9e9..a4c4967 100644 --- a/src/screen/dashboard/pull_request_view.rs +++ b/src/screen/dashboard/pull_request_view.rs @@ -7,6 +7,7 @@ use crate::{ api::{self}, app, component::{ + button::{self, Button, button}, font_icon::{FontIcon, font_icon}, markdown::{self, MarkdownText}, text::text, @@ -20,6 +21,9 @@ pub(crate) struct PullRequestView { pull_request_query: Option>, } +#[derive(gpui::IntoElement)] +struct Toolbar {} + pub fn new(cx: &mut gpui::Context) -> PullRequestView { PullRequestView { markdown_viewer: None, @@ -198,6 +202,7 @@ impl PullRequestView { .flex() .flex_col() .overflow_hidden() + .child(Toolbar {}) .child( div() .flex() @@ -267,3 +272,67 @@ impl gpui::Render for PullRequestView { }) } } + +impl gpui::RenderOnce for Toolbar { + fn render(self, window: &mut gpui::Window, cx: &mut gpui::App) -> impl IntoElement { + fn toolbar_button(id: impl Into) -> Button { + button(id) + .px_2p5() + .py_1() + .variant(button::Variant::Secondary) + } + + fn divider() -> gpui::Div { + div().h_full().w_px() + } + + let theme = app::current_theme(cx); + div() + .w_full() + .flex() + .flex_row() + .items_center() + .justify_start() + .p_2() + .bg(theme.colors.background) + .border_b_1() + .border_color(theme.colors.border) + .child( + toolbar_button("pr-review-btn") + .leading(font_icon(FontIcon::Eye)) + .mr_2(), + ) + .child( + toolbar_button("pr-review-btn") + .leading(font_icon(FontIcon::RefreshCw)) + .mr_2(), + ) + .child(divider().bg(theme.colors.border).mr_2()) + .child( + toolbar_button("pr-review-btn") + .leading(font_icon(FontIcon::Star)) + .mr_2(), + ) + .child(div().flex_1()) + .child( + toolbar_button("pr-close-btn") + .leading(font_icon(FontIcon::PullRequestClosed)) + .mr_2(), + ) + .child( + toolbar_button("pr-merge-btn") + .variant(button::Variant::Primary) + .leading(font_icon(FontIcon::GitMerge)) + .rounded_r_none(), + ) + .child(divider()) + .child( + toolbar_button("chevron") + .py_1() + .px_0p5() + .variant(button::Variant::Primary) + .leading(font_icon(FontIcon::ChevronDown)) + .rounded_l_none(), + ) + } +}