Update nostr-sdk and adapt to new EventBuilder API
Rust / build (macos-latest, stable) (push) Waiting to run
Rust / build (ubuntu-latest, stable) (push) Waiting to run
Rust / build (windows-latest, stable) (push) Waiting to run
Rust / build (macos-latest, stable) (pull_request) Waiting to run
Rust / build (ubuntu-latest, stable) (pull_request) Waiting to run
Rust / build (windows-latest, stable) (pull_request) Waiting to run

This commit is contained in:
2026-11-16 20:52:32 +07:00
parent fae72b7adb
commit ad6e00b4b9
15 changed files with 234 additions and 158 deletions
Generated
+37 -37
View File
@@ -932,7 +932,7 @@ dependencies = [
[[package]] [[package]]
name = "collections" name = "collections"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#99dd426cba792530d1b79ee0c4241c9076e7045f" source = "git+https://github.com/zed-industries/zed#d39178f6c9e6adeb68e7a0df0b2a5b7d7bd35877"
dependencies = [ dependencies = [
"gpui_util", "gpui_util",
"indexmap", "indexmap",
@@ -1341,7 +1341,7 @@ dependencies = [
[[package]] [[package]]
name = "derive_refineable" name = "derive_refineable"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#99dd426cba792530d1b79ee0c4241c9076e7045f" source = "git+https://github.com/zed-industries/zed#d39178f6c9e6adeb68e7a0df0b2a5b7d7bd35877"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -1579,7 +1579,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e35d6e78f4cebb90e51d543db8fe41528851d6deeef6ef21ebd4bfdc1e784776" checksum = "e35d6e78f4cebb90e51d543db8fe41528851d6deeef6ef21ebd4bfdc1e784776"
dependencies = [ dependencies = [
"libc", "libc",
"windows-sys 0.52.0", "windows-sys 0.61.2",
] ]
[[package]] [[package]]
@@ -2391,7 +2391,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7518b930f6aeb75e871d32ce873c2ae46e35cef19b5a0b039d4337f651d897cd" checksum = "7518b930f6aeb75e871d32ce873c2ae46e35cef19b5a0b039d4337f651d897cd"
dependencies = [ dependencies = [
"bstr", "bstr",
"hashbrown 0.16.1", "hashbrown 0.17.1",
] ]
[[package]] [[package]]
@@ -2988,7 +2988,7 @@ dependencies = [
[[package]] [[package]]
name = "gpui" name = "gpui"
version = "0.2.2" version = "0.2.2"
source = "git+https://github.com/zed-industries/zed#99dd426cba792530d1b79ee0c4241c9076e7045f" source = "git+https://github.com/zed-industries/zed#d39178f6c9e6adeb68e7a0df0b2a5b7d7bd35877"
dependencies = [ dependencies = [
"accesskit", "accesskit",
"anyhow", "anyhow",
@@ -3167,7 +3167,7 @@ dependencies = [
[[package]] [[package]]
name = "gpui_apple" name = "gpui_apple"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#053d91cb14b5fd138f221ec02bd76efb15e7b2af" source = "git+https://github.com/zed-industries/zed#d39178f6c9e6adeb68e7a0df0b2a5b7d7bd35877"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"async-task", "async-task",
@@ -3206,7 +3206,7 @@ dependencies = [
[[package]] [[package]]
name = "gpui_ios" name = "gpui_ios"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#053d91cb14b5fd138f221ec02bd76efb15e7b2af" source = "git+https://github.com/zed-industries/zed#d39178f6c9e6adeb68e7a0df0b2a5b7d7bd35877"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"block2 0.6.2", "block2 0.6.2",
@@ -3227,7 +3227,7 @@ dependencies = [
[[package]] [[package]]
name = "gpui_linux" name = "gpui_linux"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#053d91cb14b5fd138f221ec02bd76efb15e7b2af" source = "git+https://github.com/zed-industries/zed#d39178f6c9e6adeb68e7a0df0b2a5b7d7bd35877"
dependencies = [ dependencies = [
"accesskit", "accesskit",
"anyhow", "anyhow",
@@ -3254,7 +3254,7 @@ dependencies = [
[[package]] [[package]]
name = "gpui_macos" name = "gpui_macos"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#053d91cb14b5fd138f221ec02bd76efb15e7b2af" source = "git+https://github.com/zed-industries/zed#d39178f6c9e6adeb68e7a0df0b2a5b7d7bd35877"
dependencies = [ dependencies = [
"accesskit", "accesskit",
"accesskit_macos", "accesskit_macos",
@@ -3295,7 +3295,7 @@ dependencies = [
[[package]] [[package]]
name = "gpui_macros" name = "gpui_macros"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#99dd426cba792530d1b79ee0c4241c9076e7045f" source = "git+https://github.com/zed-industries/zed#d39178f6c9e6adeb68e7a0df0b2a5b7d7bd35877"
dependencies = [ dependencies = [
"heck 0.5.0", "heck 0.5.0",
"proc-macro2", "proc-macro2",
@@ -3306,7 +3306,7 @@ dependencies = [
[[package]] [[package]]
name = "gpui_platform" name = "gpui_platform"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#053d91cb14b5fd138f221ec02bd76efb15e7b2af" source = "git+https://github.com/zed-industries/zed#d39178f6c9e6adeb68e7a0df0b2a5b7d7bd35877"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"console_error_panic_hook", "console_error_panic_hook",
@@ -3321,7 +3321,7 @@ dependencies = [
[[package]] [[package]]
name = "gpui_shared_string" name = "gpui_shared_string"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#99dd426cba792530d1b79ee0c4241c9076e7045f" source = "git+https://github.com/zed-industries/zed#d39178f6c9e6adeb68e7a0df0b2a5b7d7bd35877"
dependencies = [ dependencies = [
"schemars", "schemars",
"serde", "serde",
@@ -3331,7 +3331,7 @@ dependencies = [
[[package]] [[package]]
name = "gpui_util" name = "gpui_util"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#99dd426cba792530d1b79ee0c4241c9076e7045f" source = "git+https://github.com/zed-industries/zed#d39178f6c9e6adeb68e7a0df0b2a5b7d7bd35877"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"log", "log",
@@ -3341,7 +3341,7 @@ dependencies = [
[[package]] [[package]]
name = "gpui_web" name = "gpui_web"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#053d91cb14b5fd138f221ec02bd76efb15e7b2af" source = "git+https://github.com/zed-industries/zed#d39178f6c9e6adeb68e7a0df0b2a5b7d7bd35877"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"async-channel", "async-channel",
@@ -3370,7 +3370,7 @@ dependencies = [
[[package]] [[package]]
name = "gpui_wgpu" name = "gpui_wgpu"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#053d91cb14b5fd138f221ec02bd76efb15e7b2af" source = "git+https://github.com/zed-industries/zed#d39178f6c9e6adeb68e7a0df0b2a5b7d7bd35877"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"bytemuck", "bytemuck",
@@ -3396,7 +3396,7 @@ dependencies = [
[[package]] [[package]]
name = "gpui_windows" name = "gpui_windows"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#053d91cb14b5fd138f221ec02bd76efb15e7b2af" source = "git+https://github.com/zed-industries/zed#d39178f6c9e6adeb68e7a0df0b2a5b7d7bd35877"
dependencies = [ dependencies = [
"accesskit", "accesskit",
"accesskit_windows", "accesskit_windows",
@@ -3662,7 +3662,7 @@ dependencies = [
[[package]] [[package]]
name = "http_client" name = "http_client"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#99dd426cba792530d1b79ee0c4241c9076e7045f" source = "git+https://github.com/zed-industries/zed#d39178f6c9e6adeb68e7a0df0b2a5b7d7bd35877"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"bytes", "bytes",
@@ -3679,7 +3679,7 @@ dependencies = [
[[package]] [[package]]
name = "http_client_tls" name = "http_client_tls"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#053d91cb14b5fd138f221ec02bd76efb15e7b2af" source = "git+https://github.com/zed-industries/zed#d39178f6c9e6adeb68e7a0df0b2a5b7d7bd35877"
dependencies = [ dependencies = [
"log", "log",
"rustls", "rustls",
@@ -4730,7 +4730,7 @@ checksum = "0676bb32a98c1a483ce53e500a81ad9c3d5b3f7c920c28c24e9cb0980d0b5bc8"
[[package]] [[package]]
name = "nostr" name = "nostr"
version = "0.45.7" version = "0.45.7"
source = "git+https://github.com/rust-nostr/nostr#4904ffb85f60178375a1dda659a61793f36f03b8" source = "git+https://github.com/rust-nostr/nostr#8bb69e55bc8b5c6a52ffd09441824e65edb2e235"
dependencies = [ dependencies = [
"aes", "aes",
"base64 0.22.1", "base64 0.22.1",
@@ -4755,8 +4755,8 @@ dependencies = [
[[package]] [[package]]
name = "nostr-connect" name = "nostr-connect"
version = "0.45.2" version = "0.45.3"
source = "git+https://github.com/rust-nostr/nostr#4904ffb85f60178375a1dda659a61793f36f03b8" source = "git+https://github.com/rust-nostr/nostr#8bb69e55bc8b5c6a52ffd09441824e65edb2e235"
dependencies = [ dependencies = [
"async-utility", "async-utility",
"nostr", "nostr",
@@ -4769,7 +4769,7 @@ dependencies = [
[[package]] [[package]]
name = "nostr-database" name = "nostr-database"
version = "0.45.2" version = "0.45.2"
source = "git+https://github.com/rust-nostr/nostr#4904ffb85f60178375a1dda659a61793f36f03b8" source = "git+https://github.com/rust-nostr/nostr#8bb69e55bc8b5c6a52ffd09441824e65edb2e235"
dependencies = [ dependencies = [
"nostr", "nostr",
"opaquerr", "opaquerr",
@@ -4778,7 +4778,7 @@ dependencies = [
[[package]] [[package]]
name = "nostr-gossip" name = "nostr-gossip"
version = "0.45.1" version = "0.45.1"
source = "git+https://github.com/rust-nostr/nostr#4904ffb85f60178375a1dda659a61793f36f03b8" source = "git+https://github.com/rust-nostr/nostr#8bb69e55bc8b5c6a52ffd09441824e65edb2e235"
dependencies = [ dependencies = [
"nostr", "nostr",
"opaquerr", "opaquerr",
@@ -4787,7 +4787,7 @@ dependencies = [
[[package]] [[package]]
name = "nostr-gossip-memory" name = "nostr-gossip-memory"
version = "0.45.1" version = "0.45.1"
source = "git+https://github.com/rust-nostr/nostr#4904ffb85f60178375a1dda659a61793f36f03b8" source = "git+https://github.com/rust-nostr/nostr#8bb69e55bc8b5c6a52ffd09441824e65edb2e235"
dependencies = [ dependencies = [
"indexmap", "indexmap",
"lru", "lru",
@@ -4799,7 +4799,7 @@ dependencies = [
[[package]] [[package]]
name = "nostr-lmdb" name = "nostr-lmdb"
version = "0.45.3" version = "0.45.3"
source = "git+https://github.com/rust-nostr/nostr#4904ffb85f60178375a1dda659a61793f36f03b8" source = "git+https://github.com/rust-nostr/nostr#8bb69e55bc8b5c6a52ffd09441824e65edb2e235"
dependencies = [ dependencies = [
"async-utility", "async-utility",
"flatbuffers", "flatbuffers",
@@ -4814,7 +4814,7 @@ dependencies = [
[[package]] [[package]]
name = "nostr-sdk" name = "nostr-sdk"
version = "0.45.6" version = "0.45.6"
source = "git+https://github.com/rust-nostr/nostr#4904ffb85f60178375a1dda659a61793f36f03b8" source = "git+https://github.com/rust-nostr/nostr#8bb69e55bc8b5c6a52ffd09441824e65edb2e235"
dependencies = [ dependencies = [
"async-utility", "async-utility",
"async-wsocket", "async-wsocket",
@@ -5905,7 +5905,7 @@ dependencies = [
"once_cell", "once_cell",
"socket2", "socket2",
"tracing", "tracing",
"windows-sys 0.52.0", "windows-sys 0.61.2",
] ]
[[package]] [[package]]
@@ -6178,7 +6178,7 @@ dependencies = [
[[package]] [[package]]
name = "refineable" name = "refineable"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#99dd426cba792530d1b79ee0c4241c9076e7045f" source = "git+https://github.com/zed-industries/zed#d39178f6c9e6adeb68e7a0df0b2a5b7d7bd35877"
dependencies = [ dependencies = [
"derive_refineable", "derive_refineable",
] ]
@@ -6261,7 +6261,7 @@ dependencies = [
[[package]] [[package]]
name = "reqwest_client" name = "reqwest_client"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#053d91cb14b5fd138f221ec02bd76efb15e7b2af" source = "git+https://github.com/zed-industries/zed#d39178f6c9e6adeb68e7a0df0b2a5b7d7bd35877"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"bytes", "bytes",
@@ -6403,7 +6403,7 @@ dependencies = [
"errno", "errno",
"libc", "libc",
"linux-raw-sys", "linux-raw-sys",
"windows-sys 0.52.0", "windows-sys 0.61.2",
] ]
[[package]] [[package]]
@@ -6471,7 +6471,7 @@ dependencies = [
"security-framework", "security-framework",
"security-framework-sys", "security-framework-sys",
"webpki-root-certs", "webpki-root-certs",
"windows-sys 0.52.0", "windows-sys 0.61.2",
] ]
[[package]] [[package]]
@@ -6553,7 +6553,7 @@ dependencies = [
[[package]] [[package]]
name = "scheduler" name = "scheduler"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#99dd426cba792530d1b79ee0c4241c9076e7045f" source = "git+https://github.com/zed-industries/zed#d39178f6c9e6adeb68e7a0df0b2a5b7d7bd35877"
dependencies = [ dependencies = [
"async-task", "async-task",
"backtrace", "backtrace",
@@ -7179,7 +7179,7 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
[[package]] [[package]]
name = "sum_tree" name = "sum_tree"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#99dd426cba792530d1b79ee0c4241c9076e7045f" source = "git+https://github.com/zed-industries/zed#d39178f6c9e6adeb68e7a0df0b2a5b7d7bd35877"
dependencies = [ dependencies = [
"heapless 0.9.3", "heapless 0.9.3",
"rayon", "rayon",
@@ -7347,7 +7347,7 @@ dependencies = [
"getrandom 0.4.3", "getrandom 0.4.3",
"once_cell", "once_cell",
"rustix", "rustix",
"windows-sys 0.52.0", "windows-sys 0.61.2",
] ]
[[package]] [[package]]
@@ -8540,7 +8540,7 @@ version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
dependencies = [ dependencies = [
"windows-sys 0.52.0", "windows-sys 0.61.2",
] ]
[[package]] [[package]]
@@ -9468,7 +9468,7 @@ dependencies = [
[[package]] [[package]]
name = "ztracing" name = "ztracing"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#99dd426cba792530d1b79ee0c4241c9076e7045f" source = "git+https://github.com/zed-industries/zed#d39178f6c9e6adeb68e7a0df0b2a5b7d7bd35877"
dependencies = [ dependencies = [
"tracing", "tracing",
"ztracing_macro", "ztracing_macro",
@@ -9477,7 +9477,7 @@ dependencies = [
[[package]] [[package]]
name = "ztracing_macro" name = "ztracing_macro"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#99dd426cba792530d1b79ee0c4241c9076e7045f" source = "git+https://github.com/zed-industries/zed#d39178f6c9e6adeb68e7a0df0b2a5b7d7bd35877"
[[package]] [[package]]
name = "zune-core" name = "zune-core"
+11 -7
View File
@@ -36,7 +36,7 @@ pub struct AppRoot {
impl AppRoot { impl AppRoot {
pub fn new(window: &mut Window, cx: &mut Context<Self>) -> Self { pub fn new(window: &mut Window, cx: &mut Context<Self>) -> Self {
let workspace = cx.new(|_| Workspace::new()); let workspace = cx.new(|_| Workspace::new());
let titlebar = cx.new(|cx| TitlebarView::new(workspace.downgrade(), cx)); let titlebar = cx.new(|cx| TitlebarView::new(workspace.downgrade(), window, cx));
let toasts = cx.new(|_| Toasts::default()); let toasts = cx.new(|_| Toasts::default());
let sign_in = cx.new(|_| SignedOutView::new()); let sign_in = cx.new(|_| SignedOutView::new());
let empty = cx.new(|_| PlaceholderView::new("Select a repository")); let empty = cx.new(|_| PlaceholderView::new("Select a repository"));
@@ -94,14 +94,14 @@ impl Render for AppRoot {
let titlebar_view = self.titlebar.read(cx); let titlebar_view = self.titlebar.read(cx);
let mut titlebar = Titlebar::new("signed-titlebar"); let mut titlebar = Titlebar::new("signed-titlebar");
if let Some(menu) = titlebar_view.render_user_menu(cx) { if let Some(actions) = titlebar_view.render_actions(cx) {
titlebar = titlebar.child(menu); titlebar = titlebar.child(actions);
} }
if let Some(tabs) = titlebar_view.render_tabs(cx) { if let Some(tabs) = titlebar_view.render_tabs(cx) {
titlebar = titlebar.tab_bar(tabs); titlebar = titlebar.tab_bar(tabs);
} }
if let Some(actions) = titlebar_view.render_actions(cx) { if let Some(menu) = titlebar_view.render_user_menu(cx) {
titlebar = titlebar.suffix(actions); titlebar = titlebar.suffix(menu);
} }
let workspace = self.workspace.read(cx); let workspace = self.workspace.read(cx);
@@ -118,7 +118,7 @@ impl Render for AppRoot {
row = row.main(self.sign_in.clone()); row = row.main(self.sign_in.clone());
} }
div() let mut root = div()
.relative() .relative()
.size_full() .size_full()
.font_family(".SystemUIFont") .font_family(".SystemUIFont")
@@ -130,6 +130,10 @@ impl Render for AppRoot {
.transparent(true) .transparent(true)
.toasts(self.toasts.clone()), .toasts(self.toasts.clone()),
) )
.child(self.dialogs.clone()) .child(self.dialogs.clone());
if is_signed_in {
root = root.child(titlebar_view.palette());
}
root
} }
} }
+81 -79
View File
@@ -168,7 +168,7 @@ impl RepoDetailView {
.child( .child(
div() div()
.min_w_0() .min_w_0()
.typeset(TextRole::Body, cx) .typeset(TextRole::Callout, cx)
.text_color(cx.theme().colors.muted_foreground) .text_color(cx.theme().colors.muted_foreground)
.line_clamp(3) .line_clamp(3)
.child(description), .child(description),
@@ -180,79 +180,6 @@ impl RepoDetailView {
.flex_none() .flex_none()
.gap_2() .gap_2()
.justify_end() .justify_end()
.child(
DropdownMenu::new("repo-menu")
.variant(ButtonVariant::Secondary)
.loading(pushing)
.disabled(pushing)
.open(self.repo_menu_open)
.on_open_change(move |open, _, cx| {
if let Err(error) = weak_menu_open.update(cx, |this, cx| {
this.repo_menu_open = open;
cx.notify();
}) {
log::warn!("failed to update repo menu: {error}");
}
})
.items(move |_, cx| {
let owner = backend.read(cx).current_user()
== Some(announcement_for_menu.owner);
let mut items = vec![MenuItem::new("About").handler({
let weak = weak_menu_items.clone();
let announcement = announcement_for_menu.clone();
move |_, cx| {
if let Err(error) = weak.update(cx, |this, cx| {
dialogs::about::open(
announcement.clone(),
this.directory.clone(),
cx,
);
}) {
log::warn!("failed to open about: {error}");
}
}
})];
if owner {
items.push(MenuItem::new("Republish").handler({
let weak = weak_menu_items.clone();
move |window, cx| {
if let Err(error) = weak.update(cx, |this, cx| {
this.push_repository(window, cx);
}) {
log::warn!("failed to republish: {error}");
}
}
}));
items.push(MenuItem::new("Reset remote to local").handler({
let weak = weak_menu_items.clone();
move |window, cx| {
if let Err(error) = weak.update(cx, |this, cx| {
this.reset_remote(window, cx);
}) {
log::warn!("failed to reset remote: {error}");
}
}
}));
items.push(MenuItem::separator());
items.push(MenuItem::new("Delete").destructive(true).handler(
{
let weak = weak_menu_items.clone();
move |window, cx| {
if let Err(error) = weak.update(cx, |this, cx| {
this.delete_repository(window, cx);
}) {
log::warn!("failed to delete: {error}");
}
}
},
));
}
items
}),
)
.when_some(self.render_sync_button(cx), |this, button| { .when_some(self.render_sync_button(cx), |this, button| {
this.child(button) this.child(button)
}) })
@@ -341,6 +268,79 @@ impl RepoDetailView {
) )
.into_any_element() .into_any_element()
}), }),
)
.child(
DropdownMenu::new("repo-menu")
.icon(CustomIconName::EllipsisVertical)
.variant(ButtonVariant::Ghost)
.disabled(pushing)
.open(self.repo_menu_open)
.on_open_change(move |open, _, cx| {
if let Err(error) = weak_menu_open.update(cx, |this, cx| {
this.repo_menu_open = open;
cx.notify();
}) {
log::warn!("failed to update repo menu: {error}");
}
})
.items(move |_, cx| {
let owner = backend.read(cx).current_user()
== Some(announcement_for_menu.owner);
let mut items = vec![MenuItem::new("About").handler({
let weak = weak_menu_items.clone();
let announcement = announcement_for_menu.clone();
move |_, cx| {
if let Err(error) = weak.update(cx, |this, cx| {
dialogs::about::open(
announcement.clone(),
this.directory.clone(),
cx,
);
}) {
log::warn!("failed to open about: {error}");
}
}
})];
if owner {
items.push(MenuItem::new("Republish").handler({
let weak = weak_menu_items.clone();
move |window, cx| {
if let Err(error) = weak.update(cx, |this, cx| {
this.push_repository(window, cx);
}) {
log::warn!("failed to republish: {error}");
}
}
}));
items.push(MenuItem::new("Reset remote to local").handler({
let weak = weak_menu_items.clone();
move |window, cx| {
if let Err(error) = weak.update(cx, |this, cx| {
this.reset_remote(window, cx);
}) {
log::warn!("failed to reset remote: {error}");
}
}
}));
items.push(MenuItem::separator());
items.push(MenuItem::new("Delete").destructive(true).handler(
{
let weak = weak_menu_items.clone();
move |window, cx| {
if let Err(error) = weak.update(cx, |this, cx| {
this.delete_repository(window, cx);
}) {
log::warn!("failed to delete: {error}");
}
}
},
));
}
items
}),
), ),
) )
.into_any_element() .into_any_element()
@@ -365,7 +365,7 @@ impl RepoDetailView {
v_flex() v_flex()
.flex_none() .flex_none()
.p_6() .p_6()
.h_24() .h_32()
.w_full() .w_full()
.items_center() .items_center()
.justify_center() .justify_center()
@@ -374,8 +374,7 @@ impl RepoDetailView {
Some(binding) => this.child(bound_repo_label(binding, &self.directory, cx)), Some(binding) => this.child(bound_repo_label(binding, &self.directory, cx)),
None => this.child( None => this.child(
Button::new("init") Button::new("init")
.icon(Icon::named(CustomIconName::Init)) .icon(Icon::named(CustomIconName::ArrowUp))
.large()
.label("Initialize on Nostr") .label("Initialize on Nostr")
.tooltip(Tooltip::text("Publish this repository to Nostr")) .tooltip(Tooltip::text("Publish this repository to Nostr"))
.on_click(cx.listener(|this, _, window, cx| { .on_click(cx.listener(|this, _, window, cx| {
@@ -456,11 +455,13 @@ impl RepoDetailView {
_ => None, _ => None,
}) })
.max_by_key(|(_, ahead)| *ahead)?; .max_by_key(|(_, ahead)| *ahead)?;
let commits = if ahead == 1 { let commits = if ahead == 1 {
"1 commit".to_owned() "1 commit".to_owned()
} else { } else {
format!("{ahead} commits") format!("{ahead} commits")
}; };
let path = checkout.path.clone(); let path = checkout.path.clone();
( (
Icon::named(IconRole::Refresh), Icon::named(IconRole::Refresh),
@@ -583,11 +584,12 @@ impl RepoDetailView {
.gap_2() .gap_2()
.child( .child(
h_flex() h_flex()
.gap_1() .gap_2()
.child( .child(
Avatar::new(announcement.owner) Avatar::new(announcement.owner)
.name(owner_name.clone()) .name(owner_name.clone())
.picture(owner.picture()), .picture(owner.picture())
.small(),
) )
.child( .child(
div() div()
+1
View File
@@ -869,6 +869,7 @@ impl RepoDetailView {
Sidebar::new("repo-sidebar") Sidebar::new("repo-sidebar")
.selected(selected) .selected(selected)
.border_right(true) .border_right(true)
.transparent(false)
.on_change(move |index, _, cx| { .on_change(move |index, _, cx| {
let section = match (index, include_issues) { let section = match (index, include_issues) {
(Some(0), _) => RepoSection::Commits, (Some(0), _) => RepoSection::Commits,
+82 -19
View File
@@ -6,6 +6,7 @@ use gpui::{
}; };
use gpui_native_kit::avatar::Avatar; use gpui_native_kit::avatar::Avatar;
use gpui_native_kit::button::{Button, ButtonVariant}; use gpui_native_kit::button::{Button, ButtonVariant};
use gpui_native_kit::command_palette::{Command, CommandPalette, CommandPaletteState};
use gpui_native_kit::common::{Sizable as _, h_flex}; use gpui_native_kit::common::{Sizable as _, h_flex};
use gpui_native_kit::data::tabs::{Tab, Tabs, TabsVariant}; use gpui_native_kit::data::tabs::{Tab, Tabs, TabsVariant};
use gpui_native_kit::icons::{Icon, IconRole}; use gpui_native_kit::icons::{Icon, IconRole};
@@ -28,19 +29,24 @@ mod helpers;
pub struct TitlebarView { pub struct TitlebarView {
weak: WeakEntity<Self>, weak: WeakEntity<Self>,
workspace: WeakEntity<Workspace>, workspace: WeakEntity<Workspace>,
scanning: bool,
/// User's announced repositories. /// User's announced repositories.
announcements: Arc<Vec<Announcement>>, announcements: Arc<Vec<Announcement>>,
/// Local repositories found by the scan that are not announced yet. /// Local repositories found by the scan that are not announced yet.
local_repos: Arc<Vec<ResolvedLocalRepo>>, local_repos: Arc<Vec<ResolvedLocalRepo>>,
/// Profiles rendered by the titlebar tabs. /// Profiles rendered by the titlebar tabs.
directory: gpui::Entity<ProfileDirectory>, directory: gpui::Entity<ProfileDirectory>,
/// The command palette opened from the titlebar.
palette: gpui::Entity<CommandPaletteState>,
user_menu_open: bool, user_menu_open: bool,
_subscriptions: Vec<Subscription>, _subscriptions: Vec<Subscription>,
} }
impl TitlebarView { impl TitlebarView {
pub fn new(workspace: WeakEntity<Workspace>, cx: &mut Context<Self>) -> Self { pub fn new(
workspace: WeakEntity<Workspace>,
window: &mut Window,
cx: &mut Context<Self>,
) -> Self {
let backend = Backend::global(cx); let backend = Backend::global(cx);
let repos = RepoListStore::global(cx); let repos = RepoListStore::global(cx);
let local = LocalReposStore::global(cx); let local = LocalReposStore::global(cx);
@@ -68,25 +74,84 @@ impl TitlebarView {
} }
})); }));
let mut this = Self { let palette = Self::new_palette(workspace.clone(), window, cx);
weak: cx.entity().downgrade(),
let entity = cx.entity();
let this = Self {
weak: entity.downgrade(),
workspace, workspace,
scanning: false,
announcements: Arc::new(Vec::new()), announcements: Arc::new(Vec::new()),
local_repos: Arc::new(Vec::new()), local_repos: Arc::new(Vec::new()),
directory: ProfileDirectory::new(cx), directory: ProfileDirectory::new(cx),
palette,
user_menu_open: false, user_menu_open: false,
_subscriptions: subscriptions, _subscriptions: subscriptions,
}; };
this.refresh(cx);
cx.defer(move |cx| {
entity.update(cx, |this, cx| {
if this.refresh(cx) {
cx.notify();
}
});
});
this this
} }
fn new_palette(
workspace: WeakEntity<Workspace>,
window: &mut Window,
cx: &mut Context<Self>,
) -> gpui::Entity<CommandPaletteState> {
cx.new(|cx| {
let matcher = |query: &str, commands: &[Command]| {
let needle = query.to_lowercase();
commands
.iter()
.filter(|command| command.label.to_lowercase().contains(&needle))
.cloned()
.collect()
};
CommandPaletteState::new(
CommandPalette::new("signed-command-palette", Self::palette_commands(), matcher)
.on_execute(move |command, window, cx| match command.id.as_ref() {
"create-repo" => dialogs::create::open(workspace.clone(), window, cx),
"rescan-repos" => {
let local_repos = LocalReposStore::global(cx);
local_repos.update(cx, |store, cx| store.rescan(cx));
}
"open-settings" => settings::open(cx),
"exit" => identity::helpers::open_exit(cx),
_ => {}
}),
window,
cx,
)
})
}
fn palette_commands() -> Vec<Command> {
vec![
Command::new("create-repo", "Create repository").icon(Icon::named(IconRole::Plus)),
Command::new("rescan-repos", "Rescan for local repositories")
.icon(Icon::named(IconRole::Refresh)),
Command::new("open-settings", "Settings").icon(Icon::named(IconRole::Settings)),
Command::new("exit", "Exit"),
]
}
pub fn palette(&self) -> gpui::Entity<CommandPaletteState> {
self.palette.clone()
}
fn refresh(&mut self, cx: &mut Context<Self>) -> bool { fn refresh(&mut self, cx: &mut Context<Self>) -> bool {
let backend = Backend::global(cx); let backend = Backend::global(cx);
let user = backend.read(cx).current_user(); let user = backend.read(cx).current_user();
let (announcements, local_repos, scanning) = { let (announcements, local_repos) = {
let repo_list = RepoListStore::global(cx).read(cx); let repo_list = RepoListStore::global(cx).read(cx);
let announcements = user let announcements = user
@@ -98,16 +163,14 @@ impl TitlebarView {
let local_repos = let local_repos =
LocalReposStore::resolve(&local.repos, &repo_list.announcements, &announcements); LocalReposStore::resolve(&local.repos, &repo_list.announcements, &announcements);
(announcements, local_repos, local.scanning) (announcements, local_repos)
}; };
let announcements_changed = *self.announcements != announcements; let announcements_changed = *self.announcements != announcements;
let local_changed = *self.local_repos != local_repos; let local_changed = *self.local_repos != local_repos;
let scanning_changed = self.scanning != scanning;
self.announcements = Arc::new(announcements); self.announcements = Arc::new(announcements);
self.local_repos = Arc::new(local_repos); self.local_repos = Arc::new(local_repos);
self.scanning = scanning;
let mut profiles: Vec<PublicKey> = user.into_iter().collect(); let mut profiles: Vec<PublicKey> = user.into_iter().collect();
let owners: Vec<PublicKey> = self let owners: Vec<PublicKey> = self
@@ -128,7 +191,7 @@ impl TitlebarView {
directory.track(profiles, cx); directory.track(profiles, cx);
}); });
announcements_changed || local_changed || scanning_changed announcements_changed || local_changed
} }
pub fn render_tabs(&self, cx: &App) -> Option<Tabs> { pub fn render_tabs(&self, cx: &App) -> Option<Tabs> {
@@ -348,15 +411,15 @@ impl TitlebarView {
h_flex() h_flex()
.gap_1() .gap_1()
.child( .child(
Button::new("rescan-repos") Button::new("open-command-palette")
.icon(Icon::named(IconRole::Loader)) .icon(Icon::named(IconRole::Search))
.variant(ButtonVariant::Ghost) .variant(ButtonVariant::Ghost)
.loading(self.scanning) .tooltip(Tooltip::text("Command palette"))
.disabled(self.scanning) .on_click({
.tooltip(Tooltip::text("Rescan for local repositories")) let palette = self.palette.clone();
.on_click(|_, _, cx| { move |_, window, cx| {
let local_repos = LocalReposStore::global(cx); palette.update(cx, |palette, cx| palette.toggle(window, cx));
local_repos.update(cx, |store, cx| store.rescan(cx)); }
}), }),
) )
.child( .child(
+2 -2
View File
@@ -171,7 +171,7 @@ mod tests {
.map(|t| Tag::parse(t.to_vec()).expect("valid tag")) .map(|t| Tag::parse(t.to_vec()).expect("valid tag"))
.collect(); .collect();
EventBuilder::new(Kind::GitRepoAnnouncement, "") EventBuilder::new(Kind::GitRepoAnnouncement)
.tags(tags) .tags(tags)
.finalize(&keys()) .finalize(&keys())
.expect("signed event") .expect("signed event")
@@ -375,7 +375,7 @@ mod tests {
.iter() .iter()
.map(|t| Tag::parse(t.to_vec()).expect("valid tag")) .map(|t| Tag::parse(t.to_vec()).expect("valid tag"))
.collect(); .collect();
EventBuilder::new(Kind::GitRepoAnnouncement, "") EventBuilder::new(Kind::GitRepoAnnouncement)
.tags(tags) .tags(tags)
.finalize(&keys) .finalize(&keys)
.expect("signed event") .expect("signed event")
+1 -1
View File
@@ -182,7 +182,7 @@ mod tests {
} }
fn signed(author: &Keys, kind: Kind, tags: Vec<Tag>) -> Event { fn signed(author: &Keys, kind: Kind, tags: Vec<Tag>) -> Event {
EventBuilder::new(kind, "") EventBuilder::new(kind)
.tags(tags) .tags(tags)
.finalize(author) .finalize(author)
.expect("signed event") .expect("signed event")
+1 -1
View File
@@ -90,7 +90,7 @@ mod tests {
/// Builds a signed event with a fixed timestamp. /// Builds a signed event with a fixed timestamp.
fn signed(author: &Keys, kind: Kind, tags: Vec<Tag>, created_at: u64) -> Event { fn signed(author: &Keys, kind: Kind, tags: Vec<Tag>, created_at: u64) -> Event {
EventBuilder::new(kind, "") EventBuilder::new(kind)
.tags(tags) .tags(tags)
.custom_created_at(Timestamp::from_secs(created_at)) .custom_created_at(Timestamp::from_secs(created_at))
.finalize(author) .finalize(author)
+1 -1
View File
@@ -152,7 +152,7 @@ mod tests {
/// Builds a signed event with a fixed timestamp. /// Builds a signed event with a fixed timestamp.
fn signed(author: &Keys, kind: Kind, tags: Vec<Tag>, created_at: u64) -> Event { fn signed(author: &Keys, kind: Kind, tags: Vec<Tag>, created_at: u64) -> Event {
EventBuilder::new(kind, "") EventBuilder::new(kind)
.tags(tags) .tags(tags)
.custom_created_at(Timestamp::from_secs(created_at)) .custom_created_at(Timestamp::from_secs(created_at))
.finalize(author) .finalize(author)
+6 -4
View File
@@ -131,7 +131,8 @@ mod tests {
/// Builds a signed pull request event. /// Builds a signed pull request event.
fn pr_event(content: &str, tags: Vec<Tag>) -> Event { fn pr_event(content: &str, tags: Vec<Tag>) -> Event {
EventBuilder::new(Kind::GitPullRequest, content) EventBuilder::new(Kind::GitPullRequest)
.content(content)
.tags(tags) .tags(tags)
.finalize(&keys()) .finalize(&keys())
.expect("signed event") .expect("signed event")
@@ -139,7 +140,8 @@ mod tests {
/// Builds a signed patch event with a fixed timestamp. /// Builds a signed patch event with a fixed timestamp.
fn patch_event(content: &str, tags: Vec<Tag>, created_at: u64) -> Event { fn patch_event(content: &str, tags: Vec<Tag>, created_at: u64) -> Event {
EventBuilder::new(Kind::GitPatch, content) EventBuilder::new(Kind::GitPatch)
.content(content)
.tags(tags) .tags(tags)
.custom_created_at(Timestamp::from(created_at)) .custom_created_at(Timestamp::from(created_at))
.finalize(&keys()) .finalize(&keys())
@@ -214,7 +216,7 @@ mod tests {
/// Builds a signed event with a fixed timestamp. /// Builds a signed event with a fixed timestamp.
fn signed_at(kind: Kind, tags: Vec<Tag>, created_at: u64) -> Event { fn signed_at(kind: Kind, tags: Vec<Tag>, created_at: u64) -> Event {
EventBuilder::new(kind, "") EventBuilder::new(kind)
.tags(tags) .tags(tags)
.custom_created_at(Timestamp::from(created_at)) .custom_created_at(Timestamp::from(created_at))
.finalize(&keys()) .finalize(&keys())
@@ -268,7 +270,7 @@ mod tests {
SecretKey::from_hex("0000000000000000000000000000000000000000000000000000000000000002") SecretKey::from_hex("0000000000000000000000000000000000000000000000000000000000000002")
.expect("valid secret key"), .expect("valid secret key"),
); );
let stranger = EventBuilder::new(Kind::GitPullRequestUpdate, "") let stranger = EventBuilder::new(Kind::GitPullRequestUpdate)
.tags([Tag::parse(["E", &root_hex]).expect("valid tag")]) .tags([Tag::parse(["E", &root_hex]).expect("valid tag")])
.custom_created_at(Timestamp::from(999)) .custom_created_at(Timestamp::from(999))
.finalize(&other) .finalize(&other)
+2 -2
View File
@@ -63,7 +63,7 @@ mod tests {
} }
fn status_event(author: &Keys, kind: Kind, root: EventId, created_at: u64) -> Event { fn status_event(author: &Keys, kind: Kind, root: EventId, created_at: u64) -> Event {
EventBuilder::new(kind, "") EventBuilder::new(kind)
.tags([Tag::event(root)]) .tags([Tag::event(root)])
.custom_created_at(Timestamp::from(created_at)) .custom_created_at(Timestamp::from(created_at))
.finalize(author) .finalize(author)
@@ -73,7 +73,7 @@ mod tests {
#[test] #[test]
fn references_root_matches_e_tag() { fn references_root_matches_e_tag() {
let root = root_event_id(); let root = root_event_id();
let event = EventBuilder::new(Kind::GitStatusOpen, "") let event = EventBuilder::new(Kind::GitStatusOpen)
.tags([Tag::event(root)]) .tags([Tag::event(root)])
.finalize(&keys_from_hex( .finalize(&keys_from_hex(
"0000000000000000000000000000000000000000000000000000000000000001", "0000000000000000000000000000000000000000000000000000000000000001",
+2 -1
View File
@@ -154,7 +154,8 @@ impl Inbox {
me: PublicKey, me: PublicKey,
state: &InboxReadState, state: &InboxReadState,
) -> Result<(), Error> { ) -> Result<(), Error> {
let event = EventBuilder::new(Kind::ApplicationSpecificData, serde_json::to_string(state)?) let event = EventBuilder::new(Kind::ApplicationSpecificData)
.content(serde_json::to_string(state)?)
.tags([Tag::identifier(Self::inbox_state_d_tag(me))]) .tags([Tag::identifier(Self::inbox_state_d_tag(me))])
.finalize(&Keys::generate())?; .finalize(&Keys::generate())?;
+1 -1
View File
@@ -177,7 +177,7 @@ mod tests {
fn announcement(secret: &str, id: &str) -> Announcement { fn announcement(secret: &str, id: &str) -> Announcement {
let keys = Keys::new(SecretKey::from_hex(secret).expect("secret")); let keys = Keys::new(SecretKey::from_hex(secret).expect("secret"));
let tag = Tag::parse(vec!["d", id]).expect("tag"); let tag = Tag::parse(vec!["d", id]).expect("tag");
let event = EventBuilder::new(Kind::GitRepoAnnouncement, "") let event = EventBuilder::new(Kind::GitRepoAnnouncement)
.tags(vec![tag]) .tags(vec![tag])
.finalize(&keys) .finalize(&keys)
.expect("signed"); .expect("signed");
+5 -2
View File
@@ -1134,7 +1134,7 @@ impl RepoStore {
return; return;
}; };
let builder = EventBuilder::new(status.kind(), "").tags([ let builder = EventBuilder::new(status.kind()).tags([
root_ref, root_ref,
Tag::public_key(addr.public_key()), Tag::public_key(addr.public_key()),
Tag::public_key(root.pubkey), Tag::public_key(root.pubkey),
@@ -1508,7 +1508,10 @@ where
tags.push(tag); tags.push(tag);
} }
let builder = EventBuilder::new(Kind::GitPatch, part.clone()).tags(tags); let builder = EventBuilder::new(Kind::GitPatch)
.content(part.clone())
.tags(tags);
let event = builder.finalize_async(signer).await?; let event = builder.finalize_async(signer).await?;
let output = client.send_event(&event).broadcast().await?; let output = client.send_event(&event).broadcast().await?;
+1 -1
View File
@@ -116,7 +116,7 @@ impl SyncState {
); );
} }
EventBuilder::new(Kind::RepoState, "").tags(tags) EventBuilder::new(Kind::RepoState).tags(tags)
} }
pub fn parse(event: &Event) -> Self { pub fn parse(event: &Event) -> Self {