Inviting/Responding/Creating Channels... etc.

This commit is contained in:
Conrad Irwin 2023-11-28 22:46:35 -07:00
parent 396ecefa4f
commit 5fbc60d8da
5 changed files with 420 additions and 644 deletions

File diff suppressed because it is too large Load Diff

View File

@ -181,7 +181,6 @@ impl PickerDelegate for ContactFinderDelegate {
ContactRequestStatus::RequestSent => Some("icons/x.svg"),
ContactRequestStatus::RequestAccepted => None,
};
dbg!(icon_path);
Some(
div()
.flex_1()

View File

@ -30,11 +30,11 @@ pub trait FeatureFlagViewExt<V: 'static> {
impl<V> FeatureFlagViewExt<V> for ViewContext<'_, V>
where
V: 'static + Send + Sync,
V: 'static,
{
fn observe_flag<T: FeatureFlag, F>(&mut self, callback: F) -> Subscription
where
F: Fn(bool, &mut V, &mut ViewContext<V>) + Send + Sync + 'static,
F: Fn(bool, &mut V, &mut ViewContext<V>) + 'static,
{
self.observe_global::<FeatureFlags>(move |v, cx| {
let feature_flags = cx.global::<FeatureFlags>();

View File

@ -59,6 +59,7 @@ impl RenderOnce for IconButton {
if let Some(click_handler) = self.on_click {
button = button.on_click(move |event, cx| {
cx.stop_propagation();
click_handler(event, cx);
})
}

View File

@ -25,7 +25,9 @@ pub struct ListHeader {
left_icon: Option<Icon>,
meta: Option<ListHeaderMeta>,
toggle: Toggle,
on_toggle: Option<Rc<dyn Fn(&ClickEvent, &mut WindowContext) + 'static>>,
inset: bool,
selected: bool,
}
impl ListHeader {
@ -36,6 +38,8 @@ impl ListHeader {
meta: None,
inset: false,
toggle: Toggle::NotToggleable,
on_toggle: None,
selected: false,
}
}
@ -44,6 +48,14 @@ impl ListHeader {
self
}
pub fn on_toggle(
mut self,
on_toggle: impl Fn(&ClickEvent, &mut WindowContext) + 'static,
) -> Self {
self.on_toggle = Some(Rc::new(on_toggle));
self
}
pub fn left_icon(mut self, left_icon: Option<Icon>) -> Self {
self.left_icon = left_icon;
self
@ -57,13 +69,18 @@ impl ListHeader {
self.meta = meta;
self
}
pub fn selected(mut self, selected: bool) -> Self {
self.selected = selected;
self
}
}
impl RenderOnce for ListHeader {
type Rendered = Div;
fn render(self, cx: &mut WindowContext) -> Self::Rendered {
let disclosure_control = disclosure_control(self.toggle, None);
let disclosure_control = disclosure_control(self.toggle, self.on_toggle);
let meta = match self.meta {
Some(ListHeaderMeta::Tools(icons)) => div().child(
@ -85,6 +102,9 @@ impl RenderOnce for ListHeader {
div()
.h_5()
.when(self.inset, |this| this.px_2())
.when(self.selected, |this| {
this.bg(cx.theme().colors().ghost_element_selected)
})
.flex()
.flex_1()
.items_center()