feat: add group discovery and group preview #59
@@ -351,7 +351,6 @@ impl BrowsePanel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn render_card(&self, candidate: &GroupCandidate, cx: &mut Context<Self>) -> AnyElement {
|
fn render_card(&self, candidate: &GroupCandidate, cx: &mut Context<Self>) -> AnyElement {
|
||||||
let registry = GroupsRegistry::global(cx);
|
|
||||||
let hide_avatar = AppSettings::get_hide_avatar(cx);
|
let hide_avatar = AppSettings::get_hide_avatar(cx);
|
||||||
let dock = self.dock.clone();
|
let dock = self.dock.clone();
|
||||||
|
|
||||||
@@ -370,21 +369,8 @@ impl BrowsePanel {
|
|||||||
.display_about()
|
.display_about()
|
||||||
.map(|about| SharedString::from(about.to_owned()));
|
.map(|about| SharedString::from(about.to_owned()));
|
||||||
|
|
||||||
let member = registry
|
|
||||||
.read(cx)
|
|
||||||
.group(&key, cx)
|
|
||||||
.is_some_and(|group| matches!(group.read(cx).membership(), Membership::Member));
|
|
||||||
|
|
||||||
let action = Button::new(format!("open-{seed}"))
|
|
||||||
.label(if member { "Open" } else { "Preview" })
|
|
||||||
.small()
|
|
||||||
.ghost()
|
|
||||||
.on_click(move |_event, window, cx| {
|
|
||||||
Self::open_panel(&dock, key.clone(), window, cx);
|
|
||||||
})
|
|
||||||
.into_any_element();
|
|
||||||
|
|
||||||
v_flex()
|
v_flex()
|
||||||
|
.id(SharedString::from(format!("card-{seed}")))
|
||||||
.flex_1()
|
.flex_1()
|
||||||
.min_w_0()
|
.min_w_0()
|
||||||
.h_full()
|
.h_full()
|
||||||
@@ -392,6 +378,11 @@ impl BrowsePanel {
|
|||||||
.border_1()
|
.border_1()
|
||||||
.border_color(cx.theme().border)
|
.border_color(cx.theme().border)
|
||||||
.rounded(cx.theme().radius)
|
.rounded(cx.theme().radius)
|
||||||
|
.cursor_pointer()
|
||||||
|
.hover(|this| {
|
||||||
|
this.border_color(cx.theme().border_focused)
|
||||||
|
.bg(cx.theme().surface_background)
|
||||||
|
})
|
||||||
.child(
|
.child(
|
||||||
v_flex()
|
v_flex()
|
||||||
.flex_1()
|
.flex_1()
|
||||||
@@ -425,8 +416,7 @@ impl BrowsePanel {
|
|||||||
.text_color(cx.theme().text_placeholder)
|
.text_color(cx.theme().text_placeholder)
|
||||||
.child(relay),
|
.child(relay),
|
||||||
),
|
),
|
||||||
)
|
),
|
||||||
.child(action),
|
|
||||||
)
|
)
|
||||||
.child(
|
.child(
|
||||||
div()
|
div()
|
||||||
@@ -457,6 +447,9 @@ impl BrowsePanel {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
.on_click(move |_event, window, cx| {
|
||||||
|
Self::open_panel(&dock, key.clone(), window, cx);
|
||||||
|
})
|
||||||
.into_any_element()
|
.into_any_element()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user