From 5cfebd4c6fa4bd6b2abe34c2e45df07455c548df Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B6rn-Michael=20Miehe?=
<40151420+ldericher@users.noreply.github.com>
Date: Thu, 15 Sep 2022 13:03:19 +0000
Subject: [PATCH] Calendar props, CalendarCarousel
---
ui/src/App.vue | 6 +-
ui/src/components/calendar/Calendar.vue | 42 ++-------
.../components/calendar/CalendarCarousel.vue | 91 +++++++++++++++++++
ui/src/components/calendar/event.ts | 40 ++++++--
4 files changed, 134 insertions(+), 45 deletions(-)
create mode 100644 ui/src/components/calendar/CalendarCarousel.vue
diff --git a/ui/src/App.vue b/ui/src/App.vue
index 6c2f6b6..c2d985f 100644
--- a/ui/src/App.vue
+++ b/ui/src/App.vue
@@ -7,7 +7,7 @@
:title="title_html"
/>
-
+
import { Component, Vue } from "vue-property-decorator";
-import Calendar from "./components/calendar/Calendar.vue";
+import CalendarCarousel from "./components/calendar/CalendarCarousel.vue";
import Dashboard from "./components/Dashboard.vue";
import TitleBar from "./components/title_bar/TitleBar.vue";
import TickerBar from "./components/TickerBar.vue";
@Component({
components: {
- Calendar,
+ CalendarCarousel,
Dashboard,
TitleBar,
TickerBar,
diff --git a/ui/src/components/calendar/Calendar.vue b/ui/src/components/calendar/Calendar.vue
index d316d97..92e196d 100644
--- a/ui/src/components/calendar/Calendar.vue
+++ b/ui/src/components/calendar/Calendar.vue
@@ -1,10 +1,10 @@
{{ title }}
-
+
@@ -13,7 +13,7 @@
diff --git a/ui/src/components/calendar/CalendarCarousel.vue b/ui/src/components/calendar/CalendarCarousel.vue
new file mode 100644
index 0000000..60b3216
--- /dev/null
+++ b/ui/src/components/calendar/CalendarCarousel.vue
@@ -0,0 +1,91 @@
+
+
+
+
+
+
+
+
+
diff --git a/ui/src/components/calendar/event.ts b/ui/src/components/calendar/event.ts
index f2536c1..9e6a284 100644
--- a/ui/src/components/calendar/event.ts
+++ b/ui/src/components/calendar/event.ts
@@ -1,19 +1,26 @@
import { DateTime, Duration } from "luxon";
-export default class Event {
+export type EventJSONData = {
+ summary: string;
+ description: string;
+ dtstart: string;
+ dtend: string;
+};
+
+export default class EventData {
public summary: string;
public description: string;
public start: DateTime;
public duration: Duration;
- public constructor(json_data: Record) {
- this.summary = json_data["summary"];
- this.description = json_data["description"];
+ public constructor(json_data: EventJSONData) {
+ this.summary = json_data.summary;
+ this.description = json_data.description;
this.start = DateTime
- .fromISO(json_data["dtstart"])
+ .fromISO(json_data.dtstart)
.setLocale(navigator.language);
const end = DateTime
- .fromISO(json_data["dtend"])
+ .fromISO(json_data.dtend)
.setLocale(navigator.language);
this.duration = end.diff(this.start);
@@ -29,4 +36,23 @@ export default class Event {
return new Uint32Array([hash])[0].toString(36);
}
-}
\ No newline at end of file
+}
+
+export type CalendarJSONData = {
+ title: string;
+ events: Array;
+};
+
+export class CalendarData {
+ public title: string;
+ public events: Array;
+
+ public constructor(json_data: CalendarJSONData) {
+ this.title = json_data.title
+
+ this.events = [];
+ for (const event_data of json_data.events) {
+ this.events.push(new EventData(event_data))
+ }
+ }
+}