Skip to content

Commit

Permalink
Simplify highlight box for /me action
Browse files Browse the repository at this point in the history
  • Loading branch information
englut committed Dec 16, 2024
1 parent f0c6e33 commit 3d97d05
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 25 deletions.
24 changes: 8 additions & 16 deletions src/buffer/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,22 +214,14 @@ pub fn view<'a>(
config,
);

let text_container =
container(message_content).style(move |theme| match user {
Some(user) => match our_nick {
Some(nick)
if message::references_user(
user.nickname(),
nick,
message,
) =>
{
theme::container::highlight(theme)
}
_ => Default::default(),
},
_ => Default::default(),
});
let text_container = container(message_content).style(move |theme| {
if let (Some(user), Some(nick)) = (user, our_nick) {
if message::references_user(user.nickname(), nick, message) {
return theme::container::highlight(theme);
}
}
Default::default()
});

Some(
container(
Expand Down
13 changes: 4 additions & 9 deletions src/buffer/highlights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ pub fn view<'a>(
)
.into(),
)
},
}
message::Target::Highlights {
server,
channel,
Expand Down Expand Up @@ -141,15 +141,10 @@ pub fn view<'a>(
);

Some(
container(
row![]
.push_maybe(timestamp)
.push(channel_text)
.push(text),
)
.into(),
container(row![].push_maybe(timestamp).push(channel_text).push(text))
.into(),
)
},
}
_ => None,
},
)
Expand Down

0 comments on commit 3d97d05

Please sign in to comment.