chore: simplify codebase and prepare for multi-platforms #28

Merged
reya merged 11 commits from improve-codebase into master 2026-04-04 02:22:08 +00:00
3 changed files with 17 additions and 25 deletions
Showing only changes of commit ecd25d04da - Show all commits

View File

@@ -15,7 +15,7 @@ use state::{Announcement, NostrRegistry, StateEvent, TIMEOUT, app_name};
use theme::ActiveTheme; use theme::ActiveTheme;
use ui::avatar::Avatar; use ui::avatar::Avatar;
use ui::button::{Button, ButtonVariants}; use ui::button::{Button, ButtonVariants};
use ui::notification::Notification; use ui::notification::{Notification, NotificationKind};
use ui::{Disableable, IconName, Sizable, StyledExt, WindowExtension, h_flex, v_flex}; use ui::{Disableable, IconName, Sizable, StyledExt, WindowExtension, h_flex, v_flex};
const IDENTIFIER: &str = "coop:device"; const IDENTIFIER: &str = "coop:device";
@@ -597,8 +597,8 @@ impl DeviceRegistry {
Notification::new() Notification::new()
.type_id::<DeviceNotification>(key) .type_id::<DeviceNotification>(key)
.autohide(false) .autohide(false)
.icon(IconName::UserKey) .with_kind(NotificationKind::Info)
.title(SharedString::from("New request")) .title("Encryption Key Request")
.content(move |_this, _window, cx| { .content(move |_this, _window, cx| {
v_flex() v_flex()
.gap_2() .gap_2()
@@ -621,7 +621,7 @@ impl DeviceRegistry {
.font_semibold() .font_semibold()
.text_xs() .text_xs()
.text_color(cx.theme().text_muted) .text_color(cx.theme().text_muted)
.child(SharedString::from("Requester:")), .child(SharedString::from("From:")),
) )
.child( .child(
div() div()
@@ -668,8 +668,6 @@ impl DeviceRegistry {
Button::new("approve") Button::new("approve")
.label("Approve") .label("Approve")
.small()
.primary()
.loading(loading.get()) .loading(loading.get())
.disabled(loading.get()) .disabled(loading.get())
.on_click({ .on_click({

View File

@@ -16,8 +16,8 @@ use smallvec::{SmallVec, smallvec};
use state::NostrRegistry; use state::NostrRegistry;
use theme::ActiveTheme; use theme::ActiveTheme;
use ui::button::{Button, ButtonVariants}; use ui::button::{Button, ButtonVariants};
use ui::notification::Notification; use ui::notification::{Notification, NotificationKind};
use ui::{Disableable, IconName, Sizable, StyledExt, WindowExtension, v_flex}; use ui::{Disableable, IconName, Sizable, WindowExtension, v_flex};
const AUTH_MESSAGE: &str = const AUTH_MESSAGE: &str =
"Approve the authentication request to allow Coop to continue sending or receiving events."; "Approve the authentication request to allow Coop to continue sending or receiving events.";
@@ -327,8 +327,8 @@ impl RelayAuth {
Notification::new() Notification::new()
.type_id::<AuthNotification>(challenge) .type_id::<AuthNotification>(challenge)
.autohide(false) .autohide(false)
.icon(IconName::Warning) .with_kind(NotificationKind::Info)
.title(SharedString::from("Authentication Required")) .title("Authentication Required")
.content(move |_this, _window, cx| { .content(move |_this, _window, cx| {
v_flex() v_flex()
.gap_2() .gap_2()
@@ -344,7 +344,6 @@ impl RelayAuth {
.px_1p5() .px_1p5()
.rounded_sm() .rounded_sm()
.text_xs() .text_xs()
.font_semibold()
.bg(cx.theme().elevated_surface_background) .bg(cx.theme().elevated_surface_background)
.text_color(cx.theme().text) .text_color(cx.theme().text)
.child(url.clone()), .child(url.clone()),
@@ -357,8 +356,6 @@ impl RelayAuth {
Button::new("approve") Button::new("approve")
.label("Approve") .label("Approve")
.small()
.primary()
.loading(loading.get()) .loading(loading.get())
.disabled(loading.get()) .disabled(loading.get())
.on_click({ .on_click({

View File

@@ -295,10 +295,13 @@ impl Render for Notification {
.clone() .clone()
.map(|builder| builder(self, window, cx)); .map(|builder| builder(self, window, cx));
let action = self let action = self.action_builder.clone().map(|builder| {
.action_builder builder(self, window, cx)
.clone() .xsmall()
.map(|builder| builder(self, window, cx).small().mr_3p5()); .primary()
.px_3()
.font_semibold()
});
let icon = match self.kind { let icon = match self.kind {
None => self.icon.clone(), None => self.icon.clone(),
@@ -360,14 +363,8 @@ impl Render for Notification {
}) })
.when_some(content, |this, content| this.child(content)) .when_some(content, |this, content| this.child(content))
.when_some(action, |this, action| { .when_some(action, |this, action| {
this.child( this.gap_2()
h_flex() .child(h_flex().w_full().flex_1().justify_end().child(action))
.w_full()
.flex_1()
.gap_1()
.justify_end()
.child(action),
)
}), }),
) )
.child( .child(