feat(tui): hightlight repo alias in red when in alert

This commit is contained in:
Paul Campbell 2024-08-31 19:32:56 +01:00
parent 8550adf79e
commit 9720fd01fc

View file

@ -36,11 +36,16 @@ impl<'a> Identity<'a> {
impl<'a> Identity<'a> {
fn spans(self) -> Vec<Span<'a>> {
let label = self.label;
let repo_alias = self.repo_alias;
let repo_alias = Span::from(self.repo_alias.to_string()).style(if self.alert.is_some() {
Style::default().fg(Color::Black).bg(Color::Red)
} else {
Style::default().fg(Color::Cyan).bg(Color::Black)
});
let alert = self
.alert
.map_or(String::new(), |a| format!("{a} "))
.fg(Color::Red);
.fg(Color::Black)
.bg(Color::Red);
let message = self.message;
let main = self
.repo_branches
@ -56,7 +61,7 @@ impl<'a> Identity<'a> {
.map_or_else(|| "_".to_string(), |b| b.to_string());
vec![
" ".into(),
Span::from(repo_alias.to_string()).style(Style::default().fg(Color::Blue)),
repo_alias,
format!(" ({label}) ").into(),
alert,
format!("({main}/{next}/{dev}) [").into(),