Fix-issue-370 (#9996)

Fixes the issue from introduced when alowing gmail and outlook.

fixes https://github.com/twentyhq/core-team-issues/issues/370
This commit is contained in:
Guillim
2025-02-04 15:20:35 +01:00
committed by GitHub
parent b9b7700155
commit 53b51c8bba
19 changed files with 338 additions and 70 deletions

View File

@ -1,6 +1,11 @@
import { isGoogleCalendarEnabledState } from '@/client-config/states/isGoogleCalendarEnabledState';
import { isGoogleMessagingEnabledState } from '@/client-config/states/isGoogleMessagingEnabledState';
import { isMicrosoftCalendarEnabledState } from '@/client-config/states/isMicrosoftCalendarEnabledState';
import { isMicrosoftMessagingEnabledState } from '@/client-config/states/isMicrosoftMessagingEnabledState';
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,
@ -33,23 +38,40 @@ export const SettingsAccountsListEmptyStateCard = ({
const { t } = useLingui();
const isGoogleMessagingEnabled = useRecoilValue(
isGoogleMessagingEnabledState,
);
const isMicrosoftMessagingEnabled = useRecoilValue(
isMicrosoftMessagingEnabledState,
);
const isGoogleCalendarEnabled = useRecoilValue(isGoogleCalendarEnabledState);
const isMicrosoftCalendarEnabled = useRecoilValue(
isMicrosoftCalendarEnabledState,
);
return (
<Card>
<StyledHeader>{label || t`No connected account`}</StyledHeader>
<StyledBody>
<Button
Icon={IconGoogle}
title={t`Connect with Google`}
variant="secondary"
onClick={() => triggerApisOAuth('google')}
/>
{(isGoogleMessagingEnabled || isGoogleCalendarEnabled) && (
<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')}
/>
{(isMicrosoftMessagingEnabled || isMicrosoftCalendarEnabled) && (
<Button
Icon={IconMicrosoft}
title={t`Connect with Microsoft`}
variant="secondary"
onClick={() => triggerApisOAuth('microsoft')}
/>
)}
</StyledBody>
</Card>
);