* feat: add Settings/Accounts/New section with empty state * fix: added label for Empty State Card * On RecordTable, if I have no records, the Record Table Layout is not broken (#2911) * On RecordTable, if I have no records, the Record Table Layout is not broken Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: RubensRafael <rubensrafael2@live.com> * Revert scrollbar changes Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: RubensRafael <rubensrafael2@live.com> * fix + button Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: RubensRafael <rubensrafael2@live.com> * Revert unwanted changes Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: RubensRafael <rubensrafael2@live.com> * Merge main Co-authored-by: Thiago Nascimbeni <tnascimbeni@gmail.com> Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: RubensRafael <rubensrafael2@live.com> * On RecordTable, if I have no records, the Record Table Layout is not broken Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: Thiago Nascimbeni <tnascimbeni@gmail.com> Co-authored-by: RubensRafael <rubensrafael2@live.com> * Add bottom border Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: Thiago Nascimbeni <tnascimbeni@gmail.com> Co-authored-by: RubensRafael <rubensrafael2@live.com> * Always show + button Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: Thiago Nascimbeni <tnascimbeni@gmail.com> Co-authored-by: RubensRafael <rubensrafael2@live.com> * Refactor according to review Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: Thiago Nascimbeni <tnascimbeni@gmail.com> Co-authored-by: RubensRafael <rubensrafael2@live.com> * Fix according to PR --------- Co-authored-by: gitstart-twenty <gitstart-twenty@users.noreply.github.com> Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: RubensRafael <rubensrafael2@live.com> Co-authored-by: Charles Bochet <charles@twenty.com> Co-authored-by: Thiago Nascimbeni <tnascimbeni@gmail.com> Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com> * Add jest tests for twenty-front (#2983) * Add jest tests for twenty-front Co-authored-by: v1b3m <vibenjamin6@gmail.com> * Fix tests --------- Co-authored-by: gitstart-twenty <gitstart-twenty@users.noreply.github.com> Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: Charles Bochet <charles@twenty.com> * feat: select default Unit for Currency field (#2996) Closes #2347 Co-authored-by: Thais GUIGON <thaisguigon@macbook-pro.home> * Remaining UI docs (#2997) * remaining UI docs * completed ui component docs --------- Co-authored-by: Charles Bochet <charles@twenty.com> * Fix CIs (#3004) * Fix CIs * Fix docs * Fix eslint-build * Move file * Move back * Fix server ci * Fix server ci * Fix server ci * Fix server ci * Deactivate e2e tests * Fix front * Fix front * Fix front * Add twenty-zapier and twenty-utils to the yarn project * fix * fix * Remove pull_request trigger * Fix ExceptionHandler requiring httpAdapter (#3021) * Disable chromatic CI * Disable Danger CI on push trigger (#3024) Disable Danger CI on main * feat: add Show Page Emails tab (#2962) * feat: add Show Page Emails tab Closes #2926, Closes #2927 * feat: review - disable Emails tab if messaging not enabled * refactor: review - add FeatureFlagKey type --------- Co-authored-by: Thais GUIGON <thaisguigon@macbook-pro.home> * 2880 timebox create a poc to fetch emails from the gmail api (#2993) * create empty service * getting threads is working * insert message channel * save threads in the db * clean * fetch messages * create a service to fetch a batch of messages * batch messages * use httpService instead * parse batch * base 64 decoding working * solve parsing bug * saving messages is working * bug to fix in fetchAllByBatches * fetching all messages is working but not saving yet * fecth 500 messages and threads is working * remove unused package and console log * set direction to incoming * fix bug after merging main * Fix modified files DangerCI (#3025) - fix modified files * feat: add Show Page Emails preview (#2964) * feat: add Show Page Emails preview Closes #2928 * refactor: review - rename StyledContainer to StyledCardContent * 2915 rest api documentation (#3020) * Init rest-api page * Add ugly form to fetch open api schema * Clean code * Make the form design more acceptable * Update doc * Use local storage * Update design * Add isLoading * Fix typo * Fix long lines * Code review returns * Remove staging and local url from servers * 2982-feat: Clear SelectableList reset scoped state (#2987) * 2982-feat: Clear SelectableList reset scoped state * State fixes as suggested in pr * State fixes as suggested in pr --------- Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com> Co-authored-by: Charles Bochet <charles@twenty.com> * Fix docusaurus style overriden by spotlight/element (rest api playground) (#3033) * Fix docusaurus style overriden by spotlight/element (rest api playground) * Fix spacing * Fix spacing * Fix: keep the filter edition open if it is empty (#2986) Co-authored-by: 曹志浩 <caozhihao@quyiyuan.com> Co-authored-by: Charles Bochet <charles@twenty.com> --------- Co-authored-by: Lakshay saini <lakshay.saini@finmo.net> Co-authored-by: gitstart-twenty <140154534+gitstart-twenty@users.noreply.github.com> Co-authored-by: gitstart-twenty <gitstart-twenty@users.noreply.github.com> Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: RubensRafael <rubensrafael2@live.com> Co-authored-by: Charles Bochet <charles@twenty.com> Co-authored-by: Thiago Nascimbeni <tnascimbeni@gmail.com> Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com> Co-authored-by: Thaïs <guigon.thais@gmail.com> Co-authored-by: Thais GUIGON <thaisguigon@macbook-pro.home> Co-authored-by: Nimra Ahmed <50912134+nimraahmed@users.noreply.github.com> Co-authored-by: Charles Bochet <charlesBochet@users.noreply.github.com> Co-authored-by: bosiraphael <71827178+bosiraphael@users.noreply.github.com> Co-authored-by: brendanlaschke <brendan.laschke@googlemail.com> Co-authored-by: martmull <martmull@hotmail.fr> Co-authored-by: Kanav Arora <kanavarora1515@gmail.com> Co-authored-by: Cao Z.H <150761799+CzhCN0@users.noreply.github.com> Co-authored-by: 曹志浩 <caozhihao@quyiyuan.com>
57 lines
1.6 KiB
TypeScript
57 lines
1.6 KiB
TypeScript
import { useCallback } from 'react';
|
|
import styled from '@emotion/styled';
|
|
|
|
import { IconGoogle } from '@/ui/display/icon/components/IconGoogle';
|
|
import { Button } from '@/ui/input/button/components/Button';
|
|
import { Card } from '@/ui/layout/card/components/Card';
|
|
import { CardContent } from '@/ui/layout/card/components/CardContent';
|
|
import { CardHeader } from '@/ui/layout/card/components/CardHeader';
|
|
import { REACT_APP_SERVER_AUTH_URL } from '~/config';
|
|
import { useGenerateTransientTokenMutation } from '~/generated/graphql';
|
|
|
|
const StyledHeader = styled(CardHeader)`
|
|
align-items: center;
|
|
display: flex;
|
|
height: ${({ theme }) => theme.spacing(6)};
|
|
`;
|
|
|
|
const StyledBody = styled(CardContent)`
|
|
display: flex;
|
|
justify-content: center;
|
|
`;
|
|
|
|
type SettingsAccountsEmptyStateCardProps = {
|
|
label?: string;
|
|
};
|
|
|
|
export const SettingsAccountsEmptyStateCard = ({
|
|
label,
|
|
}: SettingsAccountsEmptyStateCardProps) => {
|
|
const [generateTransientToken] = useGenerateTransientTokenMutation();
|
|
|
|
const handleGmailLogin = useCallback(async () => {
|
|
const authServerUrl = REACT_APP_SERVER_AUTH_URL;
|
|
|
|
const transientToken = await generateTransientToken();
|
|
|
|
const token =
|
|
transientToken.data?.generateTransientToken.transientToken.token;
|
|
|
|
window.location.href = `${authServerUrl}/google-gmail?transientToken=${token}`;
|
|
}, [generateTransientToken]);
|
|
|
|
return (
|
|
<Card>
|
|
<StyledHeader>{label || 'No connected account'}</StyledHeader>
|
|
<StyledBody>
|
|
<Button
|
|
Icon={IconGoogle}
|
|
title="Connect with Google"
|
|
variant="secondary"
|
|
onClick={handleGmailLogin}
|
|
/>
|
|
</StyledBody>
|
|
</Card>
|
|
);
|
|
};
|