feat: open issue and pull request details in a new tab
This commit is contained in:
@@ -259,7 +259,6 @@ impl Render for IssuesView {
|
||||
.id(SharedString::from(format!("issue:{id_hex}")))
|
||||
.w_full()
|
||||
.h_16()
|
||||
.gap_4()
|
||||
.px_2()
|
||||
.border_b_1()
|
||||
.border_color(cx.theme().colors.border)
|
||||
@@ -273,7 +272,7 @@ impl Render for IssuesView {
|
||||
cx,
|
||||
|panels, cx| {
|
||||
panels.open(
|
||||
PanelSlot::Split,
|
||||
PanelSlot::Main,
|
||||
id,
|
||||
move |_, cx| {
|
||||
cx.new(|cx| {
|
||||
@@ -291,49 +290,55 @@ impl Render for IssuesView {
|
||||
)
|
||||
}));
|
||||
})
|
||||
.child(status_badge(status))
|
||||
.child(
|
||||
v_flex()
|
||||
.flex_1()
|
||||
.min_w_0()
|
||||
.gap_1()
|
||||
h_flex()
|
||||
.w_full()
|
||||
.items_start()
|
||||
.gap_2()
|
||||
.child(h_flex().w_24().child(status_badge(status)))
|
||||
.child(
|
||||
div()
|
||||
.text_sm()
|
||||
.text_ellipsis()
|
||||
.whitespace_nowrap()
|
||||
.child(issue.activity_subject()),
|
||||
)
|
||||
.child(
|
||||
h_flex()
|
||||
.gap_2()
|
||||
.text_xs()
|
||||
.child(
|
||||
h_flex()
|
||||
.gap_1()
|
||||
.child(
|
||||
Avatar::new(issue.pubkey)
|
||||
.name(profile.name())
|
||||
.picture(
|
||||
profile.picture(),
|
||||
)
|
||||
.small(),
|
||||
)
|
||||
.child(
|
||||
div().child(profile.name()),
|
||||
),
|
||||
)
|
||||
.child("opened")
|
||||
v_flex()
|
||||
.flex_1()
|
||||
.min_w_0()
|
||||
.gap_1()
|
||||
.child(
|
||||
div()
|
||||
.text_color(
|
||||
cx.theme()
|
||||
.colors
|
||||
.muted_foreground,
|
||||
)
|
||||
.child(short_id(&id_hex)),
|
||||
.text_sm()
|
||||
.text_ellipsis()
|
||||
.whitespace_nowrap()
|
||||
.child(issue.activity_subject()),
|
||||
)
|
||||
.child(relative_time(issue.created_at)),
|
||||
.child(
|
||||
h_flex()
|
||||
.gap_2()
|
||||
.text_xs()
|
||||
.child(
|
||||
h_flex()
|
||||
.gap_1()
|
||||
.child(
|
||||
Avatar::new(issue.pubkey)
|
||||
.name(profile.name())
|
||||
.picture(
|
||||
profile.picture(),
|
||||
)
|
||||
.small(),
|
||||
)
|
||||
.child(
|
||||
div().child(profile.name()),
|
||||
),
|
||||
)
|
||||
.child("opened")
|
||||
.child(
|
||||
div()
|
||||
.text_color(
|
||||
cx.theme()
|
||||
.colors
|
||||
.muted_foreground,
|
||||
)
|
||||
.child(short_id(&id_hex)),
|
||||
)
|
||||
.child(relative_time(issue.created_at)),
|
||||
),
|
||||
),
|
||||
)
|
||||
.into_any_element()
|
||||
|
||||
@@ -116,6 +116,10 @@ impl Panel for NewIssueView {
|
||||
fn loading(&self, _cx: &App) -> bool {
|
||||
self.submitting
|
||||
}
|
||||
|
||||
fn toolbar(&self, _cx: &App) -> bool {
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
impl Render for NewIssueView {
|
||||
@@ -130,6 +134,7 @@ impl Render for NewIssueView {
|
||||
.gap_3()
|
||||
.child(
|
||||
div()
|
||||
.pr_16()
|
||||
.text_base()
|
||||
.text_color(cx.theme().colors.muted_foreground)
|
||||
.child("Report a bug, ask a question, or propose a change."),
|
||||
|
||||
@@ -310,6 +310,7 @@ impl Render for PullRequestsView {
|
||||
this.child(
|
||||
Alert::new("pr-warning")
|
||||
.severity(AlertSeverity::Warning)
|
||||
.style(ui::alert::AlertStyle::Inline)
|
||||
.title("Pull request warning")
|
||||
.message(warning)
|
||||
.on_dismiss(move |cx| {
|
||||
@@ -324,6 +325,7 @@ impl Render for PullRequestsView {
|
||||
this.child(
|
||||
Alert::new("pr-error")
|
||||
.severity(AlertSeverity::Danger)
|
||||
.style(ui::alert::AlertStyle::Inline)
|
||||
.title("Pull request error")
|
||||
.message(error)
|
||||
.on_dismiss(move |cx| {
|
||||
@@ -352,6 +354,7 @@ impl Render for PullRequestsView {
|
||||
}) else {
|
||||
return div().into_any_element();
|
||||
};
|
||||
|
||||
let profile = directory.read(cx).profile(&pr.pubkey, cx);
|
||||
let pr_id = pr.id;
|
||||
let id_hex = pr.id.to_hex();
|
||||
@@ -363,7 +366,6 @@ impl Render for PullRequestsView {
|
||||
.id(SharedString::from(format!("pr:{id_hex}")))
|
||||
.w_full()
|
||||
.h_16()
|
||||
.gap_4()
|
||||
.px_2()
|
||||
.border_b_1()
|
||||
.border_color(cx.theme().colors.border)
|
||||
@@ -378,7 +380,7 @@ impl Render for PullRequestsView {
|
||||
cx,
|
||||
|panels, cx| {
|
||||
panels.open(
|
||||
PanelSlot::Split,
|
||||
PanelSlot::Main,
|
||||
id,
|
||||
move |window, cx| {
|
||||
cx.new(|cx| {
|
||||
@@ -399,49 +401,55 @@ impl Render for PullRequestsView {
|
||||
)
|
||||
}));
|
||||
})
|
||||
.child(status_badge(status))
|
||||
.child(
|
||||
v_flex()
|
||||
.flex_1()
|
||||
.min_w_0()
|
||||
.gap_1()
|
||||
h_flex()
|
||||
.w_full()
|
||||
.items_start()
|
||||
.gap_2()
|
||||
.child(h_flex().w_24().child(status_badge(status)))
|
||||
.child(
|
||||
div()
|
||||
.text_sm()
|
||||
.text_ellipsis()
|
||||
.whitespace_nowrap()
|
||||
.child(pr.activity_subject()),
|
||||
)
|
||||
.child(
|
||||
h_flex()
|
||||
.gap_2()
|
||||
.text_xs()
|
||||
.child(
|
||||
h_flex()
|
||||
.gap_1()
|
||||
.child(
|
||||
Avatar::new(pr.pubkey)
|
||||
.name(profile.name())
|
||||
.picture(
|
||||
profile.picture(),
|
||||
)
|
||||
.small(),
|
||||
)
|
||||
.child(
|
||||
div().child(profile.name()),
|
||||
),
|
||||
)
|
||||
.child("opened")
|
||||
v_flex()
|
||||
.flex_1()
|
||||
.min_w_0()
|
||||
.gap_1()
|
||||
.child(
|
||||
div()
|
||||
.text_color(
|
||||
cx.theme()
|
||||
.colors
|
||||
.muted_foreground,
|
||||
)
|
||||
.child(short_id(&id_hex)),
|
||||
.text_sm()
|
||||
.text_ellipsis()
|
||||
.whitespace_nowrap()
|
||||
.child(pr.activity_subject()),
|
||||
)
|
||||
.child(relative_time(pr.created_at)),
|
||||
.child(
|
||||
h_flex()
|
||||
.gap_2()
|
||||
.text_xs()
|
||||
.child(
|
||||
h_flex()
|
||||
.gap_1()
|
||||
.child(
|
||||
Avatar::new(pr.pubkey)
|
||||
.name(profile.name())
|
||||
.picture(
|
||||
profile.picture(),
|
||||
)
|
||||
.small(),
|
||||
)
|
||||
.child(
|
||||
div().child(profile.name()),
|
||||
),
|
||||
)
|
||||
.child("opened")
|
||||
.child(
|
||||
div()
|
||||
.text_color(
|
||||
cx.theme()
|
||||
.colors
|
||||
.muted_foreground,
|
||||
)
|
||||
.child(short_id(&id_hex)),
|
||||
)
|
||||
.child(relative_time(pr.created_at)),
|
||||
),
|
||||
),
|
||||
)
|
||||
.into_any_element()
|
||||
|
||||
@@ -328,6 +328,7 @@ impl NewPullRequestView {
|
||||
|
||||
h_flex()
|
||||
.px_4()
|
||||
.pr_16()
|
||||
.py_2()
|
||||
.w_full()
|
||||
.gap_3()
|
||||
@@ -950,6 +951,10 @@ impl Panel for NewPullRequestView {
|
||||
fn loading(&self, _cx: &App) -> bool {
|
||||
self.loading
|
||||
}
|
||||
|
||||
fn toolbar(&self, _cx: &App) -> bool {
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
impl Render for NewPullRequestView {
|
||||
|
||||
@@ -137,6 +137,10 @@ impl Panel for SendPatchView {
|
||||
fn loading(&self, _cx: &App) -> bool {
|
||||
self.submitting
|
||||
}
|
||||
|
||||
fn toolbar(&self, _cx: &App) -> bool {
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
impl Render for SendPatchView {
|
||||
@@ -149,7 +153,9 @@ impl Render for SendPatchView {
|
||||
.p_4()
|
||||
.flex_1()
|
||||
.gap_2()
|
||||
.child(Input::new("patch-subject", self.subject.clone()).placeholder("Title"))
|
||||
.child(div().pr_16().child(
|
||||
Input::new("patch-subject", self.subject.clone()).placeholder("Title"),
|
||||
))
|
||||
.child(
|
||||
Input::new("patch-description", self.description.clone())
|
||||
.rows(2)
|
||||
|
||||
@@ -5,6 +5,8 @@ use signed_state::RepoStore;
|
||||
use ui::layout::panel::PanelSlot;
|
||||
|
||||
use crate::app::AppRoot;
|
||||
use crate::issues::detail::IssueDetailView;
|
||||
use crate::pull_requests::PullRequestDetailView;
|
||||
use crate::repo::RepoDetailView;
|
||||
use crate::shared::log_dropped;
|
||||
|
||||
@@ -29,7 +31,7 @@ pub fn open_repo_panel(
|
||||
let workspace_for_build = workspace.clone();
|
||||
|
||||
log_dropped(workspace.update(cx, |root, cx| {
|
||||
root.panels().clone().update(cx, |panels, cx| {
|
||||
root.panels().update(cx, |panels, cx| {
|
||||
panels.open(
|
||||
PanelSlot::Main,
|
||||
id,
|
||||
@@ -62,19 +64,11 @@ pub fn open_repo_item(
|
||||
let id = SharedString::from(format!("issue:{issue_id}"));
|
||||
let store = store.clone();
|
||||
log_dropped(workspace.update(cx, |root, cx| {
|
||||
root.panels().clone().update(cx, |panels, cx| {
|
||||
root.panels().update(cx, |panels, cx| {
|
||||
panels.open(
|
||||
PanelSlot::Split,
|
||||
PanelSlot::Main,
|
||||
id,
|
||||
move |_, cx| {
|
||||
cx.new(|cx| {
|
||||
crate::issues::detail::IssueDetailView::new(
|
||||
store.clone(),
|
||||
issue_id,
|
||||
cx,
|
||||
)
|
||||
})
|
||||
},
|
||||
move |_, cx| cx.new(|cx| IssueDetailView::new(store.clone(), issue_id, cx)),
|
||||
window,
|
||||
cx,
|
||||
)
|
||||
@@ -86,13 +80,13 @@ pub fn open_repo_item(
|
||||
let workspace_for_build = workspace.clone();
|
||||
let store = store.clone();
|
||||
log_dropped(workspace.update(cx, |root, cx| {
|
||||
root.panels().clone().update(cx, |panels, cx| {
|
||||
root.panels().update(cx, |panels, cx| {
|
||||
panels.open(
|
||||
PanelSlot::Split,
|
||||
PanelSlot::Main,
|
||||
id,
|
||||
move |window, cx| {
|
||||
cx.new(|cx| {
|
||||
crate::pull_requests::PullRequestDetailView::new(
|
||||
PullRequestDetailView::new(
|
||||
workspace_for_build.clone(),
|
||||
store.clone(),
|
||||
pr_id,
|
||||
|
||||
Reference in New Issue
Block a user