Join voice is one pill below the In voice list (or alone when empty)
Browse files at this commit4d11f0d95a6283428cc1c5d39e3e1609129579fcParent: 03cece2- style
- join voice is one pill below the In voice list (or alone when empty)
- section header no longer carries an action
1 changed file +14 -29
- crates/client/src/gui/chat.rs +14 -29
crates/client/src/gui/chat.rsmodified+14 -29
| @@ -3181,10 +3181,7 @@ fn members_column( | ||
| 3181 | 3181 | .children(watch(Kind::Camera)) |
| 3182 | 3182 | .children(watch(Kind::Screen)) |
| 3183 | 3183 | }; |
| 3184 | - let section = |title: &'static str, | |
| 3185 | - rows: Vec<&MemberRow>, | |
| 3186 | - cap: usize, | |
| 3187 | - action: Option<gpui_kit::Stateful<Div>>| { | |
| 3184 | + let section = |title: &'static str, rows: Vec<&MemberRow>, cap: usize| { | |
| 3188 | 3185 | (!rows.is_empty()).then(|| { |
| 3189 | 3186 | let total = rows.len(); |
| 3190 | 3187 | let more = total.saturating_sub(cap); |
| @@ -3193,11 +3190,7 @@ fn members_column( | ||
| 3193 | 3190 | .flex_col() |
| 3194 | 3191 | .child( |
| 3195 | 3192 | super::parts::caption_head(format!("{title} · {total}"), palette.tokens) |
| 3196 | - .pb(px(space::XS)) | |
| 3197 | - .flex() | |
| 3198 | - .items_center() | |
| 3199 | - .justify_between() | |
| 3200 | - .children(action), | |
| 3193 | + .pb(px(space::XS)), | |
| 3201 | 3194 | ) |
| 3202 | 3195 | .children(rows.into_iter().take(cap).map(row)) |
| 3203 | 3196 | .when(more > 0, |this| { |
| @@ -3228,24 +3221,22 @@ fn members_column( | ||
| 3228 | 3221 | let action = entity_action(&entity, move |yumush, window, cx| { |
| 3229 | 3222 | yumush.toggle_voice(community_id, window, cx) |
| 3230 | 3223 | }); |
| 3231 | - let empty = in_call.is_empty(); | |
| 3232 | - let pill = super::parts::pill("margin_join", palette.tokens, action) | |
| 3224 | + super::parts::pill("margin_join", palette.tokens, action) | |
| 3233 | 3225 | .self_start() |
| 3234 | 3226 | .gap(px(space::SM)) |
| 3235 | 3227 | .text_color(palette.tokens.ground()) |
| 3236 | 3228 | .font_weight(FontWeight::SEMIBOLD) |
| 3237 | - .child(super::parts::small_icon(IconName::Headphones)); | |
| 3238 | - if empty { | |
| 3239 | - pill.child(w().chat.join_voice) | |
| 3240 | - } else { | |
| 3241 | - pill.h(px(size::CHIP)).px(px(space::SM)).child(w().chat.join) | |
| 3242 | - } | |
| 3229 | + .child(super::parts::small_icon(IconName::Headphones)) | |
| 3230 | + .child(w().chat.join_voice) | |
| 3231 | + }); | |
| 3232 | + let call = (!in_call.is_empty() || join.is_some()).then(|| { | |
| 3233 | + div() | |
| 3234 | + .flex() | |
| 3235 | + .flex_col() | |
| 3236 | + .gap(px(space::SM)) | |
| 3237 | + .children(section(w().chat.in_voice, in_call, usize::MAX)) | |
| 3238 | + .children(join) | |
| 3243 | 3239 | }); |
| 3244 | - let call = if in_call.is_empty() { | |
| 3245 | - join.map(|join| div().child(join)) | |
| 3246 | - } else { | |
| 3247 | - section(w().chat.in_voice, in_call, usize::MAX, join) | |
| 3248 | - }; | |
| 3249 | 3240 | let online = members |
| 3250 | 3241 | .iter() |
| 3251 | 3242 | .filter(|row| !row.in_voice && row.presence != Presence::Offline) |
| @@ -3266,12 +3257,7 @@ fn members_column( | ||
| 3266 | 3257 | .gap(px(space::LG)) |
| 3267 | 3258 | .child(room_head(yumush, palette)) |
| 3268 | 3259 | .children(call) |
| 3269 | - .children(section( | |
| 3270 | - w().common.presence_online, | |
| 3271 | - online, | |
| 3272 | - usize::MAX, | |
| 3273 | - None, | |
| 3274 | - )) | |
| 3260 | + .children(section(w().common.presence_online, online, usize::MAX)) | |
| 3275 | 3261 | .children(section( |
| 3276 | 3262 | w().common.presence_offline, |
| 3277 | 3263 | offline, |
| @@ -3280,7 +3266,6 @@ fn members_column( | ||
| 3280 | 3266 | } else { |
| 3281 | 3267 | OFFLINE |
| 3282 | 3268 | }, |
| 3283 | - None, | |
| 3284 | 3269 | )), |
| 3285 | 3270 | ) |
| 3286 | 3271 | } |