Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add option to disable deleting calendar credentials for CalendarSettings atom #18759

Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ type CalendarSettingsPlatformWrapperProps = {
selectedCalendarSettingsCustomClassnames?: string;
};
calendarRedirectUrls?: CalendarRedirectUrls;
allowDelete?: boolean;
};

export const CalendarSettingsPlatformWrapper = ({
classNames,
calendarRedirectUrls,
allowDelete = true,
}: CalendarSettingsPlatformWrapperProps) => {
return (
<div className={classNames?.calendarSettingsCustomClassnames}>
Expand All @@ -24,6 +26,7 @@ export const CalendarSettingsPlatformWrapper = ({
<SelectedCalendarsSettingsPlatformWrapper
classNames={classNames?.selectedCalendarSettingsCustomClassnames}
calendarRedirectUrls={calendarRedirectUrls}
allowDelete={allowDelete}
/>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,13 @@ export type CalendarRedirectUrls = {
type SelectedCalendarsSettingsPlatformWrapperProps = {
classNames?: string;
calendarRedirectUrls?: CalendarRedirectUrls;
allowDelete?: boolean;
};

export const SelectedCalendarsSettingsPlatformWrapper = ({
classNames = "mx-5 mb-6",
calendarRedirectUrls,
allowDelete,
}: SelectedCalendarsSettingsPlatformWrapperProps) => {
const { t } = useLocale();
const query = useConnectedCalendars({});
Expand Down Expand Up @@ -81,12 +83,14 @@ export const SelectedCalendarsSettingsPlatformWrapper = ({
className="border-subtle mt-4 rounded-lg border"
actions={
<div className="flex w-32 justify-end">
<PlatformDisconnectIntegration
credentialId={connectedCalendar.credentialId}
trashIcon
buttonProps={{ className: "border border-default" }}
slug={connectedCalendar.integration.slug}
/>
{allowDelete && (
<PlatformDisconnectIntegration
credentialId={connectedCalendar.credentialId}
trashIcon
buttonProps={{ className: "border border-default" }}
slug={connectedCalendar.integration.slug}
/>
)}
</div>
}>
<div className="border-subtle border-t">
Expand Down
2 changes: 1 addition & 1 deletion packages/platform/examples/base/src/pages/calendars.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default function Calendars(props: { calUsername: string; calEmail: string
<main className={`flex min-h-screen flex-col ${inter.className}`}>
<Navbar username={props.calUsername} />
<div>
<CalendarSettings />
<CalendarSettings allowDelete={true} />
</div>
</main>
);
Expand Down
Loading