refactor: view constructors from App

This commit is contained in:
🪞👃🪞 2024-07-08 21:19:53 +03:00
parent 1e3d96e64e
commit b01863dfdc
5 changed files with 88 additions and 102 deletions

View file

@ -8,6 +8,16 @@ pub struct ChainView<'a> {
pub vertical: bool,
}
impl<'a> ChainView<'a> {
pub fn new (app: &'a App, vertical: bool) -> Self {
Self {
focused: app.section == AppSection::Chain,
track: app.tracks.get(app.track_cursor - 1),
vertical
}
}
}
impl<'a> Render for ChainView<'a> {
fn render (&self, buf: &mut Buffer, area: Rect) -> Usually<Rect> {
let style = Some(if self.focused {