update
Rust / build (macos-latest, stable) (push) Canceled after 0s
Rust / build (ubuntu-latest, stable) (push) Canceled after 0s
Rust / build (windows-latest, stable) (push) Canceled after 0s
Rust / build (macos-latest, stable) (pull_request) Canceled after 0s
Rust / build (ubuntu-latest, stable) (pull_request) Canceled after 0s
Rust / build (windows-latest, stable) (pull_request) Canceled after 0s
Rust / build (macos-latest, stable) (push) Canceled after 0s
Rust / build (ubuntu-latest, stable) (push) Canceled after 0s
Rust / build (windows-latest, stable) (push) Canceled after 0s
Rust / build (macos-latest, stable) (pull_request) Canceled after 0s
Rust / build (ubuntu-latest, stable) (pull_request) Canceled after 0s
Rust / build (windows-latest, stable) (pull_request) Canceled after 0s
This commit is contained in:
@@ -16,7 +16,8 @@ use signed_state::{
|
||||
Backend, CheckoutsStore, LocalReposStore, Mirrors, Nip34Binding, RepoStore, SyncStatusDirectory,
|
||||
};
|
||||
use ui::alert::{Alert, AlertSeverity};
|
||||
use ui::common::{h_flex, v_flex};
|
||||
use ui::avatar::Avatar;
|
||||
use ui::common::{Sizable as _, h_flex, v_flex};
|
||||
use ui::icons::{Icon, IconRole};
|
||||
use ui::layout::panel::Panel;
|
||||
use ui::sidebar::{Sidebar, SidebarEntry};
|
||||
@@ -922,7 +923,51 @@ impl RepoDetailView {
|
||||
}
|
||||
}
|
||||
|
||||
impl Panel for RepoDetailView {}
|
||||
impl Panel for RepoDetailView {
|
||||
fn title(&self, cx: &App) -> SharedString {
|
||||
let store = self.store.read(cx);
|
||||
if let Some(name) = store.path.as_ref().and_then(|path| path.file_name()) {
|
||||
return SharedString::from(name.to_string_lossy().into_owned());
|
||||
}
|
||||
if let Some(announcement) = store.announcement.as_ref() {
|
||||
return announcement
|
||||
.name
|
||||
.as_deref()
|
||||
.map(SharedString::from)
|
||||
.unwrap_or_else(|| SharedString::from(announcement.id.clone()));
|
||||
}
|
||||
SharedString::from("Repository")
|
||||
}
|
||||
|
||||
fn prefix(&self, cx: &App) -> Option<AnyElement> {
|
||||
let store = self.store.read(cx);
|
||||
let key = match (store.announcement.as_ref(), store.path.as_ref()) {
|
||||
(Some(announcement), _) => SharedString::from(format!("repo:{}", announcement.addr())),
|
||||
(None, Some(path)) => SharedString::from(format!("repo-local:{}", path.display())),
|
||||
(None, None) => SharedString::from("repo"),
|
||||
};
|
||||
let owner = store
|
||||
.nip34
|
||||
.as_ref()
|
||||
.and_then(|binding| binding.owner)
|
||||
.or_else(|| {
|
||||
store
|
||||
.announcement
|
||||
.as_ref()
|
||||
.map(|announcement| announcement.owner)
|
||||
});
|
||||
let mut avatar = Avatar::new(key);
|
||||
if let Some(owner) = owner {
|
||||
let profile = self.directory.read(cx).profile(&owner, cx);
|
||||
avatar = avatar.name(profile.name()).picture(profile.picture());
|
||||
}
|
||||
Some(avatar.small().into_any_element())
|
||||
}
|
||||
|
||||
fn loading(&self, _cx: &App) -> bool {
|
||||
self.loading
|
||||
}
|
||||
}
|
||||
|
||||
impl Render for RepoDetailView {
|
||||
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||
|
||||
Reference in New Issue
Block a user