From 21b7eff326c8144d43f01da188b1180bc51c4eb6 Mon Sep 17 00:00:00 2001 From: Flea Flicker Date: Thu, 26 Mar 2026 08:18:54 +0000 Subject: [PATCH] fix(CalendarSync): replace window.confirm() with inline confirmation and rename file - Replace blocking window.confirm() with showRevokeConfirm state + inline confirmation dialog in CalendarSyncSection - Rename CalendarSync.tsx to CalendarSyncSection.tsx to match export convention Co-Authored-By: Paperclip --- ...lendarSync.tsx => CalendarSyncSection.tsx} | 84 +++++++++++++------ 1 file changed, 57 insertions(+), 27 deletions(-) rename apps/web/src/components/{CalendarSync.tsx => CalendarSyncSection.tsx} (66%) 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.