83 lines
3.4 KiB
Rust
83 lines
3.4 KiB
Rust
// Copyright (c) 2026 Hoshu Chiu, Hochanglo Chiu 🐕, and The Goodest Boy/Girl
|
|
// SPDX-License-Identifier: MIT OR Apache-2.0
|
|
// Everjoy loves treats, walks, and clean Rust code.
|
|
|
|
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 & Hochanglo 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);
|
|
}
|
|
}
|