From 0b18c65466a59b1c9f8d1bfbe596fc2750571dfb Mon Sep 17 00:00:00 2001 From: Akshay Date: Sun, 12 Jul 2020 09:30:29 +0530 Subject: fix trait bounds bug, prep for view modes --- src/views.rs | 47 ++++++++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 23 deletions(-) (limited to 'src/views.rs') diff --git a/src/views.rs b/src/views.rs index facbd55..3e623a9 100644 --- a/src/views.rs +++ b/src/views.rs @@ -7,7 +7,8 @@ use cursive::{Printer, Vec2}; use chrono::prelude::*; use chrono::{Duration, Local, NaiveDate}; -use crate::habit::{Bit, Count, Habit, TrackEvent, ViewMode}; +use crate::habit::{Bit, Count, Habit, TrackEvent}; + use crate::CONFIGURATION; pub trait ShadowView { @@ -70,29 +71,29 @@ where // ViewMode::Month => // } - let draw_day = |p: &Printer| { - let mut i = 1; - while let Some(d) = NaiveDate::from_ymd_opt(year, month, i) { - let day_style; - if self.reached_goal(d) { - day_style = goal_reached_style; - } else { - day_style = todo_style; - } - let coords: Vec2 = ((i % 7) * 3, i / 7 + 2).into(); - if let Some(c) = self.get_by_date(d) { - printer.with_style(day_style, |p| { - p.print(coords, &format!("{:^3}", c)); - }); - } else { - printer.with_style(future_style, |p| { - p.print(coords, &format!("{:^3}", CONFIGURATION.future_chr)); - }); - } - i += 1; + //let draw_day = |printer: &Printer| { + let mut i = 1; + while let Some(d) = NaiveDate::from_ymd_opt(year, month, i) { + let day_style; + if self.reached_goal(d) { + day_style = goal_reached_style; + } else { + day_style = todo_style; } - }; - draw_day(printer); + let coords: Vec2 = ((i % 7) * 3, i / 7 + 2).into(); + if let Some(c) = self.get_by_date(d) { + printer.with_style(day_style, |p| { + p.print(coords, &format!("{:^3}", c)); + }); + } else { + printer.with_style(future_style, |p| { + p.print(coords, &format!("{:^3}", CONFIGURATION.future_chr)); + }); + } + i += 1; + } + //}; + //draw_day(printer); } fn required_size(&mut self, _: Vec2) -> Vec2 { -- cgit v1.2.3