diff --git a/frontend/src/i18n/translations/de.json b/frontend/src/i18n/translations/de.json index 68c5bfe..38da365 100644 --- a/frontend/src/i18n/translations/de.json +++ b/frontend/src/i18n/translations/de.json @@ -27,7 +27,8 @@ "dropDownSelect": "Bitte wähle einen Raum aus", "noRoomsAvailable": "Keine Räume verfügbar", "available": "verfügbar", - "occupied": "belegt" + "occupied": "belegt", + "roomIcal": "iCal für " }, "freeRooms": { "freeRooms": "Freie Räume", diff --git a/frontend/src/i18n/translations/en.json b/frontend/src/i18n/translations/en.json index bc3c9e6..8e1de02 100644 --- a/frontend/src/i18n/translations/en.json +++ b/frontend/src/i18n/translations/en.json @@ -27,7 +27,8 @@ "dropDownSelect": "please select a room", "noRoomsAvailable": "no rooms listed", "available": "available", - "occupied": "occupied" + "occupied": "occupied", + "roomIcal": "iCal for " }, "freeRooms": { "freeRooms": "free rooms", diff --git a/frontend/src/view/rooms/RoomFinder.vue b/frontend/src/view/rooms/RoomFinder.vue index 77c6df5..c20c515 100644 --- a/frontend/src/view/rooms/RoomFinder.vue +++ b/frontend/src/view/rooms/RoomFinder.vue @@ -23,6 +23,28 @@ import DynamicPage from "@/view/DynamicPage.vue"; import RoomOccupation from "@/components/RoomOccupation.vue"; import { computedAsync } from "@vueuse/core"; import { router } from "@/main"; +import { useI18n } from "vue-i18n"; +import { useToast } from "primevue/usetoast"; +const { t } = useI18n({ useScope: "global" }); +const toast = useToast(); + +const show = () => { + toast.add({ + severity: "info", + summary: t("calendarLink.copyToastSummary"), + detail: t("calendarLink.copyToastNotification"), + life: 3000, + }); +}; + +const failedClipboard = () => { + toast.add({ + severity: "error", + summary: t("calendarLink.copyToastError"), + detail: t("calendarLink.copyToastErrorDetail"), + life: 3000, + }); +}; type Room = { name: string; @@ -90,13 +112,13 @@ const getLink = (selectedRoom: string) => const button = computed(() => { return { - label: "Copy iCal Link for" + selectedRoom.value.name, - icon: "pi pi-calendar", + label: t("roomFinderPage.roomIcal") + selectedRoom.value.name, + icon: "pi pi-clone", disabled: selectedRoom.value.name === "", onClick: () => { // Copy iCal link to clipboard // localhost/api/feed/room?id=selectedRoom.value.name - navigator.clipboard.writeText(getLink(selectedRoom.value.name)); + navigator.clipboard.writeText(getLink(selectedRoom.value.name)).then(show, () => failedClipboard()) }, }; });