diff --git a/public/.env.example.js b/public/.env.example.js
index c719c19..4a32816 100644
--- a/public/.env.example.js
+++ b/public/.env.example.js
@@ -7,3 +7,4 @@ var SSO_CODE_CHALLENGE_METHOD = "S256";
var SSO_POST_LOGOUT_REDIRECT = "http://example.com?logout=1";
var CALENDAR_BASE_URL = "https://calendar.example.com";
var MAIL_SPA_URL = "https://mail.example.com";
+var DEBUG = false;
diff --git a/src/features/Events/EventApi.ts b/src/features/Events/EventApi.ts
index e7a616b..7a6186a 100644
--- a/src/features/Events/EventApi.ts
+++ b/src/features/Events/EventApi.ts
@@ -16,6 +16,13 @@ export async function getEvent(event: CalendarEvent) {
return { ...eventjson, ...event };
}
+export async function dlEvent(event: CalendarEvent) {
+ const response = await api.get(`dav${event.URL}?export=`);
+ const eventData = await response.text();
+
+ return eventData;
+}
+
export async function putEvent(event: CalendarEvent, calOwnerEmail?: string) {
const response = await api(`dav${event.URL}`, {
method: "PUT",
diff --git a/src/features/Events/EventDisplayPreview.tsx b/src/features/Events/EventDisplayPreview.tsx
index 7ecdb23..09b9c44 100644
--- a/src/features/Events/EventDisplayPreview.tsx
+++ b/src/features/Events/EventDisplayPreview.tsx
@@ -30,16 +30,17 @@ import VideocamIcon from "@mui/icons-material/Videocam";
import ErrorOutlineIcon from "@mui/icons-material/ErrorOutline";
import CircleIcon from "@mui/icons-material/Circle";
import CancelIcon from "@mui/icons-material/Cancel";
-import CheckCircleIcon from "@mui/icons-material/CheckCircle";
+import FileDownloadOutlinedIcon from "@mui/icons-material/FileDownloadOutlined";
import { userAttendee } from "../User/userDataTypes";
import EventDisplayModal, {
InfoRow,
renderAttendeeBadge,
stringAvatar,
} from "./EventDisplay";
-import { getEvent } from "./EventApi";
+import { dlEvent, getEvent } from "./EventApi";
import { CalendarEvent } from "./EventsTypes";
import EventDuplication from "../../components/Event/EventDuplicate";
+import { getCalendar } from "../Calendars/CalendarApi";
export default function EventPreviewModal({
eventId,
@@ -123,6 +124,27 @@ export default function EventPreviewModal({
gap: 1,
}}
>
+ {(window as any).DEBUG && (
+ {
+ const icsContent = await dlEvent(event);
+ const blob = new Blob([icsContent], {
+ type: "text/calendar",
+ });
+ const url = URL.createObjectURL(blob);
+
+ const link = document.createElement("a");
+ link.href = url;
+ link.download = `${eventId}.ics`;
+ document.body.appendChild(link);
+ link.click();
+ document.body.removeChild(link);
+ URL.revokeObjectURL(url);
+ }}
+ >
+
+
+ )}
{mailSpaUrl && attendees.length > 0 && (