diff options
-rw-r--r-- | src/views.rs | 42 |
1 files changed, 17 insertions, 25 deletions
diff --git a/src/views.rs b/src/views.rs index 975864c..b18e960 100644 --- a/src/views.rs +++ b/src/views.rs | |||
@@ -47,33 +47,25 @@ where | |||
47 | }, | 47 | }, |
48 | ); | 48 | ); |
49 | 49 | ||
50 | for i in 1..=31 { | 50 | let mut i = 1; |
51 | let day = NaiveDate::from_ymd_opt(year, month, i); | 51 | while let Some(d) = NaiveDate::from_ymd_opt(year, month, i) { |
52 | let day_style; | 52 | let day_style; |
53 | 53 | if self.reached_goal(d) { | |
54 | if let Some(d) = day { | 54 | day_style = goal_reached_style; |
55 | if self.reached_goal(d) { | 55 | } else { |
56 | day_style = goal_reached_style; | 56 | day_style = todo_style; |
57 | } else { | 57 | } |
58 | day_style = todo_style; | 58 | let coords: Vec2 = ((i % 7) * 3, i / 7 + 2).into(); |
59 | } | 59 | if let Some(c) = self.get_by_date(d) { |
60 | let coords: Vec2 = ((i % 7) * 3, i / 7 + 2).into(); | 60 | printer.with_style(day_style, |p| { |
61 | if let Some(c) = self.get_by_date(d) { | 61 | p.print(coords, &format!("{:^3}", c)); |
62 | printer.with_style(day_style, |p| { | 62 | }); |
63 | p.print(coords, &format!("{:^3}", c)); | 63 | } else { |
64 | }); | 64 | printer.with_style(future_style, |p| { |
65 | } else { | 65 | p.print(coords, &format!("{:^3}", CONFIGURATION.future_chr)); |
66 | printer.with_style(future_style, |p| { | 66 | }); |
67 | p.print(coords, &format!("{:^3}", CONFIGURATION.future_chr)); | ||
68 | }); | ||
69 | } | ||
70 | //printer.with_style(day_style, |p| { | ||
71 | // p.print(coords, &format!("{:^3}", c)); | ||
72 | // } else { | ||
73 | // p.print(coords, &format!("{:^3}", CONFIGURATION.future_chr)); | ||
74 | // } | ||
75 | //}); | ||
76 | } | 67 | } |
68 | i += 1; | ||
77 | } | 69 | } |
78 | } | 70 | } |
79 | fn required_size(&mut self, _: Vec2) -> Vec2 { | 71 | fn required_size(&mut self, _: Vec2) -> Vec2 { |