chore: improve ui consistently (#35)
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

Reviewed-on: #35
This commit was merged in pull request #35.
This commit is contained in:
2026-11-20 12:28:25 +00:00
parent 51dd5c8630
commit f850f4c4c1
90 changed files with 2859 additions and 2061 deletions
+3
View File
@@ -30,3 +30,6 @@ rustls = "0.23"
[dev-dependencies]
tempfile = "3"
[lints]
workspace = true
+7 -4
View File
@@ -418,19 +418,22 @@ impl Backend {
let relays: Vec<(RelayUrl, Option<RelayMetadata>)> = [
(
RelayUrl::parse("wss://relay.primal.net").unwrap(),
RelayUrl::parse("wss://relay.primal.net")
.expect("hardcoded relay URL parses"),
Some(RelayMetadata::Read),
),
(
RelayUrl::parse("wss://relay.ditto.pub").unwrap(),
RelayUrl::parse("wss://relay.ditto.pub")
.expect("hardcoded relay URL parses"),
Some(RelayMetadata::Read),
),
(
RelayUrl::parse("wss://relay.nostr.net").unwrap(),
RelayUrl::parse("wss://relay.nostr.net")
.expect("hardcoded relay URL parses"),
Some(RelayMetadata::Write),
),
(
RelayUrl::parse("wss://nos.lol").unwrap(),
RelayUrl::parse("wss://nos.lol").expect("hardcoded relay URL parses"),
Some(RelayMetadata::Write),
),
]
+19 -15
View File
@@ -663,34 +663,37 @@ impl RepoStore {
merge_base: Option<String>,
push_from: Option<PathBuf>,
cx: &mut Context<Self>,
) {
) -> Task<Result<(), Error>> {
self.last_error = None;
self.last_warning = None;
let Some(addr) = self.addr.clone() else {
self.not_announced(cx);
return;
return Task::ready(Err(Error::msg(
"This repository is not published to Nostr yet",
)));
};
let series = PatchSeries::parse(&patch);
if let Some(oversized) = series.oversized_length() {
self.last_error = Some(format!(
let message = format!(
"patch too large ({} bytes; NIP-34 suggests keeping each patch under {} bytes)",
oversized, MAX_PATCH_EVENT_BYTES
));
);
self.last_error = Some(message.clone());
cx.notify();
return;
return Task::ready(Err(Error::msg(message)));
}
// The tip of the series is its last commit; `git format-patch` orders
// patches oldest first.
let Some(current_commit) = series.tip_commit() else {
self.last_error = Some(
"Patch must be `git format-patch` output with a `From <commit-id>` header".into(),
);
let message =
"Patch must be `git format-patch` output with a `From <commit-id>` header";
self.last_error = Some(message.into());
cx.notify();
return;
return Task::ready(Err(Error::msg(message)));
};
let backend = Backend::global(cx);
@@ -700,9 +703,10 @@ impl RepoStore {
};
let Some(user) = user else {
self.last_error = Some("Sign in to open a pull request".into());
let message = "Sign in to open a pull request";
self.last_error = Some(message.into());
cx.notify();
return;
return Task::ready(Err(Error::msg(message)));
};
let author_npub = user.to_bech32().unwrap();
@@ -733,7 +737,7 @@ impl RepoStore {
.collect()
};
let task: Task<Result<(), Error>> = cx.spawn(async move |this, cx| {
cx.spawn(async move |this, cx| {
let root_patch = match publish_patch_series(
&client,
&signer,
@@ -919,8 +923,7 @@ impl RepoStore {
}
Ok(())
});
self.tasks.push(task);
})
}
#[allow(clippy::too_many_arguments)]
@@ -956,7 +959,7 @@ impl RepoStore {
};
this.update(cx, |this, cx| {
this.open_pull_request(
let task = this.open_pull_request(
subject,
description,
branch_name,
@@ -966,6 +969,7 @@ impl RepoStore {
Some(repo_path),
cx,
);
this.tasks.push(task);
})
})
}