Remove additional wrapping elements in the chat panel (#14013)

This PR removes some wrapping elements that were used inside of the chat
panel.

To facilitate this, the `Label` component now has a `weight` method to
change the font weight.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2024-07-09 15:27:37 -04:00 committed by GitHub
parent df935df5a3
commit c6b9f1920f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 39 additions and 26 deletions

View file

@ -355,11 +355,10 @@ impl ChatPanel {
.child(Icon::new(IconName::ReplyArrowRight).color(Color::Muted))
.child(Avatar::new(user_being_replied_to.avatar_uri.clone()).size(rems(0.7)))
.child(
div().font_weight(FontWeight::SEMIBOLD).child(
Label::new(format!("@{}", user_being_replied_to.github_login))
.size(LabelSize::XSmall)
.color(Color::Muted),
),
Label::new(format!("@{}", user_being_replied_to.github_login))
.size(LabelSize::XSmall)
.weight(FontWeight::SEMIBOLD)
.color(Color::Muted),
)
.child(
div().overflow_y_hidden().child(
@ -490,22 +489,16 @@ impl ChatPanel {
|this| {
this.child(
h_flex()
.gap_2()
.text_ui_sm(cx)
.child(
div().absolute().child(
Avatar::new(message.sender.avatar_uri.clone())
.size(rems(1.)),
),
Avatar::new(message.sender.avatar_uri.clone())
.size(rems(1.)),
)
.child(
div()
.pl(cx.rem_size() + px(6.0))
.pr(px(8.0))
.font_weight(FontWeight::BOLD)
.child(
Label::new(message.sender.github_login.clone())
.size(LabelSize::Small),
),
Label::new(message.sender.github_login.clone())
.size(LabelSize::Small)
.weight(FontWeight::BOLD),
)
.child(
Label::new(time_format::format_localized_timestamp(
@ -1044,13 +1037,12 @@ impl Render for ChatPanel {
.id(("reply-preview", reply_to_message_id))
.child(Label::new("Replying to ").size(LabelSize::Small))
.child(
div().font_weight(FontWeight::BOLD).child(
Label::new(format!(
"@{}",
user_being_replied_to.github_login.clone()
))
.size(LabelSize::Small),
),
Label::new(format!(
"@{}",
user_being_replied_to.github_login.clone()
))
.size(LabelSize::Small)
.weight(FontWeight::BOLD),
)
.when_some(channel_id, |this, channel_id| {
this.cursor_pointer().on_click(cx.listener(