+ beside the wordmark creates a community (was only a hidden right-click on the wordmark)
Browse files at this commitebeeacce3a46eb78272b7009fb087132a4b97449Parent: aa7ff93- feat
- + beside the wordmark creates a community (was only a hidden right-click on the wordmark)
1 changed file +24 -27
- crates/client/src/gui/sidebar.rs +24 -27
crates/client/src/gui/sidebar.rsmodified+24 -27
| @@ -114,9 +114,15 @@ impl Yumush { | |||
| 114 | .text_size(text(text::TITLE)) | 114 | .text_size(text(text::TITLE)) |
| 115 | .font_weight(FontWeight::SEMIBOLD) | 115 | .font_weight(FontWeight::SEMIBOLD) |
| 116 | .text_color(palette.text) | 116 | .text_color(palette.text) |
| 117 | - .context_menu(new_community_menu(entity)) | ||
| 118 | .child("yumuş"), | 117 | .child("yumuş"), |
| 119 | ) | 118 | ) |
| 119 | + .child(icon_button( | ||
| 120 | + "new_community_button", | ||
| 121 | + palette, | ||
| 122 | + IconName::Plus, | ||
| 123 | + "New community", | ||
| 124 | + new_community(entity), | ||
| 125 | + )) | ||
| 120 | .child( | 126 | .child( |
| 121 | div() | 127 | div() |
| 122 | .relative() | 128 | .relative() |
| @@ -1152,33 +1158,24 @@ fn matches_query(name: &str, query: &str) -> bool { | |||
| 1152 | name.to_lowercase().contains(query) | 1158 | name.to_lowercase().contains(query) |
| 1153 | } | 1159 | } |
| 1154 | 1160 | ||
| 1155 | -fn new_community_menu( | 1161 | +fn new_community(entity: &Entity<Yumush>) -> impl Fn(&mut Window, &mut App) + 'static { |
| 1156 | - entity: &Entity<Yumush>, | ||
| 1157 | -) -> impl Fn(PopupMenu, &mut Window, &mut Context<PopupMenu>) -> PopupMenu + 'static { | ||
| 1158 | let entity = entity.clone(); | 1162 | let entity = entity.clone(); |
| 1159 | - | 1163 | + move |window, cx| { |
| 1160 | - move |menu, _, _| { | 1164 | + entity.update(cx, |_, cx| { |
| 1161 | - let entity = entity.clone(); | 1165 | + input_dialog( |
| 1162 | - | 1166 | + "New community", |
| 1163 | - menu.item( | 1167 | + "Create", |
| 1164 | - PopupMenuItem::new("New community").on_click(move |_, window, cx| { | 1168 | + "Name...", |
| 1165 | - entity.update(cx, |_, cx| { | 1169 | + window, |
| 1166 | - input_dialog( | 1170 | + cx, |
| 1167 | - "New community", | 1171 | + |this, name, window, cx| { |
| 1168 | - "Create", | 1172 | + let name = name.trim().to_string(); |
| 1169 | - "Name...", | 1173 | + if validate_community_name(&name).is_ok() { |
| 1170 | - window, | 1174 | + create_community(this, name, window, cx); |
| 1171 | - cx, | 1175 | + } |
| 1172 | - |this, name, window, cx| { | 1176 | + }, |
| 1173 | - let name = name.trim().to_string(); | 1177 | + ); |
| 1174 | - if validate_community_name(&name).is_ok() { | 1178 | + }) |
| 1175 | - create_community(this, name, window, cx); | ||
| 1176 | - } | ||
| 1177 | - }, | ||
| 1178 | - ); | ||
| 1179 | - }); | ||
| 1180 | - }), | ||
| 1181 | - ) | ||
| 1182 | } | 1179 | } |
| 1183 | } | 1180 | } |
| 1184 | 1181 | ||