@@ -20,6 +20,8 @@ const TB: u64 = GB * 1024;
20
20
// Constants for estimated difficulty adjustment change.
21
21
pub const DIFFICULTY_ADJUSTMENT_INTERVAL : u64 = 2016 ;
22
22
pub const BLOCK_TIME_SECONDS : u64 = 600 ;
23
+ const APP_VERSION : & str = env ! ( "CARGO_PKG_VERSION" ) ;
24
+
23
25
24
26
25
27
// Formats a size in bytes into a more readable format (KB, MB, etc.).
@@ -122,14 +124,27 @@ pub fn render_header() -> Paragraph<'static> {
122
124
123
125
// Create the paragraph widget.
124
126
Paragraph :: new ( lines)
125
- . block ( Block :: default ( ) . title ( "" ) . borders ( Borders :: NONE ) )
127
+ . block ( Block :: default ( ) . title ( "" ) . borders ( Borders :: NONE ) )
126
128
}
127
129
128
130
pub fn render_footer < B : Backend > ( f : & mut Frame < B > , area : Rect ) {
129
- let footer = Paragraph :: new ( "Press 'q' or ESC to quit." )
130
- . style ( Style :: default ( ) . fg ( Color :: Gray ) )
131
+ // Combine the footer message and app version.
132
+ let footer_text = vec ! [
133
+ Spans :: from( Span :: styled(
134
+ "Press 'q' or ESC to quit." ,
135
+ Style :: default ( ) . fg( Color :: Gray ) ,
136
+ ) ) ,
137
+ Spans :: from( Span :: styled(
138
+ format!( "v{}" , APP_VERSION ) ,
139
+ Style :: default ( ) . fg( Color :: DarkGray ) . add_modifier( Modifier :: ITALIC ) ,
140
+ ) ) ,
141
+ ] ;
142
+
143
+ let footer = Paragraph :: new ( footer_text)
144
+ . style ( Style :: default ( ) )
131
145
. alignment ( Alignment :: Center )
132
146
. block ( Block :: default ( ) . borders ( Borders :: NONE ) ) ;
147
+
133
148
f. render_widget ( footer, area) ;
134
149
}
135
150
0 commit comments