chore: refactor issue detail into a split panel
This commit is contained in:
@@ -167,7 +167,7 @@ impl Render for ImportDialog {
|
||||
.gap_3()
|
||||
.child(
|
||||
div()
|
||||
.text_base()
|
||||
.text_sm()
|
||||
.text_color(cx.theme().colors.muted_foreground)
|
||||
.child(description),
|
||||
)
|
||||
|
||||
@@ -86,7 +86,7 @@ impl Render for OnboardingDialog {
|
||||
.gap_3()
|
||||
.child(
|
||||
div()
|
||||
.text_base()
|
||||
.text_sm()
|
||||
.text_color(cx.theme().colors.muted_foreground)
|
||||
.child("Set up your Signed identity to get started."),
|
||||
)
|
||||
|
||||
@@ -21,7 +21,7 @@ pub fn repo_header(id: SharedString, name: SharedString, unread: usize) -> AnyEl
|
||||
.child(
|
||||
div()
|
||||
.min_w_0()
|
||||
.text_base()
|
||||
.text_sm()
|
||||
.whitespace_nowrap()
|
||||
.text_ellipsis()
|
||||
.child(name),
|
||||
@@ -79,7 +79,7 @@ pub fn thread(
|
||||
.child(
|
||||
h_flex()
|
||||
.gap_2()
|
||||
.text_base()
|
||||
.text_sm()
|
||||
.child(
|
||||
h_flex()
|
||||
.size_6()
|
||||
|
||||
@@ -1,24 +1,34 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use gpui::prelude::FluentBuilder as _;
|
||||
use gpui::{
|
||||
App, Context, Entity, InteractiveElement as _, IntoElement, ParentElement as _, Render,
|
||||
ScrollHandle, SharedString, Styled as _, Subscription, Window, div,
|
||||
AnyElement, App, AppContext as _, Context, Entity, InteractiveElement as _, IntoElement,
|
||||
ParentElement as _, Pixels, Render, ScrollHandle, SharedString, Styled as _, Subscription,
|
||||
WeakEntity, Window, div, px,
|
||||
};
|
||||
use metadata::ProfileDirectory;
|
||||
use nostr::prelude::EventId;
|
||||
use signed_core::GitEvent;
|
||||
use signed_state::RepoStore;
|
||||
use ui::avatar::Avatar;
|
||||
use ui::badge::{Badge, BadgeVariant};
|
||||
use ui::common::{Sizable as _, StyledExt as _, h_flex, v_flex};
|
||||
use ui::empty_state::EmptyState;
|
||||
use ui::input::InputState;
|
||||
use ui::layout::panel::Panel;
|
||||
use ui::layout::panel::{Panel, PanelSlot, SplitSide};
|
||||
use ui::scroll_area::ScrollArea;
|
||||
use ui::spinner::Spinner;
|
||||
use ui::theme::ActiveTheme as _;
|
||||
use utils::relative_time;
|
||||
|
||||
use crate::issues::helpers::{comment_form, comments_section, sidebar_section};
|
||||
use crate::shared::log_dropped;
|
||||
use crate::app::AppRoot;
|
||||
use crate::issues::helpers::{comment_form, comments_section};
|
||||
use crate::shared::widgets::status_badge;
|
||||
use crate::shared::{log_dropped, track_event_participants};
|
||||
|
||||
/// The split pane showing the issue's participants and labels.
|
||||
const SIDEBAR_ID: &str = "Issue details";
|
||||
const SIDEBAR_WIDTH: Pixels = px(240.);
|
||||
|
||||
pub struct IssueDetailView {
|
||||
store: Entity<RepoStore>,
|
||||
@@ -31,6 +41,48 @@ pub struct IssueDetailView {
|
||||
}
|
||||
|
||||
impl IssueDetailView {
|
||||
/// Opens the issue's detail as the main panel and its sidebar in the split pane.
|
||||
pub fn open(
|
||||
workspace: &WeakEntity<AppRoot>,
|
||||
store: Entity<RepoStore>,
|
||||
issue_id: EventId,
|
||||
window: &mut Window,
|
||||
cx: &mut App,
|
||||
) {
|
||||
let id = SharedString::from(format!("issue:{issue_id}"));
|
||||
let sidebar_store = store.clone();
|
||||
|
||||
log_dropped(workspace.update(cx, |root, cx| {
|
||||
root.panels().update(cx, |panels, cx| {
|
||||
panels.open(
|
||||
PanelSlot::Main,
|
||||
id,
|
||||
{
|
||||
let store = store.clone();
|
||||
move |_, cx| cx.new(|cx| IssueDetailView::new(store.clone(), issue_id, cx))
|
||||
},
|
||||
window,
|
||||
cx,
|
||||
);
|
||||
|
||||
let sidebar = cx.new(|cx| IssueSidebarView {
|
||||
store: sidebar_store.clone(),
|
||||
issue_id,
|
||||
directory: ProfileDirectory::new(cx),
|
||||
scroll_handle: ScrollHandle::new(),
|
||||
});
|
||||
|
||||
panels.insert_split_at(
|
||||
SIDEBAR_ID,
|
||||
SIDEBAR_WIDTH,
|
||||
SplitSide::Trailing,
|
||||
Arc::new(sidebar),
|
||||
cx,
|
||||
);
|
||||
})
|
||||
}));
|
||||
}
|
||||
|
||||
pub fn new(store: Entity<RepoStore>, issue_id: EventId, cx: &mut Context<Self>) -> Self {
|
||||
let comment_input = InputState::builder().multiline().build(cx);
|
||||
let directory = ProfileDirectory::new(cx);
|
||||
@@ -60,31 +112,54 @@ impl IssueDetailView {
|
||||
/// Track the issue author, everyone who commented and the repository owner.
|
||||
fn track_participants(&mut self, cx: &mut Context<Self>) {
|
||||
let store = self.store.read(cx);
|
||||
let owner = store.announcement.as_ref().map(|a| a.owner);
|
||||
|
||||
let author = store
|
||||
.issues
|
||||
.iter()
|
||||
.find(|issue| issue.id == self.issue_id)
|
||||
.map(|issue| issue.pubkey);
|
||||
let owner = store.announcement.as_ref().map(|a| a.owner);
|
||||
|
||||
let comments: Vec<_> = store
|
||||
.comments_of(&self.issue_id)
|
||||
.map(|comment| comment.pubkey)
|
||||
.collect();
|
||||
crate::shared::track_event_participants(
|
||||
author,
|
||||
owner,
|
||||
comments.into_iter(),
|
||||
&self.directory,
|
||||
cx,
|
||||
);
|
||||
|
||||
track_event_participants(author, owner, comments.into_iter(), &self.directory, cx);
|
||||
}
|
||||
}
|
||||
|
||||
impl Panel for IssueDetailView {
|
||||
fn title(&self, _cx: &App) -> SharedString {
|
||||
let hex = self.issue_id.to_hex();
|
||||
let short = hex.get(..8).unwrap_or(&hex);
|
||||
SharedString::from(format!("Issue {short}"))
|
||||
fn title(&self, cx: &App) -> SharedString {
|
||||
let subject = self
|
||||
.store
|
||||
.read(cx)
|
||||
.issues
|
||||
.iter()
|
||||
.find(|issue| issue.id == self.issue_id)
|
||||
.map(|issue| issue.activity_subject());
|
||||
|
||||
match subject {
|
||||
Some(subject) => SharedString::from(format!("issue: {subject}")),
|
||||
None => {
|
||||
let hex = self.issue_id.to_hex();
|
||||
let short = hex.get(..8).unwrap_or(&hex);
|
||||
SharedString::from(format!("issue: {short}"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn prefix(&self, cx: &App) -> Option<AnyElement> {
|
||||
let owner = self.store.read(cx).announcement.as_ref().map(|a| a.owner)?;
|
||||
let profile = self.directory.read(cx).profile(&owner, cx);
|
||||
|
||||
Some(
|
||||
Avatar::new(owner)
|
||||
.name(profile.name())
|
||||
.picture(profile.picture())
|
||||
.small()
|
||||
.into_any_element(),
|
||||
)
|
||||
}
|
||||
|
||||
fn loading(&self, cx: &App) -> bool {
|
||||
@@ -112,7 +187,6 @@ impl Render for IssueDetailView {
|
||||
} else {
|
||||
SharedString::from(&issue.content)
|
||||
};
|
||||
|
||||
(
|
||||
issue.activity_subject(),
|
||||
profile.name(),
|
||||
@@ -125,27 +199,22 @@ impl Render for IssueDetailView {
|
||||
};
|
||||
let picture = self.directory.read(cx).profile(&pubkey, cx).picture();
|
||||
|
||||
h_flex()
|
||||
div()
|
||||
.id("issue-detail")
|
||||
.size_full()
|
||||
.child(
|
||||
ScrollArea::new("issue-detail-scroll")
|
||||
.handle(self.scroll_handle.clone())
|
||||
.flex_1()
|
||||
.min_w_0()
|
||||
.size_full()
|
||||
.child(
|
||||
v_flex()
|
||||
.p_4()
|
||||
.gap_6()
|
||||
.child(
|
||||
h_flex().gap_2().child(status_badge(status)).child(
|
||||
div()
|
||||
.flex_1()
|
||||
.min_w_0()
|
||||
.text_sm()
|
||||
.font_semibold()
|
||||
.child(title),
|
||||
),
|
||||
h_flex()
|
||||
.gap_2()
|
||||
.child(status_badge(status))
|
||||
.child(div().flex_1().min_w_0().font_semibold().child(title)),
|
||||
)
|
||||
.child(
|
||||
v_flex()
|
||||
@@ -156,7 +225,7 @@ impl Render for IssueDetailView {
|
||||
.child(
|
||||
h_flex()
|
||||
.gap_2()
|
||||
.text_base()
|
||||
.text_sm()
|
||||
.child(
|
||||
h_flex()
|
||||
.gap_1()
|
||||
@@ -183,7 +252,7 @@ impl Render for IssueDetailView {
|
||||
.child(SharedString::from(age)),
|
||||
),
|
||||
)
|
||||
.child(div().text_base().child(content)),
|
||||
.child(content),
|
||||
)
|
||||
.child(comments_section(
|
||||
&self.store,
|
||||
@@ -202,14 +271,116 @@ impl Render for IssueDetailView {
|
||||
),
|
||||
),
|
||||
)
|
||||
.child(sidebar_section(
|
||||
&self.store,
|
||||
issue_id,
|
||||
&store.issues,
|
||||
true,
|
||||
&self.directory,
|
||||
cx,
|
||||
))
|
||||
.into_any_element()
|
||||
}
|
||||
}
|
||||
|
||||
/// The issue's participant and label sidebar, shown in the split pane.
|
||||
struct IssueSidebarView {
|
||||
store: Entity<RepoStore>,
|
||||
issue_id: EventId,
|
||||
directory: Entity<ProfileDirectory>,
|
||||
scroll_handle: ScrollHandle,
|
||||
}
|
||||
|
||||
impl Panel for IssueSidebarView {
|
||||
fn title(&self, _cx: &App) -> SharedString {
|
||||
SharedString::from(SIDEBAR_ID)
|
||||
}
|
||||
}
|
||||
|
||||
impl Render for IssueSidebarView {
|
||||
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||
let store = self.store.read(cx);
|
||||
|
||||
let details = store
|
||||
.issues
|
||||
.iter()
|
||||
.find(|issue| issue.id == self.issue_id)
|
||||
.map(|root| {
|
||||
let mut participants = vec![root.pubkey];
|
||||
participants.extend(store.comments_of(&root.id).map(|comment| comment.pubkey));
|
||||
participants.sort_by_key(|key| key.to_hex());
|
||||
participants.dedup();
|
||||
|
||||
let labels: Vec<String> = root.tags.hashtags().map(|tag| tag.to_string()).collect();
|
||||
|
||||
v_flex()
|
||||
.gap_4()
|
||||
.child(
|
||||
v_flex()
|
||||
.gap_2()
|
||||
.child(
|
||||
div()
|
||||
.text_xs()
|
||||
.font_medium()
|
||||
.text_color(cx.theme().colors.muted_foreground)
|
||||
.child("Participants"),
|
||||
)
|
||||
.children(participants.iter().map(|pubkey| {
|
||||
let profile = self.directory.read(cx).profile(pubkey, cx);
|
||||
let name = profile.name();
|
||||
|
||||
h_flex()
|
||||
.gap_1()
|
||||
.child(
|
||||
Avatar::new(*pubkey)
|
||||
.name(name.clone())
|
||||
.picture(profile.picture())
|
||||
.small(),
|
||||
)
|
||||
.child(
|
||||
div()
|
||||
.flex_1()
|
||||
.min_w_0()
|
||||
.whitespace_nowrap()
|
||||
.text_sm()
|
||||
.text_ellipsis()
|
||||
.child(name),
|
||||
)
|
||||
.into_any_element()
|
||||
})),
|
||||
)
|
||||
.child(
|
||||
v_flex()
|
||||
.gap_2()
|
||||
.child(
|
||||
div()
|
||||
.text_xs()
|
||||
.font_medium()
|
||||
.text_color(cx.theme().colors.muted_foreground)
|
||||
.child("Labels"),
|
||||
)
|
||||
.map(|this| {
|
||||
if labels.is_empty() {
|
||||
this.child(
|
||||
div()
|
||||
.text_sm()
|
||||
.text_color(cx.theme().colors.muted_foreground)
|
||||
.child("None yet."),
|
||||
)
|
||||
} else {
|
||||
this.child(v_flex().gap_1().items_start().children(
|
||||
labels.iter().map(|label| {
|
||||
Badge::new(
|
||||
SharedString::from(format!("label:{label}")),
|
||||
label.clone(),
|
||||
)
|
||||
.variant(BadgeVariant::Outline)
|
||||
.small()
|
||||
.flex_none()
|
||||
}),
|
||||
))
|
||||
}
|
||||
}),
|
||||
)
|
||||
.into_any_element()
|
||||
})
|
||||
.unwrap_or_else(|| div().into_any_element());
|
||||
|
||||
ScrollArea::new("issue-sidebar-scroll")
|
||||
.handle(self.scroll_handle.clone())
|
||||
.size_full()
|
||||
.child(v_flex().w_full().p_4().child(details))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
use gpui::prelude::FluentBuilder as _;
|
||||
use gpui::{
|
||||
AnyElement, App, Entity, IntoElement, ParentElement as _, SharedString, Styled as _, div, px,
|
||||
};
|
||||
use metadata::ProfileDirectory;
|
||||
use nostr::prelude::{Event, EventId, PublicKey};
|
||||
use nostr::prelude::{Event, EventId};
|
||||
use signed_core::RepoStatus;
|
||||
use signed_state::RepoStore;
|
||||
use ui::avatar::Avatar;
|
||||
use ui::badge::{Badge, BadgeVariant};
|
||||
use ui::button::Button;
|
||||
use ui::common::{Sizable as _, StyledExt as _, h_flex, v_flex};
|
||||
use ui::icons::{Icon, IconRole};
|
||||
@@ -76,98 +74,6 @@ pub(crate) fn filter_by_status<'a>(
|
||||
(visible, counts)
|
||||
}
|
||||
|
||||
pub(crate) fn sidebar_section(
|
||||
store: &Entity<RepoStore>,
|
||||
id: EventId,
|
||||
roots: &[Event],
|
||||
top_gap: bool,
|
||||
directory: &Entity<ProfileDirectory>,
|
||||
cx: &App,
|
||||
) -> AnyElement {
|
||||
let store = store.read(cx);
|
||||
let Some(root) = roots.iter().find(|event| event.id == id) else {
|
||||
return div().into_any_element();
|
||||
};
|
||||
|
||||
let mut participants: Vec<PublicKey> = vec![root.pubkey];
|
||||
participants.extend(store.comments_of(&root.id).map(|comment| comment.pubkey));
|
||||
participants.sort_by_key(PublicKey::to_hex);
|
||||
participants.dedup();
|
||||
|
||||
let labels: Vec<String> = root.tags.hashtags().map(|tag| tag.to_string()).collect();
|
||||
|
||||
v_flex()
|
||||
.w(px(240.))
|
||||
.h_full()
|
||||
.flex_none()
|
||||
.px_4()
|
||||
.gap_4()
|
||||
.border_l_1()
|
||||
.border_color(cx.theme().colors.border)
|
||||
.child(
|
||||
v_flex()
|
||||
.when(top_gap, |this| this.mt_4())
|
||||
.gap_2()
|
||||
.child(
|
||||
div()
|
||||
.text_xs()
|
||||
.font_medium()
|
||||
.text_color(cx.theme().colors.muted_foreground)
|
||||
.child("Participants"),
|
||||
)
|
||||
.children(participants.iter().map(|pubkey| {
|
||||
let profile = directory.read(cx).profile(pubkey, cx);
|
||||
let name = profile.name();
|
||||
|
||||
h_flex()
|
||||
.gap_1()
|
||||
.child(
|
||||
Avatar::new(*pubkey)
|
||||
.name(name.clone())
|
||||
.picture(profile.picture())
|
||||
.small(),
|
||||
)
|
||||
.child(
|
||||
div()
|
||||
.flex_1()
|
||||
.min_w_0()
|
||||
.whitespace_nowrap()
|
||||
.text_base()
|
||||
.text_ellipsis()
|
||||
.child(name),
|
||||
)
|
||||
.into_any_element()
|
||||
})),
|
||||
)
|
||||
.child(
|
||||
v_flex()
|
||||
.gap_2()
|
||||
.child(
|
||||
div()
|
||||
.text_xs()
|
||||
.font_medium()
|
||||
.text_color(cx.theme().colors.muted_foreground)
|
||||
.child("Labels"),
|
||||
)
|
||||
.map(|this| {
|
||||
if labels.is_empty() {
|
||||
this.child(
|
||||
div()
|
||||
.text_base()
|
||||
.text_color(cx.theme().colors.muted_foreground)
|
||||
.child("None yet."),
|
||||
)
|
||||
} else {
|
||||
this.child(v_flex().gap_1().children(labels.iter().map(|label| {
|
||||
Badge::new(SharedString::from(format!("label:{label}")), label.clone())
|
||||
.variant(BadgeVariant::Outline)
|
||||
})))
|
||||
}
|
||||
}),
|
||||
)
|
||||
.into_any_element()
|
||||
}
|
||||
|
||||
pub(crate) fn comments_section(
|
||||
store: &Entity<RepoStore>,
|
||||
root: EventId,
|
||||
@@ -180,7 +86,7 @@ pub(crate) fn comments_section(
|
||||
|
||||
v_flex()
|
||||
.gap_4()
|
||||
.child(div().text_xs().font_medium().child(title))
|
||||
.child(div().text_xs().font_semibold().child(title))
|
||||
.children(comments.iter().map(|comment| {
|
||||
let profile = directory.read(cx).profile(&comment.pubkey, cx);
|
||||
let author = profile.name();
|
||||
@@ -196,7 +102,7 @@ pub(crate) fn comments_section(
|
||||
.child(
|
||||
h_flex()
|
||||
.gap_2()
|
||||
.text_base()
|
||||
.text_sm()
|
||||
.child(
|
||||
h_flex()
|
||||
.gap_1()
|
||||
@@ -219,7 +125,7 @@ pub(crate) fn comments_section(
|
||||
.child(SharedString::from(age)),
|
||||
),
|
||||
)
|
||||
.child(div().text_base().child(content))
|
||||
.child(div().text_sm().child(content))
|
||||
}))
|
||||
.into_any_element()
|
||||
}
|
||||
@@ -242,8 +148,8 @@ pub(crate) fn comment_form(
|
||||
.gap_2()
|
||||
.child(
|
||||
Input::new("comment-input", comment_input.clone())
|
||||
.rows(4)
|
||||
.placeholder("Leave a comment..."),
|
||||
.placeholder("Leave a comment...")
|
||||
.rows(4),
|
||||
)
|
||||
.child(
|
||||
h_flex()
|
||||
|
||||
@@ -264,38 +264,20 @@ impl Render for IssuesView {
|
||||
.border_color(cx.theme().colors.border)
|
||||
.hover(|this| this.bg(cx.theme().colors.muted_hover))
|
||||
.on_click(move |_, window, cx| {
|
||||
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| {
|
||||
panels.open(
|
||||
PanelSlot::Main,
|
||||
id,
|
||||
move |_, cx| {
|
||||
cx.new(|cx| {
|
||||
IssueDetailView::new(
|
||||
store.clone(),
|
||||
issue_id,
|
||||
cx,
|
||||
)
|
||||
})
|
||||
},
|
||||
window,
|
||||
cx,
|
||||
)
|
||||
},
|
||||
)
|
||||
}));
|
||||
IssueDetailView::open(
|
||||
&workspace,
|
||||
store.clone(),
|
||||
issue_id,
|
||||
window,
|
||||
cx,
|
||||
);
|
||||
})
|
||||
.child(
|
||||
h_flex()
|
||||
.w_full()
|
||||
.items_start()
|
||||
.gap_2()
|
||||
.child(h_flex().w_24().child(status_badge(status)))
|
||||
.child(h_flex().w_20().child(status_badge(status)))
|
||||
.child(
|
||||
v_flex()
|
||||
.flex_1()
|
||||
|
||||
@@ -135,7 +135,7 @@ impl Render for NewIssueView {
|
||||
.child(
|
||||
div()
|
||||
.pr_16()
|
||||
.text_base()
|
||||
.text_sm()
|
||||
.text_color(cx.theme().colors.muted_foreground)
|
||||
.child("Report a bug, ask a question, or propose a change."),
|
||||
)
|
||||
|
||||
@@ -5,7 +5,7 @@ use gpui::prelude::FluentBuilder as _;
|
||||
use gpui::{
|
||||
AnyElement, App, AppContext as _, Context, Entity, InteractiveElement as _, IntoElement,
|
||||
ParentElement as _, Render, SharedString, StatefulInteractiveElement as _, StyleRefinement,
|
||||
Styled as _, Subscription, UniformListScrollHandle, WeakEntity, Window, div, uniform_list,
|
||||
Styled as _, Subscription, UniformListScrollHandle, WeakEntity, Window, div, px, uniform_list,
|
||||
};
|
||||
use metadata::ProfileDirectory;
|
||||
use nostr::prelude::{EventId, Kind, Url};
|
||||
@@ -13,6 +13,7 @@ use signed_core::{GitEvent, PullRequest, RepoAddr};
|
||||
use signed_git::{FileCommit, PatchParser};
|
||||
use signed_state::{Backend, BackendEvent, Mirrors, RepoStore};
|
||||
use ui::avatar::Avatar;
|
||||
use ui::badge::{Badge, BadgeVariant};
|
||||
use ui::button::Button;
|
||||
use ui::clipboard::ClipboardButton;
|
||||
use ui::common::{Sizable as _, StyledExt as _, h_flex, v_flex};
|
||||
@@ -29,7 +30,7 @@ use ui::theme::ActiveTheme as _;
|
||||
use utils::{relative_time, relative_time_secs};
|
||||
|
||||
use crate::app::AppRoot;
|
||||
use crate::issues::helpers::{comment_form, comments_section, sidebar_section};
|
||||
use crate::issues::helpers::{comment_form, comments_section};
|
||||
use crate::pull_requests::dialogs::update::UpdatePrDialog;
|
||||
use crate::repo::commit_diff::{CommitDiffView, DiffPane};
|
||||
use crate::repo::helpers::short_id;
|
||||
@@ -401,6 +402,91 @@ impl PullRequestDetailView {
|
||||
|
||||
let store = self.store.read(cx);
|
||||
|
||||
let details = store
|
||||
.pull_requests
|
||||
.iter()
|
||||
.find(|pr| pr.id == root_id)
|
||||
.map(|root| {
|
||||
let mut participants = vec![root.pubkey];
|
||||
participants.extend(store.comments_of(&root.id).map(|comment| comment.pubkey));
|
||||
participants.sort_by_key(|key| key.to_hex());
|
||||
participants.dedup();
|
||||
|
||||
let labels: Vec<String> = root.tags.hashtags().map(|tag| tag.to_string()).collect();
|
||||
|
||||
v_flex()
|
||||
.gap_4()
|
||||
.child(
|
||||
v_flex()
|
||||
.gap_2()
|
||||
.child(
|
||||
div()
|
||||
.text_xs()
|
||||
.font_medium()
|
||||
.text_color(cx.theme().colors.muted_foreground)
|
||||
.child("Participants"),
|
||||
)
|
||||
.children(participants.iter().map(|pubkey| {
|
||||
let profile = self.directory.read(cx).profile(pubkey, cx);
|
||||
let name = profile.name();
|
||||
|
||||
h_flex()
|
||||
.gap_1()
|
||||
.child(
|
||||
Avatar::new(*pubkey)
|
||||
.name(name.clone())
|
||||
.picture(profile.picture())
|
||||
.small(),
|
||||
)
|
||||
.child(
|
||||
div()
|
||||
.flex_1()
|
||||
.min_w_0()
|
||||
.whitespace_nowrap()
|
||||
.text_sm()
|
||||
.text_ellipsis()
|
||||
.child(name),
|
||||
)
|
||||
.into_any_element()
|
||||
})),
|
||||
)
|
||||
.child(
|
||||
v_flex()
|
||||
.gap_2()
|
||||
.child(
|
||||
div()
|
||||
.text_xs()
|
||||
.font_medium()
|
||||
.text_color(cx.theme().colors.muted_foreground)
|
||||
.child("Labels"),
|
||||
)
|
||||
.map(|this| {
|
||||
if labels.is_empty() {
|
||||
this.child(
|
||||
div()
|
||||
.text_sm()
|
||||
.text_color(cx.theme().colors.muted_foreground)
|
||||
.child("None yet."),
|
||||
)
|
||||
} else {
|
||||
this.child(v_flex().gap_1().items_start().children(
|
||||
labels.iter().map(|label| {
|
||||
Badge::new(
|
||||
SharedString::from(format!("label:{label}")),
|
||||
label.clone(),
|
||||
)
|
||||
.variant(BadgeVariant::Outline)
|
||||
.small()
|
||||
.flex_none()
|
||||
}),
|
||||
))
|
||||
}
|
||||
}),
|
||||
)
|
||||
.into_any_element()
|
||||
})
|
||||
.unwrap_or_else(|| div().into_any_element());
|
||||
|
||||
h_flex()
|
||||
.size_full()
|
||||
.min_h_0()
|
||||
@@ -418,7 +504,7 @@ impl PullRequestDetailView {
|
||||
.child(
|
||||
h_flex()
|
||||
.gap_2()
|
||||
.text_base()
|
||||
.text_sm()
|
||||
.child(
|
||||
h_flex()
|
||||
.gap_1()
|
||||
@@ -438,9 +524,7 @@ impl PullRequestDetailView {
|
||||
),
|
||||
)
|
||||
.when(!self.description.is_empty(), |this| {
|
||||
this.child(
|
||||
div().text_base().child(self.description.clone()),
|
||||
)
|
||||
this.child(div().text_sm().child(self.description.clone()))
|
||||
}),
|
||||
)
|
||||
.child(comments_section(&self.store, root_id, &self.directory, cx))
|
||||
@@ -454,14 +538,17 @@ impl PullRequestDetailView {
|
||||
)),
|
||||
),
|
||||
)
|
||||
.child(sidebar_section(
|
||||
&self.store,
|
||||
root_id,
|
||||
&store.pull_requests,
|
||||
true,
|
||||
&self.directory,
|
||||
cx,
|
||||
))
|
||||
.child(
|
||||
v_flex()
|
||||
.w(px(240.))
|
||||
.h_full()
|
||||
.flex_none()
|
||||
.px_4()
|
||||
.pt_4()
|
||||
.border_l_1()
|
||||
.border_color(cx.theme().colors.border)
|
||||
.child(details),
|
||||
)
|
||||
.into_any_element()
|
||||
}
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ impl Render for UpdatePrDialog {
|
||||
.gap_3()
|
||||
.child(
|
||||
div()
|
||||
.text_base()
|
||||
.text_sm()
|
||||
.text_color(cx.theme().colors.muted_foreground)
|
||||
.child("Publish a new revision with the output of `git format-patch`."),
|
||||
)
|
||||
|
||||
@@ -406,7 +406,7 @@ impl Render for PullRequestsView {
|
||||
.w_full()
|
||||
.items_start()
|
||||
.gap_2()
|
||||
.child(h_flex().w_24().child(status_badge(status)))
|
||||
.child(h_flex().w_20().child(status_badge(status)))
|
||||
.child(
|
||||
v_flex()
|
||||
.flex_1()
|
||||
|
||||
@@ -61,19 +61,7 @@ pub fn open_repo_item(
|
||||
let store = cx.new(|cx| RepoStore::new(addr.clone(), hint.cloned(), cx));
|
||||
match item {
|
||||
RepoItem::Issue(issue_id) => {
|
||||
let id = SharedString::from(format!("issue:{issue_id}"));
|
||||
let store = store.clone();
|
||||
log_dropped(workspace.update(cx, |root, cx| {
|
||||
root.panels().update(cx, |panels, cx| {
|
||||
panels.open(
|
||||
PanelSlot::Main,
|
||||
id,
|
||||
move |_, cx| cx.new(|cx| IssueDetailView::new(store.clone(), issue_id, cx)),
|
||||
window,
|
||||
cx,
|
||||
)
|
||||
})
|
||||
}));
|
||||
IssueDetailView::open(workspace, store, issue_id, window, cx);
|
||||
}
|
||||
RepoItem::PullRequest(pr_id) => {
|
||||
let id = SharedString::from(format!("pr:{pr_id}"));
|
||||
|
||||
@@ -165,7 +165,7 @@ where
|
||||
T: Into<SharedString>,
|
||||
{
|
||||
div()
|
||||
.text_base()
|
||||
.text_sm()
|
||||
.w_full()
|
||||
.min_w_0()
|
||||
.child(value.into())
|
||||
@@ -217,7 +217,7 @@ fn maintainers(
|
||||
.overflow_hidden()
|
||||
.whitespace_nowrap()
|
||||
.text_ellipsis()
|
||||
.text_base()
|
||||
.text_sm()
|
||||
.child(name),
|
||||
)
|
||||
.into_any_element()
|
||||
@@ -244,7 +244,7 @@ fn list(id: &'static str, items: impl IntoIterator<Item = String>, cx: &App) ->
|
||||
.min_w_0()
|
||||
.whitespace_nowrap()
|
||||
.text_ellipsis()
|
||||
.text_base()
|
||||
.text_sm()
|
||||
.child(SharedString::from(middle_truncate(&item, 28, 16))),
|
||||
)
|
||||
.child(ClipboardButton::new(
|
||||
|
||||
@@ -41,7 +41,7 @@ impl Render for SyncErrorDialog {
|
||||
.title("Sync failed")
|
||||
.content(move |_, cx| {
|
||||
div()
|
||||
.text_base()
|
||||
.text_sm()
|
||||
.text_color(cx.theme().colors.muted_foreground)
|
||||
.child(message.clone())
|
||||
.into_any_element()
|
||||
@@ -88,7 +88,7 @@ impl Render for DeleteRepositoryDialog {
|
||||
.title("Delete repository")
|
||||
.content(|_, cx| {
|
||||
div()
|
||||
.text_base()
|
||||
.text_sm()
|
||||
.text_color(cx.theme().colors.muted_foreground)
|
||||
.child(WARNING)
|
||||
.into_any_element()
|
||||
|
||||
@@ -66,27 +66,27 @@ impl Render for ResetRemoteDialog {
|
||||
.gap_2()
|
||||
.child(
|
||||
div()
|
||||
.text_base()
|
||||
.text_sm()
|
||||
.text_color(cx.theme().colors.muted_foreground)
|
||||
.child(WARNING),
|
||||
)
|
||||
.when(!unreachable.is_empty(), |this| {
|
||||
this.child(
|
||||
div()
|
||||
.text_base()
|
||||
.text_sm()
|
||||
.text_color(cx.theme().ramps.destructive.base)
|
||||
.child(ERROR),
|
||||
)
|
||||
.children(unreachable.iter().map(|url| {
|
||||
div()
|
||||
.text_base()
|
||||
.text_sm()
|
||||
.font_family(cx.theme().mono_font)
|
||||
.child(url.clone())
|
||||
}))
|
||||
})
|
||||
.child(if deleted.is_empty() {
|
||||
div()
|
||||
.text_base()
|
||||
.text_sm()
|
||||
.text_color(cx.theme().colors.muted_foreground)
|
||||
.child("No server refs will be deleted.")
|
||||
.into_any_element()
|
||||
@@ -95,7 +95,7 @@ impl Render for ResetRemoteDialog {
|
||||
.gap_1()
|
||||
.children(deleted.iter().map(|name| {
|
||||
div()
|
||||
.text_base()
|
||||
.text_sm()
|
||||
.font_family(cx.theme().mono_font)
|
||||
.child(name.clone())
|
||||
}))
|
||||
|
||||
@@ -17,9 +17,9 @@ use ui::combobox::ComboboxState;
|
||||
use ui::common::{Sizable as _, StyledExt as _, h_flex, v_flex};
|
||||
use ui::icons::{Icon, IconRole};
|
||||
use ui::theme::ActiveTheme as _;
|
||||
use ui::tree::TreeItemSeed;
|
||||
|
||||
use super::RepoDetailView;
|
||||
use ui::tree::TreeItemSeed;
|
||||
|
||||
const GUTTER_WIDTH: f32 = 44.;
|
||||
pub const DIFF_ROW_HEIGHT: f32 = 20.;
|
||||
@@ -234,7 +234,7 @@ pub(super) fn fork_row(
|
||||
let row = h_flex()
|
||||
.gap_1()
|
||||
.min_w_0()
|
||||
.text_base()
|
||||
.text_sm()
|
||||
.text_color(cx.theme().colors.muted_foreground)
|
||||
.child(Icon::named(IconRole::GitBranch).small())
|
||||
.child(
|
||||
@@ -307,7 +307,7 @@ pub(super) fn bound_repo_label(
|
||||
h_flex()
|
||||
.flex_shrink_0()
|
||||
.gap_2()
|
||||
.text_base()
|
||||
.text_sm()
|
||||
.child("Initialized by")
|
||||
.text_color(cx.theme().colors.muted_foreground)
|
||||
.when_some(profile, |this, profile| {
|
||||
|
||||
@@ -1132,7 +1132,7 @@ impl RepoDetailView {
|
||||
.child(Spinner::new("repo-loading"))
|
||||
.child(
|
||||
div()
|
||||
.text_base()
|
||||
.text_sm()
|
||||
.text_color(cx.theme().colors.muted_foreground)
|
||||
.child(label),
|
||||
)
|
||||
|
||||
@@ -100,7 +100,7 @@ impl DialogProgress {
|
||||
pub fn error_row(error: &Option<SharedString>, cx: &App) -> Option<AnyElement> {
|
||||
error.as_ref().map(|message| {
|
||||
div()
|
||||
.text_base()
|
||||
.text_sm()
|
||||
.text_color(cx.theme().ramps.destructive.base)
|
||||
.child(message.clone())
|
||||
.into_any_element()
|
||||
@@ -121,14 +121,14 @@ pub fn push_steps_row(steps: &[PushStepStatus], cx: &App) -> Option<AnyElement>
|
||||
match status {
|
||||
PushStepStatus::Running(_) => h_flex()
|
||||
.gap_2()
|
||||
.text_base()
|
||||
.text_sm()
|
||||
.text_color(cx.theme().colors.muted_foreground)
|
||||
.child(Spinner::new("push-step"))
|
||||
.child(label)
|
||||
.into_any_element(),
|
||||
PushStepStatus::Done(_) => h_flex()
|
||||
.gap_2()
|
||||
.text_base()
|
||||
.text_sm()
|
||||
.text_color(cx.theme().colors.foreground)
|
||||
.child(
|
||||
Icon::named(IconRole::Check)
|
||||
@@ -139,7 +139,7 @@ pub fn push_steps_row(steps: &[PushStepStatus], cx: &App) -> Option<AnyElement>
|
||||
.into_any_element(),
|
||||
PushStepStatus::Failed(_, reason) => h_flex()
|
||||
.gap_2()
|
||||
.text_base()
|
||||
.text_sm()
|
||||
.text_color(cx.theme().ramps.destructive.base)
|
||||
.child(
|
||||
Icon::named(IconRole::Close)
|
||||
|
||||
@@ -232,7 +232,7 @@ impl RenderOnce for CopyRow {
|
||||
.overflow_hidden()
|
||||
.whitespace_nowrap()
|
||||
.text_ellipsis()
|
||||
.when(self.large_text, |text| text.text_base())
|
||||
.when(self.large_text, |text| text.text_sm())
|
||||
.when(!self.large_text, |text| {
|
||||
text.font_family(theme.mono_font).text_xs()
|
||||
})
|
||||
|
||||
@@ -373,7 +373,7 @@ impl<E: Styled> ControlSizing for E {
|
||||
Size::XSmall => self.text_xs(),
|
||||
Size::Small => self.text_xs(),
|
||||
Size::Medium => self.text_sm(),
|
||||
Size::Large => self.text_base(),
|
||||
Size::Large => self.text_sm(),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -127,7 +127,7 @@ impl RenderOnce for EmptyState {
|
||||
})
|
||||
.child(
|
||||
div()
|
||||
.text_base()
|
||||
.text_sm()
|
||||
.font_semibold()
|
||||
.text_color(foreground)
|
||||
.child(self.headline),
|
||||
|
||||
@@ -1432,7 +1432,7 @@ fn heading_row(
|
||||
.map(|frame| match level {
|
||||
MarkdownHeading::H1 => frame.text_xl().font_semibold(),
|
||||
MarkdownHeading::H2 => frame.text_lg().font_semibold(),
|
||||
MarkdownHeading::H3 => frame.text_base().font_semibold(),
|
||||
MarkdownHeading::H3 => frame.text_sm().font_semibold(),
|
||||
MarkdownHeading::H4 | MarkdownHeading::H5 | MarkdownHeading::H6 => {
|
||||
frame.text_sm().font_semibold()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user