) : (
<>
- {step === "form" && (
+ {step === 'form' && (
}
- placeholder={"Meeting Link/Location"}
+ placeholder={'Meeting Link/Location'}
type="text"
onFocus={() => {
setShowSuggestions(!isLink(form.location));
@@ -382,14 +412,14 @@ function App() {
startContent={
}
id="timezone"
placeholder="Type to filter time zones"
- defaultItems={Intl.supportedValuesOf("timeZone").map((tz) => ({ label: tz, value: tz }))}
+ defaultItems={Intl.supportedValuesOf('timeZone').map((tz) => ({ label: tz, value: tz }))}
defaultSelectedKey={form.timezone}
onSelectionChange={(v) => {
setForm((f) => ({ ...f, timezone: String(v) }));
}}
isClearable={false}
>
- {Intl.supportedValuesOf("timeZone").map((tz) => (
+ {Intl.supportedValuesOf('timeZone').map((tz) => (
{tz}
@@ -450,7 +480,7 @@ function App() {
)}
}
- type={isPassVisible ? "text" : "password"}
+ type={isPassVisible ? 'text' : 'password'}
value={form.password}
onChange={(e) => setForm((f) => ({ ...f, password: e.target.value }))}
/>
@@ -471,7 +501,7 @@ function App() {
)}
- {step === "share" && (
+ {step === 'share' && (
Share this link:
{pendingShare ? (
@@ -489,14 +519,14 @@ function App() {
>
)}
diff --git a/src/Share.tsx b/src/Share.tsx
index 1528be8..554ebd4 100644
--- a/src/Share.tsx
+++ b/src/Share.tsx
@@ -1,15 +1,15 @@
-import ReactQRCode from "react-qr-code";
-import { generateICal } from "./icalUtils";
-import { ArrowDownTrayIcon, CalendarDaysIcon, GlobeAltIcon, NoSymbolIcon } from "@heroicons/react/16/solid";
-import { Button, Input, Link } from "@heroui/react";
-import { Autocomplete, AutocompleteItem } from "@heroui/react";
-import { useState } from "react";
-import { dateFromParts, decryptString, getUserLocale, isLink, paramsDeserializer } from "./helpers";
-import type { EventQS } from "./eventForm";
+import ReactQRCode from 'react-qr-code';
+import { generateICal } from './icalUtils';
+import { ArrowDownTrayIcon, CalendarDaysIcon, GlobeAltIcon, NoSymbolIcon } from '@heroicons/react/16/solid';
+import { Button, Input, Link } from '@heroui/react';
+import { Autocomplete, AutocompleteItem } from '@heroui/react';
+import { useState } from 'react';
+import { dateFromParts, decryptString, getUserLocale, isLink, paramsDeserializer } from './helpers';
+import type { EventQS } from './eventForm';
function getShareUnlockState() {
const params = new URLSearchParams(window.location.search);
- const cipher = params.get("h");
+ const cipher = params.get('h');
if (cipher) return { protected: true, cipher };
return { protected: false };
}
@@ -17,46 +17,46 @@ function getShareUnlockState() {
function parseStandardParams(): EventQS {
const params = new URLSearchParams(window.location.search);
return {
- title: params.get("t") || "",
- description: params.get("d") || "",
- location: params.get("l") || "",
- sDate: params.get("sd") || "",
- sTime: params.get("st") || "",
- eDate: params.get("ed") || "",
- eTime: params.get("et") || "",
- timezone: params.get("tz") || "",
- isAllDay: typeof params.get("a") === "string",
+ title: params.get('t') || '',
+ description: params.get('d') || '',
+ location: params.get('l') || '',
+ sDate: params.get('sd') || '',
+ sTime: params.get('st') || '',
+ eDate: params.get('ed') || '',
+ eTime: params.get('et') || '',
+ timezone: params.get('tz') || '',
+ isAllDay: typeof params.get('a') === 'string',
};
}
export default function Share({ isDark }: { isDark: boolean }) {
const lockState = getShareUnlockState();
- const [password, setPassword] = useState("");
- const [unlockError, setUnlockError] = useState("");
+ const [password, setPassword] = useState('');
+ const [unlockError, setUnlockError] = useState('');
const [unlocked, setUnlocked] = useState(false);
const [protectedEvent, setProtectedEvent] = useState
(null);
const [selectedTz, setSelectedTz] = useState(Intl.DateTimeFormat().resolvedOptions().timeZone);
async function handleUnlock() {
- setUnlockError("");
+ setUnlockError('');
try {
- const base = await decryptString(lockState.cipher || "", password);
+ const base = await decryptString(lockState.cipher || '', password);
const data = paramsDeserializer(base);
// set event metadata exactly as "standard" event
setProtectedEvent({
- title: data.t ?? "",
- description: data.d ?? "",
- location: data.l ?? "",
- sDate: data.sd ?? "",
- sTime: data.st ?? "",
- eDate: data.ed ?? "",
- eTime: data.et ?? "",
- timezone: data.tz ?? "",
- isAllDay: data.a === "1",
+ title: data.t ?? '',
+ description: data.d ?? '',
+ location: data.l ?? '',
+ sDate: data.sd ?? '',
+ sTime: data.st ?? '',
+ eDate: data.ed ?? '',
+ eTime: data.et ?? '',
+ timezone: data.tz ?? '',
+ isAllDay: data.a === '1',
});
setUnlocked(true);
} catch {
- setUnlockError("Unlock failed, either link is wrongly copied or password is wrong");
+ setUnlockError('Unlock failed, either link is wrongly copied or password is wrong');
}
}
@@ -102,9 +102,9 @@ export default function Share({ isDark }: { isDark: boolean }) {
const tzDisplay = (() => {
if (event.timezone) return event.timezone;
const off = -startDt.getTimezoneOffset();
- const sign = off >= 0 ? "+" : "-";
- const h = String(Math.floor(Math.abs(off) / 60)).padStart(2, "0");
- const m = String(Math.abs(off) % 60).padStart(2, "0");
+ const sign = off >= 0 ? '+' : '-';
+ const h = String(Math.floor(Math.abs(off) / 60)).padStart(2, '0');
+ const m = String(Math.abs(off) % 60).padStart(2, '0');
return `${sign}${h}:${m}`;
})();
@@ -113,11 +113,11 @@ export default function Share({ isDark }: { isDark: boolean }) {
try {
const locale = new Intl.Locale(getUserLocale());
const opts: Intl.DateTimeFormatOptions = {
- year: "numeric",
- month: "short",
- day: "numeric",
- hour: "2-digit",
- minute: "2-digit",
+ year: 'numeric',
+ month: 'short',
+ day: 'numeric',
+ hour: '2-digit',
+ minute: '2-digit',
timeZone: tz,
};
return new Intl.DateTimeFormat(locale, opts).format(date);
@@ -131,8 +131,8 @@ export default function Share({ isDark }: { isDark: boolean }) {
try {
const locale = new Intl.Locale(getUserLocale());
const opts: Intl.DateTimeFormatOptions = {
- hour: "2-digit",
- minute: "2-digit",
+ hour: '2-digit',
+ minute: '2-digit',
timeZone: tz,
};
return new Intl.DateTimeFormat(locale, opts).format(date);
@@ -145,10 +145,10 @@ export default function Share({ isDark }: { isDark: boolean }) {
try {
const locale = new Intl.Locale(getUserLocale());
const opts: Intl.DateTimeFormatOptions = {
- year: "numeric",
- month: "short",
- day: "numeric",
- weekday: "long",
+ year: 'numeric',
+ month: 'short',
+ day: 'numeric',
+ weekday: 'long',
};
return new Intl.DateTimeFormat(locale, opts).format(date);
} catch {
@@ -158,11 +158,11 @@ export default function Share({ isDark }: { isDark: boolean }) {
const ical = generateICal(event);
- const icalBlob = new Blob([ical], { type: "text/calendar" });
+ const icalBlob = new Blob([ical], { type: 'text/calendar' });
const icalUrl = URL.createObjectURL(icalBlob);
const shareLink = window.location.href;
- const sanitizeDate = (d: string) => d.replace(/[-:]/g, "").replace(/\.\d{3}/, "");
+ const sanitizeDate = (d: string) => d.replace(/[-:]/g, '').replace(/\.\d{3}/, '');
const startStr = event.isAllDay ? event.sDate : startDt.toISOString();
const endStr = event.isAllDay ? event.eDate : endDt.toISOString();
const details = encodeURIComponent(event.description);
@@ -174,15 +174,15 @@ export default function Share({ isDark }: { isDark: boolean }) {
)}/${sanitizeDate(endStr)}`;
const outlookLink = `https://outlook.live.com/calendar/0/deeplink/compose?subject=${title}&body=${details}&location=${location}&startdt=${startStr}&enddt=${endStr}${
- event.isAllDay ? "&allday=true" : ""
+ event.isAllDay ? '&allday=true' : ''
}`;
const office365Link = `https://outlook.office.com/calendar/0/deeplink/compose?subject=${title}&body=${details}&location=${location}&startdt=${startStr}&enddt=${endStr}${
- event.isAllDay ? "&allday=true" : ""
+ event.isAllDay ? '&allday=true' : ''
}`;
const yahooLink = `https://calendar.yahoo.com/?v=60&title=${title}&st=${startStr}&et=${endStr}&desc=${details}&in_loc=${location}&dur=${
- event.isAllDay ? "allday" : ""
+ event.isAllDay ? 'allday' : ''
}`;
// Apple Calendar: open the ICS (do not force download) so the OS can hand it to Calendar
@@ -204,7 +204,7 @@ export default function Share({ isDark }: { isDark: boolean }) {
{event.description}
{event.location && (
- Location:{" "}
+ Location:{' '}
{formatDateOnly(startDt)}
- {formatInTime(startDt, selectedTz)} to {formatInTime(endDt, selectedTz)}
+ {formatInTime(startDt, selectedTz)} to {formatInTime(endDt, selectedTz)} ({tzDisplay})
>
) : (
<>
Start: {formatInTimezone(startDt, selectedTz)}
-
End: {formatInTimezone(endDt, selectedTz)}
+
+ End: {formatInTimezone(endDt, selectedTz)} ({tzDisplay})
+
>
)}
-
Original Time Zone: {tzDisplay}
+
-
{shareLink}
+
+
+ {shareLink}
+
+
+
+