diff options
Diffstat (limited to 'gui/src/timeline.rs')
-rw-r--r-- | gui/src/timeline.rs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/gui/src/timeline.rs b/gui/src/timeline.rs new file mode 100644 index 0000000..82c8da1 --- /dev/null +++ b/gui/src/timeline.rs @@ -0,0 +1,26 @@ +use crate::timeline_post::TimelinePost; + +#[derive(Debug)] +pub struct Timeline { + posts: Vec<TimelinePost> +} + +impl Timeline { + pub fn new() -> Self { + Self { + posts: Vec::with_capacity(100), + } + } + + pub fn update(&mut self) { + self.posts.iter_mut().for_each(|mut post| post.update()); + } + + pub fn view(&self) -> iced::Column<crate::app::Message> { + self.posts + .iter() + .fold(iced::Column::new(), |c, post| { + c.push(post.view()) + }) + } +} |