update copy button
This commit is contained in:
@@ -8,7 +8,7 @@ use dock::{BasePanel, DockArea, DockPlacement, Panel, PanelEvent, panel_handle};
|
||||
use gix::Repository;
|
||||
use gpui::prelude::*;
|
||||
use gpui::{
|
||||
Action, AnyElement, App, Context, Entity, EventEmitter, FocusHandle, Focusable,
|
||||
Action, AnyElement, App, ClipboardItem, Context, Entity, EventEmitter, FocusHandle, Focusable,
|
||||
PathPromptOptions, Pixels, Render, SharedString, Size, Subscription, Task, WeakEntity, Window,
|
||||
div, px, relative, size,
|
||||
};
|
||||
@@ -45,7 +45,7 @@ use browser::{
|
||||
};
|
||||
use commits::COMMIT_ROW_HEIGHT;
|
||||
use diff::CommitDiffView;
|
||||
use helpers::{TreeItemSeed, build_tree_items, is_markdown_path, tree_items};
|
||||
use helpers::{ShareTargets, TreeItemSeed, build_tree_items, is_markdown_path, tree_items};
|
||||
use issues::{IssuesView, open_new_issue_dialog};
|
||||
use pull_requests::{PullRequestsView, open_new_pull_request_dialog};
|
||||
|
||||
@@ -1044,6 +1044,7 @@ impl RepoDetailView {
|
||||
|
||||
let name = self.display_name(cx);
|
||||
let description = announcement.description();
|
||||
let share = ShareTargets::from_announcement(announcement);
|
||||
|
||||
let commits_count = self.all_commits.as_ref().map(|list| list.total);
|
||||
let worktree_empty = self.switching_ref || self.worktree.is_none();
|
||||
@@ -1091,7 +1092,7 @@ impl RepoDetailView {
|
||||
h_flex()
|
||||
.mt_2()
|
||||
.w_full()
|
||||
.gap_2()
|
||||
.gap_0p5()
|
||||
.child(
|
||||
div()
|
||||
.text_xs()
|
||||
@@ -1112,6 +1113,7 @@ impl RepoDetailView {
|
||||
.outline()
|
||||
.button(
|
||||
Button::new("issues-open")
|
||||
.icon(CustomIconName::GitIssueDone)
|
||||
.child(
|
||||
h_flex().gap_2().text_sm().child("Issues").child(
|
||||
Tag::secondary()
|
||||
@@ -1138,6 +1140,7 @@ impl RepoDetailView {
|
||||
.outline()
|
||||
.button(
|
||||
Button::new("prs-open")
|
||||
.icon(CustomIconName::GitPullRequest)
|
||||
.child(
|
||||
h_flex()
|
||||
.gap_2()
|
||||
@@ -1163,10 +1166,23 @@ impl RepoDetailView {
|
||||
}),
|
||||
)
|
||||
.child(
|
||||
Button::new("link")
|
||||
.icon(IconName::ExternalLink)
|
||||
.tooltip("Open in gitworkshop.dev")
|
||||
.secondary(),
|
||||
DropdownButton::new("share")
|
||||
.secondary()
|
||||
.button(
|
||||
Button::new("link")
|
||||
.icon(IconName::Copy)
|
||||
.tooltip("Copy ID")
|
||||
.secondary()
|
||||
.on_click({
|
||||
let naddr = share.naddr.clone();
|
||||
move |_, _, cx| {
|
||||
cx.write_to_clipboard(
|
||||
ClipboardItem::new_string(naddr.clone()),
|
||||
);
|
||||
}
|
||||
}),
|
||||
)
|
||||
.dropdown_menu(move |menu, _, _| share.menu(menu)),
|
||||
)
|
||||
.child(
|
||||
Button::new("clone")
|
||||
@@ -1330,8 +1346,6 @@ impl RepoDetailView {
|
||||
.into_any_element()
|
||||
}
|
||||
|
||||
/// Horizontal list of everyone who maintains the repository: the owner
|
||||
/// shown in full, and any additional maintainers as a compact overlapping avatar group.
|
||||
fn render_maintainers(&self, cx: &mut Context<Self>) -> AnyElement {
|
||||
let announcement = self.announcement(cx);
|
||||
let profile_store = ProfileStore::global(cx);
|
||||
@@ -1352,7 +1366,7 @@ impl RepoDetailView {
|
||||
.w_full()
|
||||
.gap_3()
|
||||
.child(
|
||||
Button::new("maintainers").ghost().child(
|
||||
Button::new("maintainers").compact().ghost().child(
|
||||
h_flex()
|
||||
.gap_2()
|
||||
.child(
|
||||
|
||||
Reference in New Issue
Block a user