File tree Expand file tree Collapse file tree 3 files changed +27
-20
lines changed Expand file tree Collapse file tree 3 files changed +27
-20
lines changed Original file line number Diff line number Diff line change @@ -75,17 +75,20 @@ impl Widget for &CurrencyComponent {
75
75
format ! ( "last update {date} {time}" )
76
76
} ;
77
77
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)
89
92
}
90
93
Err ( e) => {
91
94
let error_lines = fit_into ( e. to_string ( ) , ( area. width - 2 ) as usize ) ;
Original file line number Diff line number Diff line change @@ -107,20 +107,25 @@ impl Widget for &TransportComponent {
107
107
] ;
108
108
109
109
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
+
113
116
if self . departures . site_errors . contains_key ( & site. id ) {
114
117
lines. push ( Line :: from ( format ! (
115
118
"Error: {}" ,
116
119
self . departures. site_errors[ & site. id]
117
120
) ) )
118
121
}
122
+
119
123
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
+ ] ) ) ;
124
129
}
125
130
lines. push ( Line :: from ( "" ) ) ;
126
131
}
Original file line number Diff line number Diff line change 1
1
use chrono:: prelude:: { DateTime , Local , Timelike } ;
2
- use log:: trace;
3
2
use std:: time:: { Duration , SystemTime } ;
4
3
5
4
use ratatui:: {
@@ -107,7 +106,7 @@ impl Widget for &WeatherComponent {
107
106
] )
108
107
. centered( ) ,
109
108
Line :: from( separator. clone( ) ) . centered( ) ,
110
- Line :: from( "Weather" . bold( ) ) . centered( ) ,
109
+ Line :: from( "Weather" . bold( ) ) . centered( ) . underlined ( ) ,
111
110
Line :: from( "" ) ,
112
111
Line :: from( match weather. weather[ 0 ] . icon. as_str( ) {
113
112
"01d" => "☀" , // Sun
You can’t perform that action at this time.
0 commit comments