+ {{ version }} +
+ diff --git a/frontend/src/components/CalendarLink.vue b/frontend/src/components/CalendarLink.vue index cf3d40c..c7ca242 100644 --- a/frontend/src/components/CalendarLink.vue +++ b/frontend/src/components/CalendarLink.vue @@ -84,28 +84,78 @@ const forwardToHTWKalendar = () => { }); }; -const actions = computed(() => [ - { - label: t("calendarLink.copyToClipboard"), - icon: "pi pi-copy", - command: copyToClipboard, - }, - { - label: t("calendarLink.toGoogleCalendar"), - icon: "pi pi-google", - command: forwardToGoogle, - }, - { - label: t("calendarLink.toMicrosoftCalendar"), - icon: "pi pi-microsoft", - command: forwardToMicrosoft, - }, - { - label: t("calendarLink.toHTWKalendar"), - icon: "pi pi-home", - command: forwardToHTWKalendar, - }, -]); +const shareData = computed(() => ({ + title: t("calendarLink.shareTitle"), + text: t("calendarLink.shareText") + getLink(), + url: "https://" + domain + "/", +})); + +const shareLink = () => { + if (typeof navigator.share === 'function' && navigator.canShare(shareData.value)) { + navigator + .share(shareData.value) + .then(() => { + toast.add({ + severity: "info", + summary: t("calendarLink.shareToastSummary"), + detail: t("calendarLink.shareToastNotification"), + life: 3000, + }); + }) + .catch(() => { + toast.add({ + severity: "error", + summary: t("calendarLink.shareToastError"), + detail: t("calendarLink.shareToastErrorDetail"), + life: 3000, + }); + }); + } else { + toast.add({ + severity: "error", + summary: t("calendarLink.shareToastError"), + detail: t("calendarLink.shareToastErrorDetail"), + life: 3000, + }); + } +}; + +const actions = computed(() => { + const actionList = [ + { + label: t("calendarLink.copyToClipboard"), + icon: "pi pi-copy", + command: copyToClipboard, + }, + { + label: t("calendarLink.toGoogleCalendar"), + icon: "pi pi-google", + command: forwardToGoogle, + }, + { + label: t("calendarLink.toMicrosoftCalendar"), + icon: "pi pi-microsoft", + command: forwardToMicrosoft, + }, + { + label: t("calendarLink.toHTWKalendar"), + icon: "pi pi-home", + command: forwardToHTWKalendar, + } + ]; + + if (typeof navigator.share === 'function' && navigator.canShare(shareData.value)) { + actionList.push({ + label: t("calendarLink.share"), + icon: "pi pi-share-alt", + command: shareLink, + }); + } + + return actionList; +} + +); diff --git a/frontend/src/components/CalendarViewer.vue b/frontend/src/components/CalendarViewer.vue index ea37e17..02fee48 100644 --- a/frontend/src/components/CalendarViewer.vue +++ b/frontend/src/components/CalendarViewer.vue @@ -46,12 +46,21 @@ const props = defineProps({ }, }); +type CalendarEvent = { + title: string; + start: Date | null; + end: Date | null; + notes: string; + allDay: boolean; + location: string; +}; + const op = ref(); -const clickedEvent = ref(); +const clickedEvent : RefLocation: {{ clickedEvent.location }}
-Start: {{ clickedEvent.start?.toLocaleString() }}
-End: {{ clickedEvent.end?.toLocaleString() }}
-Notes: {{ clickedEvent.notes }}
+{{ $t("calendarViewer.location") }}: {{ clickedEvent.location }}
+{{ $t("calendarViewer.start") }}: {{ clickedEvent.start ? $d(clickedEvent.start, "long") : ""}}
+{{ $t("calendarViewer.end") }}: {{ clickedEvent.end ? $d(clickedEvent.end, "long") : "" }}
+{{ $t("calendarViewer.notes") }}:
+{{ note }}