Skip to content

The open alternative to Salesforce, designed for AI.

Display confirmation dialog on connected account deletion (#10323)

Alex Motocad47ab5bcd30
diff --git a/.github/workflows/i18n-pull.yaml b/.github/workflows/i18n-pull.yaml
index b45ab4a68ff..562f9feec59 100644
--- a/.github/workflows/i18n-pull.yaml
+++ b/.github/workflows/i18n-pull.yaml
@@ -104,6 +104,9 @@ jobs:
npx nx run twenty-emails:lingui:compile
npx nx run twenty-front:lingui:compile
+ - name: Debug git status
+ run: git status
+
- name: Check and commit compiled files
id: check_changes
run: |
diff --git a/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsRowDropdownMenu.tsx b/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsRowDropdownMenu.tsx
index 3192bd281d2..a02cf68bfc6 100644
--- a/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsRowDropdownMenu.tsx
+++ b/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsRowDropdownMenu.tsx
@@ -1,3 +1,4 @@
+import { useState } from 'react';
import {
IconCalendarEvent,
IconDotsVertical,
@@ -16,6 +17,7 @@ import { SettingsPath } from '@/types/SettingsPath';
import { Dropdown } from '@/ui/layout/dropdown/components/Dropdown';
import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer';
import { useDropdown } from '@/ui/layout/dropdown/hooks/useDropdown';
+import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';
import { useNavigateSettings } from '~/hooks/useNavigateSettings';
type SettingsAccountsRowDropdownMenuProps = {
@@ -27,6 +29,9 @@ export const SettingsAccountsRowDropdownMenu = ({
}: SettingsAccountsRowDropdownMenuProps) => {
const dropdownId = `settings-account-row-${account.id}`;
+ const [isDeleteAccountModalOpen, setIsDeleteAccountModalOpen] =
+ useState(false);
+
const navigate = useNavigateSettings();
const { closeDropdown } = useDropdown(dropdownId);
@@ -35,54 +40,72 @@ export const SettingsAccountsRowDropdownMenu = ({
});
const { triggerApisOAuth } = useTriggerApisOAuth();
+ const deleteAccount = async () => {
+ await destroyOneRecord(account.id);
+ setIsDeleteAccountModalOpen(false);
+ };
+
return (
- <Dropdown
- dropdownId={dropdownId}
- dropdownPlacement="right-start"
- dropdownHotkeyScope={{ scope: dropdownId }}
- clickableComponent={
- <LightIconButton Icon={IconDotsVertical} accent="tertiary" />
- }
- dropdownMenuWidth={160}
- dropdownComponents={
- <DropdownMenuItemsContainer>
- <MenuItem
- LeftIcon={IconMail}
- text="Emails settings"
- onClick={() => {
- navigate(SettingsPath.AccountsEmails);
- closeDropdown();
- }}
- />
- <MenuItem
- LeftIcon={IconCalendarEvent}
- text="Calendar settings"
- onClick={() => {
- navigate(SettingsPath.AccountsCalendars);
- closeDropdown();
- }}
- />
- {account.authFailedAt && (
+ <>
+ <Dropdown
+ dropdownId={dropdownId}
+ className={className}
+ dropdownPlacement="right-start"
+ dropdownHotkeyScope={{ scope: dropdownId }}
+ clickableComponent={
+ <LightIconButton Icon={IconDotsVertical} accent="tertiary" />
+ }
+ dropdownMenuWidth={160}
+ dropdownComponents={
+ <DropdownMenuItemsContainer>
+ <MenuItem
+ LeftIcon={IconMail}
+ text="Emails settings"
+ onClick={() => {
+ navigate(SettingsPath.AccountsEmails);
+ closeDropdown();
+ }}
+ />
+ <MenuItem
+ LeftIcon={IconCalendarEvent}
+ text="Calendar settings"
+ onClick={() => {
+ navigate(SettingsPath.AccountsCalendars);
+ closeDropdown();
+ }}
+ />
+ {account.authFailedAt && (
+ <MenuItem
+ LeftIcon={IconRefresh}
+ text="Reconnect"
+ onClick={() => {
+ triggerApisOAuth(account.provider);
+ closeDropdown();
+ }}
+ />
+ )}
<MenuItem
- LeftIcon={IconRefresh}
- text="Reconnect"
+ accent="danger"
+ LeftIcon={IconTrash}
+ text="Remove account"
onClick={() => {
- triggerApisOAuth(account.provider);
+ setIsDeleteAccountModalOpen(true);
closeDropdown();
}}
/>
- )}
- <MenuItem
- accent="danger"
- LeftIcon={IconTrash}
- text="Remove account"
- onClick={() => {
- destroyOneRecord(account.id);
- closeDropdown();
- }}
- />
- </DropdownMenuItemsContainer>
- }
- />
+ </DropdownMenuItemsContainer>
+ }
+ />
+ <ConfirmationModal
+ isOpen={isDeleteAccountModalOpen}
+ setIsOpen={setIsDeleteAccountModalOpen}
+ title="Data deletion"
+ subtitle={
+ <>All emails and events linked to this account will be deleted</>
+ }
+ onConfirmClick={deleteAccount}
+ deleteButtonText="Delete account"
+ />
+ </>
);
};