This commit is contained in:
2026-10-23 11:06:34 +07:00
parent 1c00bc7956
commit e4ebe96077
10 changed files with 200 additions and 182 deletions
+55 -67
View File
@@ -8,13 +8,13 @@ use gpui::{
};
use gpui_kit::component::button::{Button, ButtonVariants};
use gpui_kit::component::dialog::DialogButtonProps;
use gpui_kit::component::form::field as form_field;
use gpui_kit::component::input::InputState;
use gpui_kit::component::notification::Notification;
use gpui_kit::component::switch::Switch;
use gpui_kit::component::{ActiveTheme, Sizable, WindowExt, h_flex, v_flex};
use nip29::{Group, GroupId, GroupMetadata};
use nostr_sdk::prelude::RelayUrl;
use ui::settings_row;
use crate::util::field;
@@ -126,73 +126,61 @@ pub(crate) fn open(group: WeakEntity<Group>, window: &mut Window, cx: &mut App)
.child(
v_flex()
.gap_2()
.child(
form_field()
.label("Private")
.description("Only members can read group messages")
.child(
Switch::new("private")
.checked(current.private)
.on_click(toggle(&flags, |flags| &mut flags.private)),
),
)
.child(
form_field()
.label("Restricted")
.description("Only members can post messages")
.child(
Switch::new("restricted")
.checked(current.restricted)
.on_click(toggle(&flags, |flags| {
&mut flags.restricted
})),
),
)
.child(
form_field()
.label("Hidden")
.description("Hidden from non-members, not discoverable")
.child(
Switch::new("hidden")
.checked(current.hidden)
.on_click(toggle(&flags, |flags| &mut flags.hidden)),
),
)
.child(
form_field()
.label("Closed")
.description("Join requests are ignored (invite-only)")
.child(
Switch::new("closed")
.checked(current.closed)
.on_click(toggle(&flags, |flags| &mut flags.closed)),
),
)
.child(
form_field()
.label("LiveKit")
.description(if supported {
"Announce audio and video support."
} else {
"The relay doesn't announce LiveKit support."
})
.child(
Switch::new("livekit").checked(current.livekit).on_click({
let flags = flags.clone();
let livekit = livekit.clone();
.child(settings_row(
"Private",
"Only members can read group messages",
Switch::new("private")
.checked(current.private)
.on_click(toggle(&flags, |flags| &mut flags.private)),
cx,
))
.child(settings_row(
"Restricted",
"Only members can post messages",
Switch::new("restricted")
.checked(current.restricted)
.on_click(toggle(&flags, |flags| &mut flags.restricted)),
cx,
))
.child(settings_row(
"Hidden",
"Hidden from non-members, not discoverable",
Switch::new("hidden")
.checked(current.hidden)
.on_click(toggle(&flags, |flags| &mut flags.hidden)),
cx,
))
.child(settings_row(
"Closed",
"Join requests are ignored (invite-only)",
Switch::new("closed")
.checked(current.closed)
.on_click(toggle(&flags, |flags| &mut flags.closed)),
cx,
))
.child(settings_row(
"LiveKit",
if supported {
"Announce audio and video support."
} else {
"The relay doesn't announce LiveKit support."
},
Switch::new("livekit").checked(current.livekit).on_click({
let flags = flags.clone();
let livekit = livekit.clone();
move |next, _window, cx| {
if *next && *livekit.read(cx) == Some(false) {
return;
}
flags.update(cx, |flags, cx| {
flags.livekit = *next;
cx.notify();
});
}
}),
),
),
move |next, _window, cx| {
if *next && *livekit.read(cx) == Some(false) {
return;
}
flags.update(cx, |flags, cx| {
flags.livekit = *next;
cx.notify();
});
}
}),
cx,
)),
),
)
.on_ok({