-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
304a546
commit ddb9173
Showing
1 changed file
with
40 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,48 @@ | ||
use tui::{ | ||
layout::Alignment, | ||
style::{Modifier, Style}, | ||
text::{Span, Spans}, | ||
widgets::{Block, BorderType, Borders, Paragraph}, | ||
Terminal | ||
layout::Alignment, | ||
style::{ Modifier, Style, Color }, | ||
text::Span, | ||
widgets::{ Block, BorderType, Borders, Paragraph }, | ||
}; | ||
|
||
|
||
pub fn render_waiting_screen<B: tui::backend::Backend>( | ||
terminal: &mut Terminal<B>, | ||
terminal: &mut tui::Terminal<B> | ||
) -> Result<(), Box<dyn std::error::Error>> { | ||
let loading_screen = vec![ | ||
Spans::from(Span::styled("Loading GitHub data...", Style::default().add_modifier(Modifier::BOLD))), | ||
Spans::from(Span::raw("")), | ||
Spans::from(Span::styled("Please wait while we fetch the data from GitHub...", Style::default())), | ||
]; | ||
let loading_text = | ||
r#" | ||
██████╗ ██╗████████╗██╗ ██╗██╗ ██╗██████╗ | ||
██╔════╝ ██║╚══██╔══╝██║ ██║██║ ██║██╔══██╗ | ||
██║ ███╗██║ ██║ ███████║██║ ██║██████╔╝ | ||
██║ ██║██║ ██║ ██╔══██║██║ ██║██╔══██╗ | ||
╚██████╔╝██║ ██║ ██║ ██║╚██████╔╝██████╔╝ | ||
╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═════╝ | ||
█████╗ ███████╗███████╗██╗███████╗████████╗ █████╗ ███╗ ██╗████████╗ | ||
██╔══██╗██╔════╝██╔════╝██║██╔════╝╚══██╔══╝██╔══██╗████╗ ██║╚══██╔══╝ | ||
███████║███████╗███████╗██║███████╗ ██║ ███████║██╔██╗ ██║ ██║ | ||
██╔══██║╚════██║╚════██║██║╚════██║ ██║ ██╔══██║██║╚██╗██║ ██║ | ||
██║ ██║███████║███████║██║███████║ ██║ ██║ ██║██║ ╚████║ ██║ | ||
╚═╝ ╚═╝╚══════╝╚══════╝╚═╝╚══════╝ ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═══╝ ╚═╝ | ||
"#; | ||
|
||
let loading_screen_paragraph = Paragraph::new(loading_text) | ||
.alignment(Alignment::Center) | ||
.block( | ||
Block::default() | ||
.title( | ||
Span::styled("GitHub Assistant", Style::default().add_modifier(Modifier::BOLD)) | ||
) | ||
.borders(Borders::ALL) | ||
.border_style(Style::default().fg(Color::White).bg(Color::DarkGray)) | ||
.border_type(BorderType::Rounded) | ||
); | ||
|
||
terminal.draw(|f| { | ||
let size = f.size(); | ||
let loading_screen_paragraph = Paragraph::new(loading_screen.clone()) | ||
.alignment(Alignment::Center) | ||
.block( | ||
Block::default() | ||
.title(Span::styled("GitHub Assistant", Style::default().add_modifier(Modifier::BOLD))) | ||
.borders(Borders::ALL).border_type(BorderType::Rounded), | ||
); | ||
f.render_widget(loading_screen_paragraph, size); | ||
})?; | ||
terminal.draw(|f| { | ||
let size = f.size(); | ||
f.render_widget(loading_screen_paragraph, size); | ||
})?; | ||
|
||
Ok(()) | ||
Ok(()) | ||
} |