Calendar props, CalendarCarousel
This commit is contained in:
parent
75a7189889
commit
5cfebd4c6f
4 changed files with 134 additions and 45 deletions
|
@ -7,7 +7,7 @@
|
||||||
:title="title_html"
|
:title="title_html"
|
||||||
/>
|
/>
|
||||||
<Dashboard :message="message_html">
|
<Dashboard :message="message_html">
|
||||||
<Calendar />
|
<CalendarCarousel />
|
||||||
</Dashboard>
|
</Dashboard>
|
||||||
</v-main>
|
</v-main>
|
||||||
<TickerBar
|
<TickerBar
|
||||||
|
@ -20,14 +20,14 @@
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Component, Vue } from "vue-property-decorator";
|
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 Dashboard from "./components/Dashboard.vue";
|
||||||
import TitleBar from "./components/title_bar/TitleBar.vue";
|
import TitleBar from "./components/title_bar/TitleBar.vue";
|
||||||
import TickerBar from "./components/TickerBar.vue";
|
import TickerBar from "./components/TickerBar.vue";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
components: {
|
components: {
|
||||||
Calendar,
|
CalendarCarousel,
|
||||||
Dashboard,
|
Dashboard,
|
||||||
TitleBar,
|
TitleBar,
|
||||||
TickerBar,
|
TickerBar,
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
<template>
|
<template>
|
||||||
<v-list>
|
<v-list>
|
||||||
<span class="text-h5 text-md-h4 d-inline-block mb-2">{{ title }}</span>
|
<span class="text-h5 text-md-h4 d-inline-block mb-2">{{ title }}</span>
|
||||||
<template v-for="(event, index) in parsed_events">
|
<template v-for="(event, index) in events">
|
||||||
<EventItem :event="event" :key="event.hash" />
|
<EventItem :event="event" :key="event.hash" />
|
||||||
<v-divider
|
<v-divider
|
||||||
v-if="index < parsed_events.length - 1"
|
v-if="index < events.length - 1"
|
||||||
class="mx-5"
|
class="mx-5"
|
||||||
:key="event.hash + '-div'"
|
:key="event.hash + '-div'"
|
||||||
/>
|
/>
|
||||||
|
@ -13,7 +13,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Component, Vue } from "vue-property-decorator";
|
import { Component, Prop, Vue } from "vue-property-decorator";
|
||||||
import Event from "./event";
|
import Event from "./event";
|
||||||
import EventItem from "./EventItem.vue";
|
import EventItem from "./EventItem.vue";
|
||||||
|
|
||||||
|
@ -23,39 +23,11 @@ import EventItem from "./EventItem.vue";
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
export default class Calendar extends Vue {
|
export default class Calendar extends Vue {
|
||||||
private readonly title = "CALENDAR";
|
@Prop({ default: "CALENDAR" })
|
||||||
|
private readonly title!: string;
|
||||||
|
|
||||||
private readonly events = [
|
@Prop({ default: () => [] })
|
||||||
{
|
private readonly events!: Array<Event>;
|
||||||
summary: "Lorem Ipsum",
|
|
||||||
description:
|
|
||||||
"Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.",
|
|
||||||
dtstart: "2022-09-08T07:00:00+00:00",
|
|
||||||
dtend: "2022-09-08T16:00:00+00:00",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
summary: "Sed ut perspiciatis unde omnis",
|
|
||||||
description: "Lorem ipsum dolor sit amet, consectetur",
|
|
||||||
dtstart: "2022-09-09T07:00:00+00:00",
|
|
||||||
dtend: "2022-09-09T09:00:00+00:00",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
summary: "At vero eos et accusamus",
|
|
||||||
description: "",
|
|
||||||
dtstart: "2022-09-10T07:00:00+00:00",
|
|
||||||
dtend: "2022-09-10T16:00:00+00:00",
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
private get parsed_events(): Array<Event> {
|
|
||||||
let arr = [];
|
|
||||||
|
|
||||||
for (let json of this.events) {
|
|
||||||
arr.push(new Event(json));
|
|
||||||
}
|
|
||||||
|
|
||||||
return arr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
91
ui/src/components/calendar/CalendarCarousel.vue
Normal file
91
ui/src/components/calendar/CalendarCarousel.vue
Normal file
|
@ -0,0 +1,91 @@
|
||||||
|
<template>
|
||||||
|
<v-carousel
|
||||||
|
cycle
|
||||||
|
interval="10000"
|
||||||
|
height="auto"
|
||||||
|
:show-arrows="false"
|
||||||
|
touchless
|
||||||
|
hide-delimiters
|
||||||
|
>
|
||||||
|
<v-carousel-item v-for="calendar in calendars" :key="calendar.title">
|
||||||
|
<Calendar
|
||||||
|
:key="calendar.title + '-cal'"
|
||||||
|
:title="calendar.title"
|
||||||
|
:events="calendar.events"
|
||||||
|
/>
|
||||||
|
</v-carousel-item>
|
||||||
|
</v-carousel>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
import { Component, Vue } from "vue-property-decorator";
|
||||||
|
import Calendar from "./Calendar.vue";
|
||||||
|
import { CalendarData, CalendarJSONData } from "./event";
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
components: {
|
||||||
|
Calendar,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
export default class CalendarCarousel extends Vue {
|
||||||
|
private readonly data: Array<CalendarJSONData> = [
|
||||||
|
{
|
||||||
|
title: "Lorem Ipsum",
|
||||||
|
events: [
|
||||||
|
{
|
||||||
|
summary: "Lorem Ipsum",
|
||||||
|
description:
|
||||||
|
"Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.",
|
||||||
|
dtstart: "2022-09-08T07:00:00+00:00",
|
||||||
|
dtend: "2022-09-08T16:00:00+00:00",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
summary: "Sed ut perspiciatis unde omnis",
|
||||||
|
description: "Lorem ipsum dolor sit amet, consectetur",
|
||||||
|
dtstart: "2022-09-09T07:00:00+00:00",
|
||||||
|
dtend: "2022-09-09T09:00:00+00:00",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
summary: "At vero eos et accusamus",
|
||||||
|
description: "",
|
||||||
|
dtstart: "2022-09-10T07:00:00+00:00",
|
||||||
|
dtend: "2022-09-10T16:00:00+00:00",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "Li Europan lingues",
|
||||||
|
events: [
|
||||||
|
{
|
||||||
|
summary: "Occidental in fact, it va esser Occidental",
|
||||||
|
description:
|
||||||
|
"Omnicos directe al desirabilite de un nov lingua franca: On refusa continuar payar custosi traductores. At solmen va esser necessi far uniform grammatica, pronunciation e plu sommun paroles. Ma quande lingues coalesce, li grammatica del resultant lingue es plu simplic e regulari quam ti del coalescent lingues.",
|
||||||
|
dtstart: "2022-09-08T07:00:00+00:00",
|
||||||
|
dtend: "2022-09-08T16:00:00+00:00",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
summary: "Membres del sam familie",
|
||||||
|
description: "Lor separat existentie es un myth.",
|
||||||
|
dtstart: "2022-09-09T07:00:00+00:00",
|
||||||
|
dtend: "2022-09-09T09:30:30+00:00",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
summary: "On refusa continuar payar custosi traductores",
|
||||||
|
description: "",
|
||||||
|
dtstart: "2022-09-10T07:00:00+00:00",
|
||||||
|
dtend: "2022-09-20T16:00:00+00:00",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
private get calendars(): Array<CalendarData> {
|
||||||
|
let arr = [];
|
||||||
|
|
||||||
|
for (const json_data of this.data) {
|
||||||
|
arr.push(new CalendarData(json_data));
|
||||||
|
}
|
||||||
|
return arr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
|
@ -1,19 +1,26 @@
|
||||||
import { DateTime, Duration } from "luxon";
|
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 summary: string;
|
||||||
public description: string;
|
public description: string;
|
||||||
public start: DateTime;
|
public start: DateTime;
|
||||||
public duration: Duration;
|
public duration: Duration;
|
||||||
|
|
||||||
public constructor(json_data: Record<string, string>) {
|
public constructor(json_data: EventJSONData) {
|
||||||
this.summary = json_data["summary"];
|
this.summary = json_data.summary;
|
||||||
this.description = json_data["description"];
|
this.description = json_data.description;
|
||||||
this.start = DateTime
|
this.start = DateTime
|
||||||
.fromISO(json_data["dtstart"])
|
.fromISO(json_data.dtstart)
|
||||||
.setLocale(navigator.language);
|
.setLocale(navigator.language);
|
||||||
const end = DateTime
|
const end = DateTime
|
||||||
.fromISO(json_data["dtend"])
|
.fromISO(json_data.dtend)
|
||||||
.setLocale(navigator.language);
|
.setLocale(navigator.language);
|
||||||
|
|
||||||
this.duration = end.diff(this.start);
|
this.duration = end.diff(this.start);
|
||||||
|
@ -30,3 +37,22 @@ export default class Event {
|
||||||
return new Uint32Array([hash])[0].toString(36);
|
return new Uint32Array([hash])[0].toString(36);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type CalendarJSONData = {
|
||||||
|
title: string;
|
||||||
|
events: Array<EventJSONData>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export class CalendarData {
|
||||||
|
public title: string;
|
||||||
|
public events: Array<EventData>;
|
||||||
|
|
||||||
|
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))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue