feat:#60 format, lint and fix build

This commit is contained in:
masterElmar
2023-11-16 23:45:45 +01:00
parent 9f937afe94
commit e9db7cb4b0
24 changed files with 307 additions and 271 deletions

View File

@@ -4,19 +4,20 @@ import { useToast } from "primevue/usetoast";
import { onMounted } from "vue";
import router from "../router";
import { useI18n } from "vue-i18n";
const { t } = useI18n({ useScope: 'global' })
const { t } = useI18n({ useScope: "global" });
const toast = useToast();
const domain = window.location.hostname;
const getLink = () => "https://" + domain + "/api/feed?token=" + tokenStore().token;
const getLink = () =>
"https://" + domain + "/api/feed?token=" + tokenStore().token;
const show = () => {
toast.add({
severity: "info",
summary: t('calendarLink.copyToastSummary'),
detail: t('calendarLink.copyToastNotification'),
summary: t("calendarLink.copyToastSummary"),
detail: t("calendarLink.copyToastNotification"),
life: 3000,
});
};
@@ -33,46 +34,48 @@ function rerouteIfTokenIsEmpty() {
function copyToClipboard() {
// Copy the text inside the text field
navigator.clipboard.writeText(getLink()).then(
show,
(err) => {
console.error("Could not copy text: ", err);
toast.add({
severity: "error",
summary: t('calendarLink.copyToastError'),
detail: t('calendarLink.copyToastErrorDetail'),
life: 3000,
});
},
);
navigator.clipboard.writeText(getLink()).then(show, (err) => {
console.error("Could not copy text: ", err);
toast.add({
severity: "error",
summary: t("calendarLink.copyToastError"),
detail: t("calendarLink.copyToastErrorDetail"),
life: 3000,
});
});
}
const forwardToGoogle = () => {
window.open("https://calendar.google.com/calendar/u/0/r?cid=" + encodeURI(getLink().replace("https://", "http://")));
window.open(
"https://calendar.google.com/calendar/u/0/r?cid=" +
encodeURI(getLink().replace("https://", "http://")),
);
};
const forwardToMicrosoft = () => {
window.open("https://outlook.live.com/owa?path=/calendar/action/compose&rru=addsubscription&name=HTWK%20Kalender&url=" + encodeURI(getLink()));
window.open(
"https://outlook.live.com/owa?path=/calendar/action/compose&rru=addsubscription&name=HTWK%20Kalender&url=" +
encodeURI(getLink()),
);
};
const actions = [
{
label: t('calendarLink.copyToClipboard'),
label: t("calendarLink.copyToClipboard"),
icon: "pi pi-copy",
command: copyToClipboard,
},
{
label: t('calendarLink.toGoogleCalendar'),
label: t("calendarLink.toGoogleCalendar"),
icon: "pi pi-google",
command: forwardToGoogle,
},
{
label: t('calendarLink.toMicrosoftCalendar'),
label: t("calendarLink.toMicrosoftCalendar"),
icon: "pi pi-microsoft",
command: forwardToMicrosoft,
},
];
</script>
<template>