aboutsummaryrefslogtreecommitdiff
path: root/karlgui/src/views/calendar.rs
diff options
context:
space:
mode:
Diffstat (limited to 'karlgui/src/views/calendar.rs')
-rw-r--r--karlgui/src/views/calendar.rs34
1 files changed, 34 insertions, 0 deletions
diff --git a/karlgui/src/views/calendar.rs b/karlgui/src/views/calendar.rs
new file mode 100644
index 0000000..b216504
--- /dev/null
+++ b/karlgui/src/views/calendar.rs
@@ -0,0 +1,34 @@
+use crate::{helper::weekday_to_str, Globals};
+use egui::Ui;
+use egui_extras::TableBuilder;
+
+#[derive(Default)]
+pub struct Calendar;
+
+impl Calendar {
+ pub fn ui(&mut self, ui: &mut Ui, _g: &mut Globals) {
+ TableBuilder::new(ui)
+ .column(egui_extras::Size::exact(50.0))
+ .columns(egui_extras::Size::remainder(), 7)
+ .header(25.0, |mut ui| {
+ ui.col(|_| {});
+ for d in 0..7 {
+ ui.col(|ui| {
+ ui.heading(weekday_to_str(d));
+ });
+ }
+ })
+ .body(|ui| {
+ ui.rows(50.0, 24, |h, mut ui| {
+ ui.col(|ui| {
+ ui.heading(&format!("{h:02}:00"));
+ });
+ for d in 0..7 {
+ ui.col(|ui| {
+ ui.label(&format!("day {d} at {h}:00"));
+ });
+ }
+ })
+ })
+ }
+}