Grid view keeps the chat: right column holds members (capped 40%, own scroll) over messages and composer, widened to size::MARGIN_CHAT
Browse files at this commit51367a5af0d47e831713855918f7be93ce0bff41Parent: 51655ad- feat
- grid view keeps the chat: right column holds members (capped 40%, own scroll) over messages and composer, widened to size::MARGIN_CHAT
2 changed files +70 -27
crates/client/design/tokens.tomlmodified+1 -0
| @@ -70,6 +70,7 @@ avatar_lg = 64 | |||
| 70 | thumb = 120 | 70 | thumb = 120 |
| 71 | sidebar = 230 | 71 | sidebar = 230 |
| 72 | margin = 280 | 72 | margin = 280 |
| 73 | +margin_chat = 360 | ||
| 73 | index = 200 | 74 | index = 200 |
| 74 | talk = 300 | 75 | talk = 300 |
| 75 | popover = 300 | 76 | popover = 300 |
crates/client/src/gui/chat.rsmodified+69 -27
| @@ -1414,29 +1414,76 @@ impl Yumush { | |||
| 1414 | panel.child(self.community_settings_page(entity, palette, cx)) | 1414 | panel.child(self.community_settings_page(entity, palette, cx)) |
| 1415 | } | 1415 | } |
| 1416 | View::Chat => match self.chat.selected_community_id { | 1416 | View::Chat => match self.chat.selected_community_id { |
| 1417 | - Some(_) => panel | 1417 | + Some(_) => { |
| 1418 | - .child(self.header(entity, themed)) | 1418 | + let viewer = self.inline_viewer(entity, themed); |
| 1419 | - .children(self.stage_strip(entity, themed)) | 1419 | + let grid = viewer |
| 1420 | - .children(self.unread_bar(entity, themed)) | 1420 | + .is_none() |
| 1421 | - .children(self.poll_banner(entity, themed)) | 1421 | + .then(|| self.stage_grid(entity, themed, cx)) |
| 1422 | - .child( | 1422 | + .flatten(); |
| 1423 | - div() | 1423 | + let side_chat = grid.is_some(); |
| 1424 | - .flex_1() | 1424 | + panel |
| 1425 | - .min_h_0() | 1425 | + .child(self.header(entity, themed)) |
| 1426 | - .flex() | 1426 | + .children(self.stage_strip(entity, themed)) |
| 1427 | - .child(div().flex_1().min_w_0().flex().flex_col().map(|panel| { | 1427 | + .children(self.unread_bar(entity, themed)) |
| 1428 | - match self.inline_viewer(entity, themed) { | 1428 | + .children(self.poll_banner(entity, themed)) |
| 1429 | - Some(viewer) => panel.child(viewer), | 1429 | + .child( |
| 1430 | - None => match self.stage_grid(entity, themed, cx) { | 1430 | + div() |
| 1431 | - Some(grid) => panel.child(grid), | 1431 | + .flex_1() |
| 1432 | - None => panel | 1432 | + .min_h_0() |
| 1433 | - .child(self.message_area(entity, themed)) | 1433 | + .flex() |
| 1434 | - .child(self.composer(entity, themed, cx)), | 1434 | + .child(div().flex_1().min_w_0().flex().flex_col().map( |
| 1435 | + |panel| { | ||
| 1436 | + match (viewer, grid) { | ||
| 1437 | + (Some(viewer), _) => panel.child(viewer), | ||
| 1438 | + (None, Some(grid)) => panel.child(grid), | ||
| 1439 | + (None, None) => panel | ||
| 1440 | + .child(self.message_area(entity, themed)) | ||
| 1441 | + .child(self.composer(entity, themed, cx)), | ||
| 1442 | + } | ||
| 1435 | }, | 1443 | }, |
| 1436 | - } | 1444 | + )) |
| 1437 | - })) | 1445 | + .children(members_column(entity, self, themed).map( |
| 1438 | - .children(members_column(entity, self, themed)), | 1446 | + |members| { |
| 1439 | - ), | 1447 | + div() |
| 1448 | + .w(px(if side_chat { | ||
| 1449 | + size::MARGIN_CHAT | ||
| 1450 | + } else { | ||
| 1451 | + size::MARGIN | ||
| 1452 | + })) | ||
| 1453 | + .flex_none() | ||
| 1454 | + .h_full() | ||
| 1455 | + .flex() | ||
| 1456 | + .flex_col() | ||
| 1457 | + .border_l_1() | ||
| 1458 | + .border_color(palette.border) | ||
| 1459 | + .child(if side_chat { | ||
| 1460 | + members | ||
| 1461 | + .flex_none() | ||
| 1462 | + .max_h(gpui_kit::relative(0.4)) | ||
| 1463 | + } else { | ||
| 1464 | + members.flex_1().min_h_0() | ||
| 1465 | + }) | ||
| 1466 | + .when(side_chat, |column| { | ||
| 1467 | + column.child( | ||
| 1468 | + div() | ||
| 1469 | + .flex_1() | ||
| 1470 | + .min_h_0() | ||
| 1471 | + .flex() | ||
| 1472 | + .flex_col() | ||
| 1473 | + .border_t_1() | ||
| 1474 | + .border_color(palette.border) | ||
| 1475 | + .child( | ||
| 1476 | + self.message_area(entity, themed), | ||
| 1477 | + ) | ||
| 1478 | + .child( | ||
| 1479 | + self.composer(entity, themed, cx), | ||
| 1480 | + ), | ||
| 1481 | + ) | ||
| 1482 | + }) | ||
| 1483 | + }, | ||
| 1484 | + )), | ||
| 1485 | + ) | ||
| 1486 | + } | ||
| 1440 | None => panel.child(empty_state(palette)), | 1487 | None => panel.child(empty_state(palette)), |
| 1441 | }, | 1488 | }, |
| 1442 | }) | 1489 | }) |
| @@ -3191,17 +3238,12 @@ fn members_column( | |||
| 3191 | Some( | 3238 | Some( |
| 3192 | div() | 3239 | div() |
| 3193 | .id("members_column") | 3240 | .id("members_column") |
| 3194 | - .w(px(size::MARGIN)) | ||
| 3195 | - .flex_none() | ||
| 3196 | - .h_full() | ||
| 3197 | .overflow_y_scroll() | 3241 | .overflow_y_scroll() |
| 3198 | .px(px(space::SM)) | 3242 | .px(px(space::SM)) |
| 3199 | .py(px(space::MD)) | 3243 | .py(px(space::MD)) |
| 3200 | .flex() | 3244 | .flex() |
| 3201 | .flex_col() | 3245 | .flex_col() |
| 3202 | .gap(px(space::LG)) | 3246 | .gap(px(space::LG)) |
| 3203 | - .border_l_1() | ||
| 3204 | - .border_color(palette.border) | ||
| 3205 | .child(room_head(yumush, palette)) | 3247 | .child(room_head(yumush, palette)) |
| 3206 | .children(call) | 3248 | .children(call) |
| 3207 | .children(section( | 3249 | .children(section( |