feat(tui): use moving heart emoji as liveness indicator
All checks were successful
Rust / build (push) Successful in 7m17s
ci/woodpecker/push/push-next Pipeline was successful
ci/woodpecker/push/cron-docker-builder Pipeline was successful
ci/woodpecker/push/tag-created Pipeline was successful
Release Please / Release-plz (push) Successful in 52s
All checks were successful
Rust / build (push) Successful in 7m17s
ci/woodpecker/push/push-next Pipeline was successful
ci/woodpecker/push/cron-docker-builder Pipeline was successful
ci/woodpecker/push/tag-created Pipeline was successful
Release Please / Release-plz (push) Successful in 52s
The heart moves between two positions every second as long as the ui is being updated.
This commit is contained in:
parent
a3dd82705f
commit
eca556f976
1 changed files with 11 additions and 5 deletions
|
@ -40,6 +40,15 @@ impl State {
|
|||
*tick += 1;
|
||||
}
|
||||
}
|
||||
|
||||
fn beating_heart(&self) -> String {
|
||||
if self.last_update.duration_since(self.started).as_secs() % 2 == 0 {
|
||||
"💚 "
|
||||
} else {
|
||||
" 💚"
|
||||
}
|
||||
.to_string()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
|
@ -326,11 +335,8 @@ impl StatefulWidget for &State {
|
|||
.title(
|
||||
Title::from(Line::from(vec![
|
||||
" [q]uit ".into(),
|
||||
format!(
|
||||
"{}s ",
|
||||
self.last_update.duration_since(self.started).as_secs()
|
||||
)
|
||||
.into(),
|
||||
self.beating_heart().into(),
|
||||
" ".into(),
|
||||
]))
|
||||
.alignment(Alignment::Center)
|
||||
.position(ratatui::widgets::block::Position::Bottom),
|
||||
|
|
Loading…
Reference in a new issue