allow people to connect their mailbox (#9982)
allow people to connect their mailbox independantly from the auth possibilities
This commit is contained in:
@ -4,10 +4,7 @@ import { ConnectedAccount } from '@/accounts/types/ConnectedAccount';
|
||||
import { SettingsAccountsListEmptyStateCard } from '@/settings/accounts/components/SettingsAccountsListEmptyStateCard';
|
||||
import { SettingsPath } from '@/types/SettingsPath';
|
||||
|
||||
import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';
|
||||
import { SettingsAccountsConnectedAccountsRowRightContainer } from '@/settings/accounts/components/SettingsAccountsConnectedAccountsRowRightContainer';
|
||||
import { useRecoilValue } from 'recoil';
|
||||
import { isDefined } from 'twenty-shared';
|
||||
import { useNavigateSettings } from '~/hooks/useNavigateSettings';
|
||||
import { SettingsListCard } from '../../components/SettingsListCard';
|
||||
|
||||
@ -24,17 +21,11 @@ export const SettingsAccountsConnectedAccountsListCard = ({
|
||||
loading?: boolean;
|
||||
}) => {
|
||||
const navigate = useNavigateSettings();
|
||||
const currentWorkspace = useRecoilValue(currentWorkspaceState);
|
||||
|
||||
if (!accounts.length) {
|
||||
return <SettingsAccountsListEmptyStateCard />;
|
||||
}
|
||||
|
||||
const atLeastOneProviderAvailable =
|
||||
isDefined(currentWorkspace) &&
|
||||
(currentWorkspace?.isGoogleAuthEnabled ||
|
||||
currentWorkspace?.isMicrosoftAuthEnabled);
|
||||
|
||||
return (
|
||||
<SettingsListCard
|
||||
items={accounts}
|
||||
@ -44,7 +35,7 @@ export const SettingsAccountsConnectedAccountsListCard = ({
|
||||
RowRightComponent={({ item: account }) => (
|
||||
<SettingsAccountsConnectedAccountsRowRightContainer account={account} />
|
||||
)}
|
||||
hasFooter={atLeastOneProviderAvailable}
|
||||
hasFooter={true}
|
||||
footerButtonLabel="Add account"
|
||||
onFooterButtonClick={() => navigate(SettingsPath.NewAccount)}
|
||||
/>
|
||||
|
||||
@ -1,8 +1,6 @@
|
||||
import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';
|
||||
import { useTriggerApisOAuth } from '@/settings/accounts/hooks/useTriggerApiOAuth';
|
||||
import styled from '@emotion/styled';
|
||||
import { useLingui } from '@lingui/react/macro';
|
||||
import { useRecoilValue } from 'recoil';
|
||||
import {
|
||||
Button,
|
||||
Card,
|
||||
@ -32,7 +30,6 @@ export const SettingsAccountsListEmptyStateCard = ({
|
||||
label,
|
||||
}: SettingsAccountsListEmptyStateCardProps) => {
|
||||
const { triggerApisOAuth } = useTriggerApisOAuth();
|
||||
const currentWorkspace = useRecoilValue(currentWorkspaceState);
|
||||
|
||||
const { t } = useLingui();
|
||||
|
||||
@ -40,22 +37,19 @@ export const SettingsAccountsListEmptyStateCard = ({
|
||||
<Card>
|
||||
<StyledHeader>{label || t`No connected account`}</StyledHeader>
|
||||
<StyledBody>
|
||||
{currentWorkspace?.isGoogleAuthEnabled && (
|
||||
<Button
|
||||
Icon={IconGoogle}
|
||||
title={t`Connect with Google`}
|
||||
variant="secondary"
|
||||
onClick={() => triggerApisOAuth('google')}
|
||||
/>
|
||||
)}
|
||||
{currentWorkspace?.isMicrosoftAuthEnabled && (
|
||||
<Button
|
||||
Icon={IconMicrosoft}
|
||||
title={t`Connect with Microsoft`}
|
||||
variant="secondary"
|
||||
onClick={() => triggerApisOAuth('microsoft')}
|
||||
/>
|
||||
)}
|
||||
<Button
|
||||
Icon={IconGoogle}
|
||||
title={t`Connect with Google`}
|
||||
variant="secondary"
|
||||
onClick={() => triggerApisOAuth('google')}
|
||||
/>
|
||||
|
||||
<Button
|
||||
Icon={IconMicrosoft}
|
||||
title={t`Connect with Microsoft`}
|
||||
variant="secondary"
|
||||
onClick={() => triggerApisOAuth('microsoft')}
|
||||
/>
|
||||
</StyledBody>
|
||||
</Card>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user