Maybe Runtime subsystem done
This commit is contained in:
78
src/ui/splash.rs
Normal file
78
src/ui/splash.rs
Normal file
@@ -0,0 +1,78 @@
|
||||
use ratatui::{
|
||||
buffer::Buffer,
|
||||
layout::{Alignment, Constraint, Direction, Layout, Rect},
|
||||
style::{Color, Modifier, Style},
|
||||
text::Line,
|
||||
widgets::{Paragraph, Widget},
|
||||
};
|
||||
|
||||
/// Splash screen shown on startup.
|
||||
pub struct SplashScreen;
|
||||
|
||||
impl Widget for &SplashScreen {
|
||||
fn render(self, area: Rect, buf: &mut Buffer) {
|
||||
// Background
|
||||
for y in area.top()..area.bottom() {
|
||||
for x in area.left()..area.right() {
|
||||
buf[(x, y)].set_bg(Color::Rgb(20, 18, 15));
|
||||
}
|
||||
}
|
||||
|
||||
let vertical = Layout::default()
|
||||
.direction(Direction::Vertical)
|
||||
.constraints([
|
||||
Constraint::Percentage(20),
|
||||
Constraint::Length(8),
|
||||
Constraint::Length(1),
|
||||
Constraint::Length(1),
|
||||
Constraint::Length(1),
|
||||
Constraint::Length(1),
|
||||
Constraint::Min(0),
|
||||
])
|
||||
.split(area);
|
||||
|
||||
// ASCII art dog
|
||||
let dog = Paragraph::new(vec![
|
||||
Line::from(" ████████ "),
|
||||
Line::from(" ████░░░░░░████ "),
|
||||
Line::from(" ████░░░░░░░░░░████ "),
|
||||
Line::from(" ████░░░▓▓▓▓▓▓░░░████ "),
|
||||
Line::from(" ████░░░▓░░░░░░▓░░░████ "),
|
||||
Line::from(" ███░░░░▓░░▓▓░░▓░░░░███ "),
|
||||
Line::from(" ███░░░░░▓░░░░░▓░░░░░███ "),
|
||||
Line::from(" ███░░░░░▓▓▓▓▓▓░░░░░███ "),
|
||||
])
|
||||
.alignment(Alignment::Center)
|
||||
.style(Style::default().fg(Color::Rgb(210, 170, 90)));
|
||||
dog.render(vertical[1], buf);
|
||||
|
||||
// Title
|
||||
let title = Paragraph::new("EVERJOY")
|
||||
.alignment(Alignment::Center)
|
||||
.style(
|
||||
Style::default()
|
||||
.fg(Color::Rgb(210, 170, 90))
|
||||
.add_modifier(Modifier::BOLD)
|
||||
.add_modifier(Modifier::UNDERLINED),
|
||||
);
|
||||
title.render(vertical[2], buf);
|
||||
|
||||
// Subtitle
|
||||
let subtitle = Paragraph::new("An AI-native TUI workflow")
|
||||
.alignment(Alignment::Center)
|
||||
.style(Style::default().fg(Color::Rgb(150, 140, 130)).add_modifier(Modifier::ITALIC));
|
||||
subtitle.render(vertical[3], buf);
|
||||
|
||||
// Version
|
||||
let version = Paragraph::new("v0.1.0 — for Hoshu Chiu & Everjoy Chiu 🐕")
|
||||
.alignment(Alignment::Center)
|
||||
.style(Style::default().fg(Color::Rgb(120, 110, 100)));
|
||||
version.render(vertical[4], buf);
|
||||
|
||||
// Hint
|
||||
let hint = Paragraph::new("◀ Press any key to start ▶")
|
||||
.alignment(Alignment::Center)
|
||||
.style(Style::default().fg(Color::Rgb(180, 180, 180)).add_modifier(Modifier::BOLD));
|
||||
hint.render(vertical[5], buf);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user