26 lines
566 B
Rust
26 lines
566 B
Rust
|
use git_next_core::git::graph::Log;
|
||
|
//
|
||
|
use ratatui::{
|
||
|
text::{Line, Text},
|
||
|
widgets::{Paragraph, Widget},
|
||
|
};
|
||
|
|
||
|
pub struct CommitLog<'a> {
|
||
|
pub log: &'a Log,
|
||
|
}
|
||
|
impl<'a> Widget for CommitLog<'a> {
|
||
|
fn render(self, area: ratatui::prelude::Rect, buf: &mut ratatui::prelude::Buffer)
|
||
|
where
|
||
|
Self: Sized,
|
||
|
{
|
||
|
Paragraph::new(Text::from(
|
||
|
self.log
|
||
|
.iter()
|
||
|
.map(ToString::to_string)
|
||
|
.map(Line::from)
|
||
|
.collect::<Vec<_>>(),
|
||
|
))
|
||
|
.render(area, buf);
|
||
|
}
|
||
|
}
|