mirror of
https://gitlab.dit.htwk-leipzig.de/htwk-software/htwkalender-pwa.git
synced 2025-07-16 09:38: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(() => [
|
||||
{
|
||||
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 shareLink = () => {
|
||||
if (typeof navigator.share === 'function' && navigator.canShare()) {
|
||||
navigator
|
||||
.share({
|
||||
title: t("calendarLink.shareTitle"),
|
||||
text: t("calendarLink.shareText") + getLink(),
|
||||
url: "https://" + domain + "/",
|
||||
})
|
||||
.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(() => {
|
||||
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>
|
||||
|
||||
<template>
|
||||
|
@ -147,7 +147,14 @@
|
||||
"copyToClipboard": "Link kopieren",
|
||||
"toGoogleCalendar": "Google 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": {
|
||||
"preview": "Vorschau",
|
||||
|
@ -152,7 +152,14 @@
|
||||
"copyToClipboard": "copy to clipboard",
|
||||
"toGoogleCalendar": "Google 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": {
|
||||
"preview": "preview",
|
||||
|
@ -147,7 +147,14 @@
|
||||
"copyToClipboard": "クリップボードにコピー",
|
||||
"toGoogleCalendar": "Googleカレンダー",
|
||||
"toMicrosoftCalendar": "Microsoftカレンダー",
|
||||
"toHTWKalendar": "HTWカレンダー"
|
||||
"toHTWKalendar": "HTWカレンダー",
|
||||
"share": "共有",
|
||||
"shareTitle": "HTWカレンダー",
|
||||
"shareText": "HTWカレンダーでこの時間割を作成しました。こちらで確認してください: ",
|
||||
"shareToastSummary": "情報",
|
||||
"shareToastNotification": "時間割のリンクが正常に共有されました",
|
||||
"shareToastError": "エラー",
|
||||
"shareToastErrorDetail": "リンクを共有できませんでした。機能がサポートされていない可能性があります。"
|
||||
},
|
||||
"calendarPreview": {
|
||||
"preview": "プレビュー",
|
||||
|
Reference in New Issue
Block a user