feat: detect local grasp repositories #21

Merged
reya merged 8 commits from feat/detect-nip34 into master 2026-09-14 04:06:11 +00:00
Showing only changes of commit ec459d6507 - Show all commits
+26 -23
View File
@@ -2017,30 +2017,33 @@ pub(super) fn repo_display_name(store: &RepoStore) -> SharedString {
/// The owner and identifier a local repository is already bound to.
fn bound_repo_label(binding: &Nip34Binding, cx: &App) -> AnyElement {
let owner = binding
.owner
.and_then(|owner| owner.to_bech32().ok())
.map(|npub| middle_truncate(&npub, 12, 8))
.unwrap_or_else(|| "a NIP-34 coordinate".to_owned());
let store = ProfileStore::global(cx);
let profile = binding.owner.map(|pk| store.read(cx).get(&pk));
let mut label = v_flex().flex_shrink_0().items_end().gap_1().child(
div()
.text_xs()
.text_color(cx.theme().muted_foreground)
.child(SharedString::from(format!("Bound to {owner}"))),
);
if let Some(identifier) = binding.identifier.as_deref() {
label = label.child(
div()
.text_xs()
.font_semibold()
.text_color(cx.theme().muted_foreground)
.child(SharedString::from(identifier.to_owned())),
);
}
label.into_any_element()
h_flex()
.flex_shrink_0()
.gap_2()
.text_sm()
.child("Initialized by")
.text_color(cx.theme().muted_foreground)
.when_some(profile, |this, profile| {
this.child(
h_flex()
.gap_1()
.text_color(cx.theme().foreground)
.child(UserAvatar::new(profile.name()).picture(profile.picture()))
.child(profile.name()),
)
})
.when_some(binding.identifier.as_deref(), |this, ident| {
this.child(
div()
.text_xs()
.font_semibold()
.child(SharedString::from(format!("/{ident}"))),
)
})
.into_any_element()
}
impl BasePanel for RepoDetailView {