diff --git a/crates/client/src/gui/sidebar.rs b/crates/client/src/gui/sidebar.rs index 94733c7..9826613 100644 --- a/crates/client/src/gui/sidebar.rs +++ b/crates/client/src/gui/sidebar.rs @@ -114,9 +114,15 @@ impl Yumush { .text_size(text(text::TITLE)) .font_weight(FontWeight::SEMIBOLD) .text_color(palette.text) - .context_menu(new_community_menu(entity)) .child("yumuß"), ) + .child(icon_button( + "new_community_button", + palette, + IconName::Plus, + "New community", + new_community(entity), + )) .child( div() .relative() @@ -1152,33 +1158,24 @@ fn matches_query(name: &str, query: &str) -> bool { name.to_lowercase().contains(query) } -fn new_community_menu( - entity: &Entity, -) -> impl Fn(PopupMenu, &mut Window, &mut Context) -> PopupMenu + 'static { +fn new_community(entity: &Entity) -> impl Fn(&mut Window, &mut App) + 'static { let entity = entity.clone(); - - move |menu, _, _| { - let entity = entity.clone(); - - menu.item( - PopupMenuItem::new("New community").on_click(move |_, window, cx| { - entity.update(cx, |_, cx| { - input_dialog( - "New community", - "Create", - "Name...", - window, - cx, - |this, name, window, cx| { - let name = name.trim().to_string(); - if validate_community_name(&name).is_ok() { - create_community(this, name, window, cx); - } - }, - ); - }); - }), - ) + move |window, cx| { + entity.update(cx, |_, cx| { + input_dialog( + "New community", + "Create", + "Name...", + window, + cx, + |this, name, window, cx| { + let name = name.trim().to_string(); + if validate_community_name(&name).is_ok() { + create_community(this, name, window, cx); + } + }, + ); + }) } }