Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 38 additions & 3 deletions apps/desktop/src/components/onboarding/calendar.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import { platform } from "@tauri-apps/plugin-os";
import { CalendarIcon } from "lucide-react";

import { Button } from "@hypr/ui/components/ui/button";

import { usePermission } from "../../hooks/usePermissions";
import { useAppleCalendarSelection } from "../main/body/calendar/apple/calendar-selection";
import { SyncProvider } from "../main/body/calendar/apple/context";
import { ApplePermissions } from "../main/body/calendar/apple/permission";
Expand All @@ -18,18 +22,49 @@ function AppleCalendarList() {
);
}

function RequestCalendarAccess({
onRequest,
isPending,
}: {
onRequest: () => void;
isPending: boolean;
}) {
return (
<div className="flex flex-col items-center justify-center py-6 px-4 border rounded-lg">
<CalendarIcon className="size-6 text-neutral-300 mb-2" />
<Button
variant="outline"
size="sm"
onClick={onRequest}
disabled={isPending}
>
Request Access to Calendar
</Button>
</div>
);
}

export function CalendarSection({ onContinue }: { onContinue: () => void }) {
const isMacos = platform() === "macos";
const calendar = usePermission("calendar");
const isAuthorized = calendar.status === "authorized";

return (
<div className="flex flex-col gap-4">
{isMacos && (
<div className="flex flex-col gap-4">
<ApplePermissions />

<SyncProvider>
<AppleCalendarList />
</SyncProvider>
{isAuthorized ? (
<SyncProvider>
<AppleCalendarList />
</SyncProvider>
) : (
<RequestCalendarAccess
onRequest={calendar.request}
isPending={calendar.isPending}
/>
)}
</div>
Comment on lines 55 to 68
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚩 Duplicate permission request UI when calendar is not authorized

When isAuthorized is false, both ApplePermissions (line 56) and RequestCalendarAccess (lines 62-65) are rendered simultaneously. ApplePermissions (apps/desktop/src/components/main/body/calendar/apple/permission.tsx:10-25) already renders an AccessPermissionRow with a request button for calendar permission. The new RequestCalendarAccess component adds a second, separate "Request Access to Calendar" button in the area where the calendar list would normally appear.

This means the user sees two different ways to request calendar access at the same time. Compare with apps/desktop/src/components/main/body/calendar/sidebar.tsx:62-93 where the permission row and the calendar list are shown conditionally — the permission row is hidden once authorized, and the calendar list replaces it. The onboarding flow doesn't follow this same pattern.

This may be intentional (permission row for status/troubleshooting, button as a clear CTA), but it's worth confirming the design intent.

(Refers to lines 54-68)

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

)}

Expand Down