fix: repo clond command visibility
This commit is contained in:
@@ -8,7 +8,6 @@ use gpui::{
|
|||||||
use signed_state::{Backend, Nip34Kind};
|
use signed_state::{Backend, Nip34Kind};
|
||||||
use ui::avatar::Avatar;
|
use ui::avatar::Avatar;
|
||||||
use ui::button::{Button, ButtonVariant};
|
use ui::button::{Button, ButtonVariant};
|
||||||
use ui::clipboard::ClipboardButton;
|
|
||||||
use ui::common::{Sizable, StyledExt as _, h_flex, v_flex};
|
use ui::common::{Sizable, StyledExt as _, h_flex, v_flex};
|
||||||
use ui::dropdown_menu::DropdownMenu;
|
use ui::dropdown_menu::DropdownMenu;
|
||||||
use ui::icons::{Icon, IconRole};
|
use ui::icons::{Icon, IconRole};
|
||||||
@@ -18,7 +17,9 @@ use ui::theme::ActiveTheme as _;
|
|||||||
use ui::tooltip::Tooltip;
|
use ui::tooltip::Tooltip;
|
||||||
use utils::relative_time_secs;
|
use utils::relative_time_secs;
|
||||||
|
|
||||||
use super::helpers::{bound_repo_label, clone_group, fork_row, nostr_clone_url, repo_display_name};
|
use super::helpers::{
|
||||||
|
bound_repo_label, clone_group, clone_row, fork_row, nostr_clone_url, repo_display_name,
|
||||||
|
};
|
||||||
use super::{RepoDetailView, actions, dialogs};
|
use super::{RepoDetailView, actions, dialogs};
|
||||||
|
|
||||||
impl RepoDetailView {
|
impl RepoDetailView {
|
||||||
@@ -150,13 +151,15 @@ impl RepoDetailView {
|
|||||||
.gap_4()
|
.gap_4()
|
||||||
.child(clone_group(
|
.child(clone_group(
|
||||||
"Clone with ngit",
|
"Clone with ngit",
|
||||||
"copy-ngit",
|
"copy-ngit".into(),
|
||||||
&ngit_for_popover,
|
&ngit_for_popover,
|
||||||
|
cx,
|
||||||
))
|
))
|
||||||
.child(clone_group(
|
.child(clone_group(
|
||||||
"Clone with nak",
|
"Clone with nak",
|
||||||
"copy-nak",
|
"copy-nak".into(),
|
||||||
&nak_for_popover,
|
&nak_for_popover,
|
||||||
|
cx,
|
||||||
))
|
))
|
||||||
.child(
|
.child(
|
||||||
v_flex()
|
v_flex()
|
||||||
@@ -164,21 +167,28 @@ impl RepoDetailView {
|
|||||||
.child(
|
.child(
|
||||||
div()
|
div()
|
||||||
.text_xs()
|
.text_xs()
|
||||||
.text_color(cx.theme().colors.muted_foreground)
|
.font_semibold()
|
||||||
.child("Grasp Servers"),
|
.child("Grasp Servers"),
|
||||||
)
|
)
|
||||||
.when(git_for_popover.is_empty(), |this| {
|
.when(git_for_popover.is_empty(), |this| {
|
||||||
this.child(
|
this.child(
|
||||||
div().text_xs().child("No git clone urls."),
|
div()
|
||||||
|
.text_xs()
|
||||||
|
.text_center()
|
||||||
|
.text_color(
|
||||||
|
cx.theme().colors.muted_foreground,
|
||||||
|
)
|
||||||
|
.child("No git clone urls."),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
.children(git_for_popover.iter().enumerate().map(
|
.children(git_for_popover.iter().enumerate().map(
|
||||||
|(ix, command)| {
|
|(ix, command)| {
|
||||||
ClipboardButton::new(
|
clone_row(
|
||||||
SharedString::from(format!(
|
SharedString::from(format!(
|
||||||
"copy-git-{ix}"
|
"copy-git-{ix}"
|
||||||
)),
|
)),
|
||||||
command.clone(),
|
command.clone().into(),
|
||||||
|
cx,
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
)),
|
)),
|
||||||
|
|||||||
@@ -52,11 +52,47 @@ pub(super) struct RepoData {
|
|||||||
pub(super) head_commit: Option<FileCommit>,
|
pub(super) head_commit: Option<FileCommit>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(super) fn clone_group(label: &str, id: &'static str, command: &SharedString) -> AnyElement {
|
pub(super) fn clone_group(
|
||||||
|
label: &str,
|
||||||
|
id: SharedString,
|
||||||
|
command: &SharedString,
|
||||||
|
cx: &App,
|
||||||
|
) -> AnyElement {
|
||||||
v_flex()
|
v_flex()
|
||||||
.gap_1()
|
.gap_1()
|
||||||
.child(div().text_xs().child(SharedString::from(label)))
|
.min_w_0()
|
||||||
.child(ClipboardButton::new(id, command.clone()))
|
.child(
|
||||||
|
div()
|
||||||
|
.text_xs()
|
||||||
|
.font_semibold()
|
||||||
|
.child(SharedString::from(label)),
|
||||||
|
)
|
||||||
|
.child(clone_row(id, command.clone(), cx))
|
||||||
|
.into_any_element()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// One copyable clone command with its text visible next to the copy icon.
|
||||||
|
pub(super) fn clone_row(id: SharedString, command: SharedString, cx: &App) -> AnyElement {
|
||||||
|
h_flex()
|
||||||
|
.h_8()
|
||||||
|
.px_2()
|
||||||
|
.gap_2()
|
||||||
|
.min_w_0()
|
||||||
|
.bg(cx.theme().colors.secondary)
|
||||||
|
.rounded(cx.theme().radius.control)
|
||||||
|
.text_color(cx.theme().colors.secondary_foreground)
|
||||||
|
.child(
|
||||||
|
div()
|
||||||
|
.flex_1()
|
||||||
|
.min_w_0()
|
||||||
|
.overflow_hidden()
|
||||||
|
.whitespace_nowrap()
|
||||||
|
.text_ellipsis()
|
||||||
|
.font_family(cx.theme().mono_font)
|
||||||
|
.text_xs()
|
||||||
|
.child(command.clone()),
|
||||||
|
)
|
||||||
|
.child(ClipboardButton::new(id, command).xsmall())
|
||||||
.into_any_element()
|
.into_any_element()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user