64 lines
2.1 KiB
Rust
64 lines
2.1 KiB
Rust
use ratatui::layout::{Alignment, Constraint, Layout, Rect};
|
|
use ratatui::style::Style;
|
|
use ratatui::text::{Line, Span};
|
|
use ratatui::widgets::Paragraph;
|
|
use ratatui::Frame;
|
|
use tui_big_text::{BigText, PixelSize};
|
|
|
|
use crate::state::ui::UiState;
|
|
use crate::theme;
|
|
|
|
pub fn render(frame: &mut Frame, area: Rect, ui: &UiState) {
|
|
let theme = theme::get();
|
|
frame.render_widget(&ui.sparkles, area);
|
|
|
|
let author_style = Style::new().fg(theme.title.author);
|
|
let link_style = Style::new().fg(theme.title.link);
|
|
let license_style = Style::new().fg(theme.title.license);
|
|
|
|
let big_title = BigText::builder()
|
|
.pixel_size(PixelSize::Quadrant)
|
|
.style(Style::new().fg(theme.title.big_title).bold())
|
|
.lines(vec!["CAGIRE".into()])
|
|
.centered()
|
|
.build();
|
|
|
|
let subtitle_lines = vec![
|
|
Line::from(""),
|
|
Line::from(Span::styled(
|
|
"A Forth Music Sequencer",
|
|
Style::new().fg(theme.title.subtitle),
|
|
)),
|
|
Line::from(""),
|
|
Line::from(Span::styled("by BuboBubo", author_style)),
|
|
Line::from(""),
|
|
Line::from(Span::styled("https://raphaelforment.fr", link_style)),
|
|
Line::from(""),
|
|
Line::from(Span::styled("AGPL-3.0", license_style)),
|
|
Line::from(""),
|
|
Line::from(""),
|
|
Line::from(Span::styled(
|
|
"Press any key to continue",
|
|
Style::new().fg(theme.title.prompt),
|
|
)),
|
|
];
|
|
|
|
let big_text_height = 4;
|
|
let subtitle_height = subtitle_lines.len() as u16;
|
|
let total_height = big_text_height + subtitle_height;
|
|
let vertical_padding = area.height.saturating_sub(total_height) / 2;
|
|
|
|
let [_, title_area, subtitle_area, _] = Layout::vertical([
|
|
Constraint::Length(vertical_padding),
|
|
Constraint::Length(big_text_height),
|
|
Constraint::Length(subtitle_height),
|
|
Constraint::Fill(1),
|
|
])
|
|
.areas(area);
|
|
|
|
frame.render_widget(big_title, title_area);
|
|
|
|
let subtitle = Paragraph::new(subtitle_lines).alignment(Alignment::Center);
|
|
frame.render_widget(subtitle, subtitle_area);
|
|
}
|