Feat: fixing ratatui big-text and UX
This commit is contained in:
@@ -4,7 +4,6 @@ use ratatui::style::{Color, Modifier, Style};
|
||||
use ratatui::text::{Line as RLine, Span};
|
||||
use ratatui::widgets::{Block, Borders, Padding, Paragraph, Wrap};
|
||||
use ratatui::Frame;
|
||||
#[cfg(not(feature = "desktop"))]
|
||||
use tui_big_text::{BigText, PixelSize};
|
||||
|
||||
use crate::app::App;
|
||||
@@ -129,10 +128,7 @@ fn render_topics(frame: &mut Frame, app: &App, area: Rect) {
|
||||
}
|
||||
|
||||
const WELCOME_TOPIC: usize = 0;
|
||||
#[cfg(not(feature = "desktop"))]
|
||||
const BIG_TITLE_HEIGHT: u16 = 6;
|
||||
#[cfg(feature = "desktop")]
|
||||
const BIG_TITLE_HEIGHT: u16 = 3;
|
||||
|
||||
fn render_content(frame: &mut Frame, app: &App, area: Rect) {
|
||||
let theme = theme::get();
|
||||
@@ -146,19 +142,12 @@ fn render_content(frame: &mut Frame, app: &App, area: Rect) {
|
||||
Layout::vertical([Constraint::Length(BIG_TITLE_HEIGHT), Constraint::Fill(1)])
|
||||
.areas(area);
|
||||
|
||||
#[cfg(not(feature = "desktop"))]
|
||||
let big_title = BigText::builder()
|
||||
.pixel_size(PixelSize::Quadrant)
|
||||
.style(Style::new().fg(theme.markdown.h1).bold())
|
||||
.lines(vec!["CAGIRE".into()])
|
||||
.centered()
|
||||
.build();
|
||||
#[cfg(feature = "desktop")]
|
||||
let big_title = Paragraph::new(RLine::from(Span::styled(
|
||||
"CAGIRE",
|
||||
Style::new().fg(theme.markdown.h1).bold(),
|
||||
)))
|
||||
.alignment(ratatui::layout::Alignment::Center);
|
||||
|
||||
let subtitle = Paragraph::new(RLine::from(Span::styled(
|
||||
"A Forth Sequencer",
|
||||
@@ -166,12 +155,8 @@ fn render_content(frame: &mut Frame, app: &App, area: Rect) {
|
||||
)))
|
||||
.alignment(ratatui::layout::Alignment::Center);
|
||||
|
||||
#[cfg(not(feature = "desktop"))]
|
||||
let [big_area, subtitle_area] =
|
||||
Layout::vertical([Constraint::Length(4), Constraint::Length(2)]).areas(title_area);
|
||||
#[cfg(feature = "desktop")]
|
||||
let [big_area, subtitle_area] =
|
||||
Layout::vertical([Constraint::Length(1), Constraint::Length(2)]).areas(title_area);
|
||||
|
||||
frame.render_widget(big_title, big_area);
|
||||
frame.render_widget(subtitle, subtitle_area);
|
||||
|
||||
Reference in New Issue
Block a user