//! Preview pane widget.

use ratatui::{
    prelude::*,
    widgets::{Block, Borders, Paragraph, Wrap},
};

use crate::daemon::tui::app::App;

pub fn render(f: &mut Frame, area: Rect, app: &App) {
    let content = app
        .preview_content
        .as_deref()
        .unwrap_or("No preview available");

    let preview = Paragraph::new(content)
        .block(Block::default().title(" Preview ").borders(Borders::ALL))
        .wrap(Wrap { trim: true });

    f.render_widget(preview, area);
}
