Skip to content

Commit 523101f

Browse files
committed
Added version to footer. Updated version to 0.2.3
1 parent 9f67edd commit 523101f

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "blockchaininfo"
3-
version = "0.2.2"
3+
version = "0.2.3"
44
edition = "2021"
55

66
[[bench]]

src/assets/output.png

240 KB
Loading

src/utils.rs

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ const TB: u64 = GB * 1024;
2020
// Constants for estimated difficulty adjustment change.
2121
pub const DIFFICULTY_ADJUSTMENT_INTERVAL: u64 = 2016;
2222
pub const BLOCK_TIME_SECONDS: u64 = 600;
23+
const APP_VERSION: &str = env!("CARGO_PKG_VERSION");
24+
2325

2426

2527
// Formats a size in bytes into a more readable format (KB, MB, etc.).
@@ -122,14 +124,27 @@ pub fn render_header() -> Paragraph<'static> {
122124

123125
// Create the paragraph widget.
124126
Paragraph::new(lines)
125-
.block(Block::default().title("").borders(Borders::NONE))
127+
.block(Block::default().title("").borders(Borders::NONE))
126128
}
127129

128130
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())
131145
.alignment(Alignment::Center)
132146
.block(Block::default().borders(Borders::NONE));
147+
133148
f.render_widget(footer, area);
134149
}
135150

0 commit comments

Comments
 (0)