In a direct chat the header's avatar and name open the person's card
Browse files at this commiteccb83b6871c3d3b393d5a598d1fc5f99f04be3aParent: e4dde77- feat
- in a direct chat the header's avatar and name open the person's card
1 changed file +54 -22
- crates/client/src/gui/chat.rs +54 -22
crates/client/src/gui/chat.rsmodified+54 -22
| @@ -1508,6 +1508,16 @@ impl Yumush { | |||
| 1508 | let group = | 1508 | let group = |
| 1509 | community.is_some_and(|community| matches!(community.kind, CommunityKind::Group)); | 1509 | community.is_some_and(|community| matches!(community.kind, CommunityKind::Group)); |
| 1510 | let voice = self.voice_toggle(entity, palette); | 1510 | let voice = self.voice_toggle(entity, palette); |
| 1511 | + let peer = community.and_then(|community| match &community.kind { | ||
| 1512 | + CommunityKind::Direct { peer } => Some(self.chat.author(peer.id).unwrap_or(peer)), | ||
| 1513 | + _ => None, | ||
| 1514 | + }); | ||
| 1515 | + let title = super::parts::words( | ||
| 1516 | + name.to_string(), | ||
| 1517 | + super::parts::Text::Title, | ||
| 1518 | + super::parts::Ink::Paper, | ||
| 1519 | + palette.tokens, | ||
| 1520 | + ); | ||
| 1511 | 1521 | ||
| 1512 | div() | 1522 | div() |
| 1513 | .h(px(size::ROW + space::MD)) | 1523 | .h(px(size::ROW + space::MD)) |
| @@ -1515,30 +1525,52 @@ impl Yumush { | |||
| 1515 | .flex() | 1525 | .flex() |
| 1516 | .items_center() | 1526 | .items_center() |
| 1517 | .gap(px(space::SM)) | 1527 | .gap(px(space::SM)) |
| 1518 | - .children(community.map(|community| { | 1528 | + .child(match peer { |
| 1519 | - super::zoomable( | 1529 | + Some(peer) => super::profile::profile_popover( |
| 1530 | + "header_peer", | ||
| 1531 | + Anchor::TopLeft, | ||
| 1532 | + peer, | ||
| 1520 | entity, | 1533 | entity, |
| 1521 | - "header_picture", | 1534 | + div() |
| 1522 | - super::community_icon( | 1535 | + .cursor_pointer() |
| 1523 | - palette, | 1536 | + .flex() |
| 1524 | - community, | 1537 | + .items_center() |
| 1525 | - px(size::AVATAR), | 1538 | + .gap(px(space::SM)) |
| 1526 | - super::text(super::style::text::CAPTION), | 1539 | + .child(super::avatar( |
| 1527 | - &self.chat.avatars, | 1540 | + palette, |
| 1528 | - ), | 1541 | + peer, |
| 1529 | - super::Zoom::new( | 1542 | + px(size::AVATAR), |
| 1530 | - super::picture_of(community, &self.chat.avatars), | 1543 | + super::text(super::style::text::CAPTION), |
| 1531 | - !matches!(community.kind, CommunityKind::Group), | 1544 | + &self.chat.avatars, |
| 1532 | - name.to_string(), | 1545 | + )) |
| 1533 | - ), | 1546 | + .child(title), |
| 1534 | ) | 1547 | ) |
| 1535 | - })) | 1548 | + .into_any_element(), |
| 1536 | - .child(super::parts::words( | 1549 | + None => div() |
| 1537 | - name.to_string(), | 1550 | + .flex() |
| 1538 | - super::parts::Text::Title, | 1551 | + .items_center() |
| 1539 | - super::parts::Ink::Paper, | 1552 | + .gap(px(space::SM)) |
| 1540 | - palette.tokens, | 1553 | + .children(community.map(|community| { |
| 1541 | - )) | 1554 | + super::zoomable( |
| 1555 | + entity, | ||
| 1556 | + "header_picture", | ||
| 1557 | + super::community_icon( | ||
| 1558 | + palette, | ||
| 1559 | + community, | ||
| 1560 | + px(size::AVATAR), | ||
| 1561 | + super::text(super::style::text::CAPTION), | ||
| 1562 | + &self.chat.avatars, | ||
| 1563 | + ), | ||
| 1564 | + super::Zoom::new( | ||
| 1565 | + super::picture_of(community, &self.chat.avatars), | ||
| 1566 | + !matches!(community.kind, CommunityKind::Group), | ||
| 1567 | + name.to_string(), | ||
| 1568 | + ), | ||
| 1569 | + ) | ||
| 1570 | + })) | ||
| 1571 | + .child(title) | ||
| 1572 | + .into_any_element(), | ||
| 1573 | + }) | ||
| 1542 | .child(div().flex_1()) | 1574 | .child(div().flex_1()) |
| 1543 | .children( | 1575 | .children( |
| 1544 | community | 1576 | community |