feat: pr toolbar skeleton

This commit is contained in:
2026-05-13 02:23:20 +08:00
parent eae7b84f4b
commit 930640f370
6 changed files with 78 additions and 1 deletions

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-eye-icon lucide-eye"><path d="M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"/><circle cx="12" cy="12" r="3"/></svg>

After

Width:  |  Height:  |  Size: 374 B

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-git-merge-icon lucide-git-merge"><circle cx="18" cy="18" r="3"/><circle cx="6" cy="6" r="3"/><path d="M6 21V9a9 9 0 0 0 9 9"/></svg>

After

Width:  |  Height:  |  Size: 335 B

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-refresh-cw-icon lucide-refresh-cw"><path d="M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"/><path d="M21 3v5h-5"/><path d="M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"/><path d="M8 16H3v5"/></svg>

After

Width:  |  Height:  |  Size: 412 B

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-star-icon lucide-star"><path d="M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z"/></svg>

After

Width:  |  Height:  |  Size: 608 B

View File

@@ -38,7 +38,11 @@ define_font_icons!(
List,
PullRequestArrow,
PullRequestClosed,
PullRequestDraft
PullRequestDraft,
GitMerge,
Eye,
RefreshCw,
Star,
);
#[derive(gpui::IntoElement)]

View File

@@ -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<query::Entity<api::issues::FetchPullRequest>>,
}
#[derive(gpui::IntoElement)]
struct Toolbar {}
pub fn new(cx: &mut gpui::Context<PullRequestView>) -> 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<gpui::ElementId>) -> 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(),
)
}
}