aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkshay <[email protected]>2020-06-29 10:58:24 +0100
committerAkshay <[email protected]>2020-06-29 10:58:24 +0100
commita97a4d42bb30b76589c7195de8b10ca3c2090deb (patch)
tree27279b58326c70762022f88fdfd6f379d87383bd
parent3b576d2c39e63f05c1c919579f61866a7798dc1e (diff)
change drawing logic
-rw-r--r--src/views.rs42
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 {