) -> impl IntoElement {
+ let nostr = NostrRegistry::global(cx);
+ let public_key = nostr.read(cx).identity().read(cx).public_key();
+ let shorten_pkey = SharedString::from(shorten_pubkey(public_key, 8));
+
+ // Get the avatar
+ let avatar_input = self.avatar_input.read(cx).value();
+ let avatar = if avatar_input.is_empty() {
+ "brand/avatar.png"
+ } else {
+ avatar_input.as_str()
+ };
+
+ v_flex()
+ .size_full()
+ .items_center()
+ .justify_center()
+ .p_2()
+ .child(
+ v_flex()
+ .gap_2()
+ .w_112()
+ .child(
+ v_flex()
+ .h_40()
+ .w_full()
+ .items_center()
+ .justify_center()
+ .gap_4()
+ .child(Avatar::new(avatar).size(rems(4.25)))
+ .child(
+ Button::new("upload")
+ .icon(IconName::PlusCircle)
+ .label("Add an avatar")
+ .xsmall()
+ .ghost()
+ .rounded()
+ .disabled(self.uploading)
+ .loading(self.uploading)
+ .on_click(cx.listener(move |this, _, window, cx| {
+ this.upload(window, cx);
+ })),
+ ),
+ )
+ .child(
+ v_flex()
+ .gap_1()
+ .text_sm()
+ .text_color(cx.theme().text_muted)
+ .child(SharedString::from("What should people call you?"))
+ .child(TextInput::new(&self.name_input).small()),
+ )
+ .child(
+ v_flex()
+ .gap_1()
+ .text_sm()
+ .text_color(cx.theme().text_muted)
+ .child(SharedString::from("A short introduction about you:"))
+ .child(TextInput::new(&self.bio_input).small()),
+ )
+ .child(
+ v_flex()
+ .gap_1()
+ .text_sm()
+ .text_color(cx.theme().text_muted)
+ .child(SharedString::from("Website:"))
+ .child(TextInput::new(&self.website_input).small()),
+ )
+ .child(divider(cx))
+ .child(
+ v_flex()
+ .gap_1()
+ .child(
+ div()
+ .font_semibold()
+ .text_xs()
+ .text_color(cx.theme().text_placeholder)
+ .child(SharedString::from("Public Key:")),
+ )
+ .child(
+ h_flex()
+ .h_8()
+ .w_full()
+ .justify_center()
+ .gap_2()
+ .bg(cx.theme().surface_background)
+ .rounded(cx.theme().radius)
+ .text_sm()
+ .child(shorten_pkey)
+ .child(
+ Button::new("copy")
+ .icon({
+ if self.copied {
+ IconName::CheckCircle
+ } else {
+ IconName::Copy
+ }
+ })
+ .xsmall()
+ .ghost()
+ .on_click(cx.listener(move |this, _ev, window, cx| {
+ this.copy(
+ public_key.to_bech32().unwrap(),
+ window,
+ cx,
+ );
+ })),
+ ),
+ ),
+ )
+ .child(divider(cx))
+ .child(
+ Button::new("submit")
+ .label("Continue")
+ .primary()
+ .disabled(self.uploading)
+ .on_click(cx.listener(move |this, _ev, window, cx| {
+ this.set_metadata(window, cx);
+ })),
+ ),
+ )
+ }
+}
diff --git a/crates/coop/src/workspace.rs b/crates/coop/src/workspace.rs
index 484ce6f..7dda3fa 100644
--- a/crates/coop/src/workspace.rs
+++ b/crates/coop/src/workspace.rs
@@ -109,7 +109,7 @@ impl Workspace {
}
}
- pub fn add_panel(panel: P, window: &mut Window, cx: &mut App)
+ pub fn add_panel
(panel: P, placement: DockPlacement, window: &mut Window, cx: &mut App)
where
P: PanelView,
{
@@ -117,7 +117,7 @@ impl Workspace {
if let Ok(workspace) = root.read(cx).view().clone().downcast::() {
workspace.update(cx, |this, cx| {
this.dock.update(cx, |this, cx| {
- this.add_panel(Arc::new(panel), DockPlacement::Center, window, cx);
+ this.add_panel(Arc::new(panel), placement, window, cx);
});
});
}
diff --git a/crates/dock/src/tab/mod.rs b/crates/dock/src/tab/mod.rs
index 5a5c6df..cda8983 100644
--- a/crates/dock/src/tab/mod.rs
+++ b/crates/dock/src/tab/mod.rs
@@ -136,7 +136,7 @@ impl RenderOnce for Tab {
self.base
.id(self.ix)
.h(TITLEBAR_HEIGHT)
- .px_2()
+ .px_4()
.relative()
.flex()
.items_center()
diff --git a/crates/dock/src/tab/tab_bar.rs b/crates/dock/src/tab/tab_bar.rs
index b7597ae..24b296a 100644
--- a/crates/dock/src/tab/tab_bar.rs
+++ b/crates/dock/src/tab/tab_bar.rs
@@ -9,9 +9,6 @@ use smallvec::SmallVec;
use theme::ActiveTheme;
use ui::{h_flex, Sizable, Size, StyledExt};
-use crate::platforms::linux::LinuxWindowControls;
-use crate::platforms::windows::WindowsWindowControls;
-
#[derive(IntoElement)]
pub struct TabBar {
base: Div,
@@ -132,17 +129,5 @@ impl RenderOnce for TabBar {
}),
)
.when_some(self.suffix, |this, suffix| this.child(suffix))
- .when(
- !cx.theme().platform.is_mac() && !window.is_fullscreen(),
- |this| match cx.theme().platform {
- theme::PlatformKind::Linux => {
- this.child(div().px_2().child(LinuxWindowControls::new()))
- }
- theme::PlatformKind::Windows => {
- this.child(WindowsWindowControls::new(Self::height(window)))
- }
- _ => this,
- },
- )
}
}
diff --git a/crates/dock/src/tab_panel.rs b/crates/dock/src/tab_panel.rs
index 3895556..21dc572 100644
--- a/crates/dock/src/tab_panel.rs
+++ b/crates/dock/src/tab_panel.rs
@@ -5,9 +5,9 @@ use gpui::{
div, px, rems, App, AppContext, Context, Corner, DefiniteLength, DismissEvent, DragMoveEvent,
Empty, Entity, EventEmitter, FocusHandle, Focusable, InteractiveElement as _, IntoElement,
MouseButton, ParentElement, Pixels, Render, ScrollHandle, SharedString,
- StatefulInteractiveElement, Styled, WeakEntity, Window, WindowControlArea,
+ StatefulInteractiveElement, Styled, WeakEntity, Window,
};
-use theme::{ActiveTheme, PlatformKind, CLIENT_SIDE_DECORATION_ROUNDING, TITLEBAR_HEIGHT};
+use theme::{ActiveTheme, CLIENT_SIDE_DECORATION_ROUNDING, TITLEBAR_HEIGHT};
use ui::button::{Button, ButtonVariants as _};
use ui::popup_menu::{PopupMenu, PopupMenuExt};
use ui::{h_flex, v_flex, AxisExt, IconName, Placement, Selectable, Sizable, StyledExt};
@@ -88,9 +88,6 @@ pub struct TabPanel {
/// Whether the tab panel is collapsed
collapsed: bool,
- /// Whether window is moving
- window_move: bool,
-
/// When drag move, will get the placement of the panel to be split
will_split_placement: Option,
}
@@ -160,7 +157,6 @@ impl TabPanel {
will_split_placement: None,
zoomed: false,
collapsed: false,
- window_move: false,
closable: true,
}
}
@@ -577,8 +573,6 @@ impl TabPanel {
return div().into_any_element();
};
- #[cfg(target_os = "linux")]
- let supported_controls = window.window_controls();
let left_dock_button = self.render_dock_toggle_button(DockPlacement::Left, window, cx);
let bottom_dock_button = self.render_dock_toggle_button(DockPlacement::Bottom, window, cx);
let right_dock_button = self.render_dock_toggle_button(DockPlacement::Right, window, cx);
@@ -737,40 +731,9 @@ impl TabPanel {
// empty space to allow move to last tab right
div()
.id("tab-bar-empty-space")
- .window_control_area(WindowControlArea::Drag)
.h_full()
.flex_grow()
.min_w_16()
- .when(!window.is_fullscreen(), |this| match cx.theme().platform {
- PlatformKind::Linux => this
- .when(supported_controls.window_menu, |this| {
- this.on_mouse_down(MouseButton::Right, move |ev, window, _| {
- window.show_window_menu(ev.position)
- })
- })
- .on_mouse_move(cx.listener(move |this, _ev, window, _| {
- if this.window_move {
- this.window_move = false;
- window.start_window_move();
- }
- }))
- .on_mouse_down_out(cx.listener(move |this, _ev, _window, _cx| {
- this.window_move = false;
- }))
- .on_mouse_up(
- MouseButton::Left,
- cx.listener(move |this, _ev, _window, _cx| {
- this.window_move = false;
- }),
- )
- .on_mouse_down(
- MouseButton::Left,
- cx.listener(move |this, _ev, _window, _cx| {
- this.window_move = true;
- }),
- ),
- _ => this,
- })
.when(state.droppable, |this| {
let view = cx.entity();
@@ -804,7 +767,6 @@ impl TabPanel {
.border_color(cx.theme().border)
.border_l_1()
.border_b_1()
- .when(!cx.theme().platform.is_mac(), |this| this.border_r_1())
.child(self.render_toolbar(state, window, cx))
.when_some(right_dock_button, |this, btn| this.child(btn)),
)
diff --git a/crates/state/src/lib.rs b/crates/state/src/lib.rs
index 31fdc60..8311f1a 100644
--- a/crates/state/src/lib.rs
+++ b/crates/state/src/lib.rs
@@ -615,6 +615,27 @@ impl NostrRegistry {
}));
}
+ /// Set the metadata for the current user
+ pub fn set_metadata(&self, metadata: &Metadata, cx: &App) -> Task> {
+ let client = self.client();
+ let public_key = self.identity().read(cx).public_key();
+ let write_relays = self.write_relays(&public_key, cx);
+ let metadata = metadata.clone();
+
+ cx.background_spawn(async move {
+ let urls = write_relays.await;
+ let signer = client.signer().await?;
+
+ // Sign the new metadata event
+ let event = EventBuilder::metadata(&metadata).sign(&signer).await?;
+
+ // Send event to user's write relayss
+ client.send_event_to(urls, &event).await?;
+
+ Ok(())
+ })
+ }
+
/// Get local stored identity
fn get_identity(&mut self, cx: &mut Context) {
let read_credential = cx.read_credentials(CLIENT_NAME);
diff --git a/crates/ui/src/styled.rs b/crates/ui/src/styled.rs
index 8e40768..6cc9480 100644
--- a/crates/ui/src/styled.rs
+++ b/crates/ui/src/styled.rs
@@ -18,7 +18,7 @@ pub fn v_flex() -> Div {
/// Returns a `Div` as divider.
pub fn divider(cx: &App) -> Div {
- div().my_2().w_full().h_px().bg(cx.theme().border)
+ div().my_2().w_full().h_px().bg(cx.theme().border_variant)
}
macro_rules! font_weight {