mirror of
https://gitlab.dit.htwk-leipzig.de/htwk-software/htwkalender-pwa.git
synced 2025-07-16 17:48:51 +02:00
feat:#17 add share button on calendar link page
This commit is contained in:
@ -84,28 +84,76 @@ const forwardToHTWKalendar = () => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const actions = computed(() => [
|
const shareLink = () => {
|
||||||
{
|
if (typeof navigator.share === 'function' && navigator.canShare()) {
|
||||||
label: t("calendarLink.copyToClipboard"),
|
navigator
|
||||||
icon: "pi pi-copy",
|
.share({
|
||||||
command: copyToClipboard,
|
title: t("calendarLink.shareTitle"),
|
||||||
},
|
text: t("calendarLink.shareText") + getLink(),
|
||||||
{
|
url: "https://" + domain + "/",
|
||||||
label: t("calendarLink.toGoogleCalendar"),
|
})
|
||||||
icon: "pi pi-google",
|
.then(() => {
|
||||||
command: forwardToGoogle,
|
toast.add({
|
||||||
},
|
severity: "info",
|
||||||
{
|
summary: t("calendarLink.shareToastSummary"),
|
||||||
label: t("calendarLink.toMicrosoftCalendar"),
|
detail: t("calendarLink.shareToastNotification"),
|
||||||
icon: "pi pi-microsoft",
|
life: 3000,
|
||||||
command: forwardToMicrosoft,
|
});
|
||||||
},
|
})
|
||||||
{
|
.catch(() => {
|
||||||
label: t("calendarLink.toHTWKalendar"),
|
toast.add({
|
||||||
icon: "pi pi-home",
|
severity: "error",
|
||||||
command: forwardToHTWKalendar,
|
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(() => {
|
||||||
|
var 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()) {
|
||||||
|
actionList.push({
|
||||||
|
label: t("calendarLink.share"),
|
||||||
|
icon: "pi pi-share-alt",
|
||||||
|
command: shareLink,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return actionList;
|
||||||
|
}
|
||||||
|
|
||||||
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -147,7 +147,14 @@
|
|||||||
"copyToClipboard": "Link kopieren",
|
"copyToClipboard": "Link kopieren",
|
||||||
"toGoogleCalendar": "Google Kalender",
|
"toGoogleCalendar": "Google Kalender",
|
||||||
"toMicrosoftCalendar": "Microsoft Kalender",
|
"toMicrosoftCalendar": "Microsoft Kalender",
|
||||||
"toHTWKalendar": "HTWKalender"
|
"toHTWKalendar": "HTWKalender",
|
||||||
|
"share": "Teilen",
|
||||||
|
"shareTitle": "HTWKalender",
|
||||||
|
"shareText": "Ich habe diesen Stundenplan für dich mit dem HTWKalender erstellt. Schau ihn dir hier an: ",
|
||||||
|
"shareToastSummary": "Information",
|
||||||
|
"shareToastNotification": "Link zum Stundenplan erfolgreich geteilt",
|
||||||
|
"shareToastError": "Fehler",
|
||||||
|
"shareToastErrorDetail": "Link konnte nicht geteilt werden. Möglicherweise wird die Funktion nicht unterstützt."
|
||||||
},
|
},
|
||||||
"calendarPreview": {
|
"calendarPreview": {
|
||||||
"preview": "Vorschau",
|
"preview": "Vorschau",
|
||||||
|
@ -152,7 +152,14 @@
|
|||||||
"copyToClipboard": "copy to clipboard",
|
"copyToClipboard": "copy to clipboard",
|
||||||
"toGoogleCalendar": "Google Calendar",
|
"toGoogleCalendar": "Google Calendar",
|
||||||
"toMicrosoftCalendar": "Microsoft Calendar",
|
"toMicrosoftCalendar": "Microsoft Calendar",
|
||||||
"toHTWKalendar": "HTWKalender"
|
"toHTWKalendar": "HTWKalender",
|
||||||
|
"share": "Share",
|
||||||
|
"shareTitle": "HTWKalender",
|
||||||
|
"shareText": "I’ve created this timetable for you with HTWKalender. Check it out here: ",
|
||||||
|
"shareToastSummary": "Information",
|
||||||
|
"shareToastNotification": "Timetable link successfully shared",
|
||||||
|
"shareToastError": "Error",
|
||||||
|
"shareToastErrorDetail": "Link could not be shared. The feature might not be supported."
|
||||||
},
|
},
|
||||||
"calendarPreview": {
|
"calendarPreview": {
|
||||||
"preview": "preview",
|
"preview": "preview",
|
||||||
|
@ -147,7 +147,14 @@
|
|||||||
"copyToClipboard": "クリップボードにコピー",
|
"copyToClipboard": "クリップボードにコピー",
|
||||||
"toGoogleCalendar": "Googleカレンダー",
|
"toGoogleCalendar": "Googleカレンダー",
|
||||||
"toMicrosoftCalendar": "Microsoftカレンダー",
|
"toMicrosoftCalendar": "Microsoftカレンダー",
|
||||||
"toHTWKalendar": "HTWカレンダー"
|
"toHTWKalendar": "HTWカレンダー",
|
||||||
|
"share": "共有",
|
||||||
|
"shareTitle": "HTWカレンダー",
|
||||||
|
"shareText": "HTWカレンダーでこの時間割を作成しました。こちらで確認してください: ",
|
||||||
|
"shareToastSummary": "情報",
|
||||||
|
"shareToastNotification": "時間割のリンクが正常に共有されました",
|
||||||
|
"shareToastError": "エラー",
|
||||||
|
"shareToastErrorDetail": "リンクを共有できませんでした。機能がサポートされていない可能性があります。"
|
||||||
},
|
},
|
||||||
"calendarPreview": {
|
"calendarPreview": {
|
||||||
"preview": "プレビュー",
|
"preview": "プレビュー",
|
||||||
|
Reference in New Issue
Block a user