use ratatui::layout::{Alignment, Constraint, Layout, Rect}; use ratatui::style::{Color, Style, Stylize}; use ratatui::text::{Line, Span}; use ratatui::widgets::Paragraph; use ratatui::Frame; use tui_big_text::{BigText, PixelSize}; use crate::state::ui::UiState; pub fn render(frame: &mut Frame, area: Rect, ui: &UiState) { frame.render_widget(&ui.sparkles, area); let author_style = Style::new().fg(Color::Rgb(180, 140, 200)); let link_style = Style::new().fg(Color::Rgb(120, 200, 180)); let license_style = Style::new().fg(Color::Rgb(200, 160, 100)); let big_title = BigText::builder() .pixel_size(PixelSize::Quadrant) .style(Style::new().cyan().bold()) .lines(vec!["CAGIRE".into()]) .centered() .build(); let subtitle_lines = vec![ Line::from(""), Line::from(Span::styled( "A Forth Music Sequencer", Style::new().fg(Color::White), )), 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(Color::Rgb(140, 160, 170)), )), ]; 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); }