wip
This commit is contained in:
@@ -7,20 +7,18 @@ use gpui::{
|
||||
};
|
||||
use gpui_base::{Popup, Select};
|
||||
use gpui_kit::assets::IconName;
|
||||
use gpui_kit::component::ActiveTheme;
|
||||
use gpui_kit::component::avatar::Avatar;
|
||||
use gpui_kit::component::button::{Button, ButtonVariants};
|
||||
use gpui_kit::component::dock::{DockArea, DockPlacement, PanelHandle};
|
||||
use gpui_kit::component::form::field;
|
||||
use gpui_kit::component::input::{Input, InputEvent, InputState, Textarea, TextareaState};
|
||||
use gpui_kit::component::separator::Separator;
|
||||
use gpui_kit::component::switch::Switch;
|
||||
use gpui_kit::component::{Disableable, Icon, Sizable, WindowExt, h_flex, v_flex};
|
||||
use gpui_kit::component::{ActiveTheme, Disableable, Icon, Sizable, WindowExt, h_flex, v_flex};
|
||||
use nip29::{GroupCreateOptions, GroupKey, GroupsEvent, GroupsRegistry};
|
||||
use nostr_sdk::prelude::*;
|
||||
use settings::AppSettings;
|
||||
use state::upload;
|
||||
use ui::divider;
|
||||
use ui::{TextStyle, Typeset as _, button_radius, control_radius};
|
||||
use ui::Avatar;
|
||||
|
||||
const DEFAULT_RELAYS: [&str; 2] = ["wss://relay.ditto.net", "wss://chat.wisp.talk"];
|
||||
const PRIVATE_DESC: &str = "Only members can read group messages";
|
||||
@@ -349,7 +347,7 @@ impl NewGroup {
|
||||
if let Some(parent) = &self.parent {
|
||||
return v_flex().gap_1p5().child(field_label("Relay", cx)).child(
|
||||
div()
|
||||
.text_style(TextStyle::Caption)
|
||||
.text_xs()
|
||||
.text_color(cx.theme().muted_foreground)
|
||||
.child(format!(
|
||||
"Created on {} (same relay as the parent group).",
|
||||
@@ -367,8 +365,8 @@ impl NewGroup {
|
||||
.w_full()
|
||||
.h_8()
|
||||
.px_3()
|
||||
.rounded(px(button_radius()))
|
||||
.text_style(TextStyle::Callout)
|
||||
.rounded(cx.theme().radius)
|
||||
.text_xs()
|
||||
.cursor_default()
|
||||
.bg(if open {
|
||||
cx.theme().list_active
|
||||
@@ -428,8 +426,8 @@ impl NewGroup {
|
||||
.id(SharedString::from(format!("option-{relay}")))
|
||||
.px_1p5()
|
||||
.py_1()
|
||||
.rounded(px(button_radius()))
|
||||
.text_style(TextStyle::Callout)
|
||||
.rounded(cx.theme().radius)
|
||||
.text_xs()
|
||||
.cursor_default()
|
||||
.hover(|this| this.bg(cx.theme().primary))
|
||||
.child(relay_label(relay))
|
||||
@@ -437,14 +435,14 @@ impl NewGroup {
|
||||
this.activate_relay_option(index, cx);
|
||||
}))
|
||||
}))
|
||||
.child(divider(cx))
|
||||
.child(Separator::horizontal())
|
||||
.child(
|
||||
h_flex()
|
||||
.id("relay-add")
|
||||
.px_1p5()
|
||||
.py_1()
|
||||
.rounded(px(button_radius()))
|
||||
.text_style(TextStyle::Callout)
|
||||
.rounded(cx.theme().radius)
|
||||
.text_xs()
|
||||
.cursor_default()
|
||||
.child("Custom relay")
|
||||
.hover(|this| this.bg(cx.theme().primary))
|
||||
@@ -542,7 +540,7 @@ impl NewGroup {
|
||||
.child(
|
||||
div()
|
||||
.flex_1()
|
||||
.text_style(TextStyle::Caption)
|
||||
.text_xs()
|
||||
.text_color(cx.theme().danger)
|
||||
.child(error.to_owned()),
|
||||
)
|
||||
@@ -553,7 +551,7 @@ impl NewGroup {
|
||||
.cursor_pointer()
|
||||
.flex_shrink_0()
|
||||
.underline()
|
||||
.text_style(TextStyle::Caption)
|
||||
.text_xs()
|
||||
.text_color(cx.theme().danger)
|
||||
.child("Open relay website")
|
||||
.on_click({
|
||||
@@ -597,12 +595,11 @@ impl Render for NewGroup {
|
||||
h_flex()
|
||||
.items_center()
|
||||
.gap_3()
|
||||
.child(match self.picture.clone() {
|
||||
Some(picture) => {
|
||||
Avatar::new().src(picture).large().into_any_element()
|
||||
}
|
||||
None => Avatar::new().large().into_any_element(),
|
||||
})
|
||||
.child(
|
||||
Avatar::new(self.picture.clone())
|
||||
.seed(self.name_input.read(cx).value().trim().to_owned())
|
||||
.large(),
|
||||
)
|
||||
.child(
|
||||
Button::new("upload-picture")
|
||||
.label(if self.picture.is_some() {
|
||||
@@ -659,7 +656,7 @@ fn input_field(text: &'static str, input: impl IntoElement, cx: &App) -> Div {
|
||||
|
||||
fn field_label(text: &'static str, cx: &App) -> Div {
|
||||
div()
|
||||
.text_style(TextStyle::Caption)
|
||||
.text_xs()
|
||||
.text_color(cx.theme().muted_foreground)
|
||||
.font_weight(gpui::FontWeight::SEMIBOLD)
|
||||
.child(text)
|
||||
@@ -669,7 +666,7 @@ fn switch_row(switch: impl IntoElement, cx: &App) -> Div {
|
||||
div()
|
||||
.w_full()
|
||||
.p_2()
|
||||
.rounded(px(control_radius()))
|
||||
.rounded(cx.theme().radius)
|
||||
.bg(cx.theme().secondary)
|
||||
.child(switch)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user