76 lines
2.2 KiB
Rust
76 lines
2.2 KiB
Rust
use color_eyre::Result;
|
|
use ratatui::{
|
|
layout::{Alignment, Rect},
|
|
widgets::{Block, Paragraph, Wrap},
|
|
Frame
|
|
};
|
|
|
|
use super::{Component, PartialComponent, CurrentTab};
|
|
use crate::{
|
|
action::Action,
|
|
config::Config,
|
|
palette::StylePalette,
|
|
};
|
|
|
|
#[derive(Debug)]
|
|
pub struct EventLogs {
|
|
palette: StylePalette
|
|
}
|
|
|
|
impl Default for EventLogs {
|
|
fn default() -> Self {
|
|
Self::new()
|
|
}
|
|
}
|
|
|
|
impl EventLogs {
|
|
pub fn new() -> Self {
|
|
Self {
|
|
palette: StylePalette::default(),
|
|
}
|
|
}
|
|
}
|
|
|
|
impl PartialComponent for EventLogs {
|
|
fn set_active(&mut self, _current_tab: CurrentTab) {}
|
|
}
|
|
|
|
impl Component for EventLogs {
|
|
fn register_config_handler(&mut self, config: Config) -> Result<()> {
|
|
if let Some(style) = config.styles.get(&crate::app::Mode::Explorer) {
|
|
self.palette.with_normal_style(style.get("normal_style").copied());
|
|
self.palette.with_hover_style(style.get("hover_style").copied());
|
|
self.palette.with_normal_border_style(style.get("normal_border_style").copied());
|
|
self.palette.with_hover_border_style(style.get("hover_border_style").copied());
|
|
self.palette.with_normal_title_style(style.get("normal_title_style").copied());
|
|
self.palette.with_hover_title_style(style.get("hover_title_style").copied());
|
|
}
|
|
Ok(())
|
|
}
|
|
|
|
fn update(&mut self, action: Action) -> Result<Option<Action>> {
|
|
match action {
|
|
_ => {}
|
|
};
|
|
Ok(None)
|
|
}
|
|
|
|
fn draw(&mut self, frame: &mut Frame, area: Rect) -> Result<()> {
|
|
let [_, place] = super::wallet_layout(area);
|
|
|
|
let (border_style, border_type) = self.palette.create_border_style(false);
|
|
let paragraph = Paragraph::new("latest logs")
|
|
.block(Block::bordered()
|
|
.border_style(border_style)
|
|
.border_type(border_type)
|
|
.title_alignment(Alignment::Right)
|
|
.title_style(self.palette.create_title_style(false))
|
|
.title("Logs"))
|
|
.alignment(Alignment::Center)
|
|
.wrap(Wrap { trim: true });
|
|
|
|
frame.render_widget(paragraph, place);
|
|
Ok(())
|
|
}
|
|
}
|