diff --git a/apps/web/src/components/CalendarSync.tsx b/apps/web/src/components/CalendarSyncSection.tsx similarity index 66% rename from apps/web/src/components/CalendarSync.tsx rename to apps/web/src/components/CalendarSyncSection.tsx index 795d1c2..abf66fa 100644 --- a/apps/web/src/components/CalendarSync.tsx +++ b/apps/web/src/components/CalendarSyncSection.tsx @@ -12,6 +12,7 @@ export function CalendarSyncSection({ staffId }: Props) { const [actionLoading, setActionLoading] = useState<"generate" | "revoke" | null>(null); const [error, setError] = useState(null); const [copied, setCopied] = useState(false); + const [showRevokeConfirm, setShowRevokeConfirm] = useState(false); useEffect(() => { fetchToken(); @@ -51,7 +52,8 @@ export function CalendarSyncSection({ staffId }: Props) { } async function revokeToken() { - if (!confirm("Revoke your calendar feed link? Anyone with the current link will lose access.")) { + if (!showRevokeConfirm) { + setShowRevokeConfirm(true); return; } setActionLoading("revoke"); @@ -67,6 +69,7 @@ export function CalendarSyncSection({ staffId }: Props) { setError(e instanceof Error ? e.message : "Failed to revoke token"); } finally { setActionLoading(null); + setShowRevokeConfirm(false); } } @@ -120,32 +123,59 @@ export function CalendarSyncSection({ staffId }: Props) { -
- - -
+ {showRevokeConfirm ? ( +
+

+ Revoke your calendar feed link? Anyone with the current link will lose access. +

+ + +
+ ) : ( +
+ + +
+ )}

Regenerating will create a new URL and invalidate the old one.