Files
logViewer/crates/tui/src/ui.rs
2026-04-10 21:20:14 +08:00

27 lines
760 B
Rust
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
use crate::app::App;
pub fn render(frame: &mut ratatui::Frame, _app: &App) {
use ratatui::layout::{Constraint, Layout};
use ratatui::widgets::{Block, Borders, Paragraph};
let chunks = Layout::vertical([
Constraint::Length(1),
Constraint::Min(1),
Constraint::Length(1),
])
.split(frame.area());
frame.render_widget(
Paragraph::new(" Log Viewer").style(ratatui::style::Style::default().bold()),
chunks[0],
);
// Main area — 使用 Block::new()ratatui 0.30 推荐风格)
frame.render_widget(
Block::new().borders(Borders::ALL).title("No file loaded"),
chunks[1],
);
frame.render_widget(Paragraph::new(" Press '?' for help | q to quit"), chunks[2]);
}