move group actions to sidebar and add invite link copying
This commit is contained in:
@@ -11,7 +11,7 @@ use gpui::{
|
||||
AnyElement, App, AppContext, Context, Div, Entity, EventEmitter, FocusHandle, Focusable,
|
||||
InteractiveElement, IntoElement, ObjectFit, ParentElement, Render, SharedString, Stateful,
|
||||
Styled, StyledImage, Subscription, Task, UniformListScrollHandle, WeakEntity, Window, div, img,
|
||||
px, retain_all, uniform_list,
|
||||
px, relative, retain_all, uniform_list,
|
||||
};
|
||||
use nip29::{Group, GroupKey, GroupsEvent, GroupsRegistry, Membership};
|
||||
use nostr_sdk::prelude::*;
|
||||
@@ -922,9 +922,11 @@ impl Sidebar {
|
||||
}
|
||||
|
||||
fn render_group(&mut self, group: Entity<Group>, cx: &mut Context<Self>) -> AnyElement {
|
||||
let (banner, name, seed, picture, rows) = {
|
||||
let (banner, name, seed, picture, total_members, rows) = {
|
||||
let group = group.read(cx);
|
||||
let admins = group.admins();
|
||||
let metadata = group.metadata();
|
||||
|
||||
let mut admin_rows = Vec::new();
|
||||
let mut member_rows = Vec::new();
|
||||
|
||||
@@ -962,8 +964,6 @@ impl Sidebar {
|
||||
}
|
||||
}
|
||||
|
||||
let metadata = group.metadata();
|
||||
|
||||
(
|
||||
metadata.and_then(|metadata| {
|
||||
metadata.banner.clone().or_else(|| metadata.picture.clone())
|
||||
@@ -971,6 +971,7 @@ impl Sidebar {
|
||||
group.display_name(),
|
||||
group.key().cache_tag(),
|
||||
group.display_image(),
|
||||
SharedString::from(format!("{} members", group.total_members())),
|
||||
rows,
|
||||
)
|
||||
};
|
||||
@@ -988,26 +989,52 @@ impl Sidebar {
|
||||
div()
|
||||
.h_40()
|
||||
.w_full()
|
||||
.relative()
|
||||
.overflow_hidden()
|
||||
.rounded(cx.theme().radius_lg)
|
||||
.child(img(banner).size_full().object_fit(ObjectFit::Cover)),
|
||||
.child(
|
||||
img(banner)
|
||||
.size_full()
|
||||
.rounded(cx.theme().radius_lg)
|
||||
.object_fit(ObjectFit::Fill),
|
||||
),
|
||||
),
|
||||
)
|
||||
})
|
||||
.child(
|
||||
h_flex()
|
||||
.px_2()
|
||||
.gap_2()
|
||||
.flex_shrink_0()
|
||||
.child(Avatar::from_source(picture).seed(seed).small())
|
||||
.justify_between()
|
||||
.child(
|
||||
div()
|
||||
.flex_1()
|
||||
.min_w_0()
|
||||
.text_sm()
|
||||
.font_medium()
|
||||
.truncate()
|
||||
.child(name),
|
||||
h_flex()
|
||||
.gap_2()
|
||||
.flex_shrink_1()
|
||||
.child(Avatar::from_source(picture).seed(seed).small())
|
||||
.child(
|
||||
v_flex()
|
||||
.flex_1()
|
||||
.min_w_0()
|
||||
.child(
|
||||
div()
|
||||
.text_xs()
|
||||
.truncate()
|
||||
.line_height(relative(1.2))
|
||||
.font_semibold()
|
||||
.child(name),
|
||||
)
|
||||
.child(
|
||||
div()
|
||||
.text_size(px(10.))
|
||||
.text_color(cx.theme().text_muted)
|
||||
.child(total_members),
|
||||
),
|
||||
),
|
||||
)
|
||||
.child(
|
||||
h_flex()
|
||||
.gap_1()
|
||||
.child(nip29_ui::actions(group.downgrade(), cx)),
|
||||
),
|
||||
)
|
||||
.child(
|
||||
|
||||
Reference in New Issue
Block a user