Skip to content

Commit ee40132

Browse files
committed
finished updating tui
1 parent e7d67d4 commit ee40132

File tree

3 files changed

+27
-20
lines changed

3 files changed

+27
-20
lines changed

tui/src/currency.rs

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -75,17 +75,20 @@ impl Widget for &CurrencyComponent {
7575
format!("last update {date} {time}")
7676
};
7777

78-
Text::from(vec![
79-
Line::from(vec![
80-
format!("{:.2} ", conversion.from_currency_amount).bold(),
81-
conversion.from_currency.as_str().green(),
82-
" = ".into(),
83-
format!("{:.2} ", conversion.to_currency_amount).bold(),
84-
conversion.to_currency.as_str().green(),
85-
])
86-
.centered(),
87-
Line::from(refresh_date.gray()).centered(),
88-
])
78+
let mut lines: Vec<Line> = Vec::new();
79+
for _ in 1..(area.height - 2) / 2 {
80+
lines.push(Line::from(""))
81+
}
82+
lines.push(Line::from(vec![
83+
format!("{:.2} ", conversion.from_currency_amount).bold(),
84+
conversion.from_currency.as_str().green(),
85+
" = ".into(),
86+
format!("{:.2} ", conversion.to_currency_amount).bold(),
87+
conversion.to_currency.as_str().green(),
88+
]).centered());
89+
lines.push(Line::from(refresh_date.gray()).centered());
90+
91+
Text::from(lines)
8992
}
9093
Err(e) => {
9194
let error_lines = fit_into(e.to_string(), (area.width - 2) as usize);

tui/src/transports.rs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -107,20 +107,25 @@ impl Widget for &TransportComponent {
107107
];
108108

109109
for site in &self.departures.sites {
110-
lines.push(Line::from(
111-
format!(" {}", site.name.as_str()).red().bold().underlined(),
112-
));
110+
lines.push(Line::from(vec![
111+
" ".into(),
112+
format!("{}", site.name.as_str()).red().bold().underlined(),
113+
" 🚂".into(),
114+
]));
115+
113116
if self.departures.site_errors.contains_key(&site.id) {
114117
lines.push(Line::from(format!(
115118
"Error: {}",
116119
self.departures.site_errors[&site.id]
117120
)))
118121
}
122+
119123
for departure in &self.departures.departures[&site.id] {
120-
lines.push(Line::from(format!(
121-
" {:6} - {} {}",
122-
departure.display, departure.line.id, departure.destination
123-
)));
124+
lines.push(Line::from(vec![
125+
format!(" {:6}", departure.display).into(),
126+
format!(" - {}", departure.line.id).bold(),
127+
format!(" {}", departure.destination).into()
128+
]));
124129
}
125130
lines.push(Line::from(""));
126131
}

tui/src/weather.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use chrono::prelude::{DateTime, Local, Timelike};
2-
use log::trace;
32
use std::time::{Duration, SystemTime};
43

54
use ratatui::{
@@ -107,7 +106,7 @@ impl Widget for &WeatherComponent {
107106
])
108107
.centered(),
109108
Line::from(separator.clone()).centered(),
110-
Line::from("Weather".bold()).centered(),
109+
Line::from("Weather".bold()).centered().underlined(),
111110
Line::from(""),
112111
Line::from(match weather.weather[0].icon.as_str() {
113112
"01d" => "☀", // Sun

0 commit comments

Comments
 (0)