5622 add a syncemail onboarding step (#5689)
- add sync email onboarding step - refactor calendar and email visibility enums - add a new table `keyValuePair` in `core` schema - add a new resolved boolean field `skipSyncEmail` in current user https://github.com/twentyhq/twenty/assets/29927851/de791475-5bfe-47f9-8e90-76c349fba56f
This commit is contained in:
@ -8,18 +8,22 @@ import { useEmailThread } from '@/activities/emails/hooks/useEmailThread';
|
||||
import { emailThreadIdWhenEmailThreadWasClosedState } from '@/activities/emails/states/lastViewableEmailThreadIdState';
|
||||
import { CardContent } from '@/ui/layout/card/components/CardContent';
|
||||
import { useRightDrawer } from '@/ui/layout/right-drawer/hooks/useRightDrawer';
|
||||
import { TimelineThread } from '~/generated/graphql';
|
||||
import { MessageChannelVisibility, TimelineThread } from '~/generated/graphql';
|
||||
import { formatToHumanReadableDate } from '~/utils';
|
||||
import { getImageAbsoluteURIOrBase64 } from '~/utils/image/getImageAbsoluteURIOrBase64';
|
||||
|
||||
const StyledCardContent = styled(CardContent)<{ visibility: string }>`
|
||||
const StyledCardContent = styled(CardContent)<{
|
||||
visibility: MessageChannelVisibility;
|
||||
}>`
|
||||
align-items: center;
|
||||
display: flex;
|
||||
gap: ${({ theme }) => theme.spacing(2)};
|
||||
height: ${({ theme }) => theme.spacing(12)};
|
||||
padding: ${({ theme }) => theme.spacing(0, 4)};
|
||||
cursor: ${({ visibility }) =>
|
||||
visibility === 'share_everything' ? 'pointer' : 'default'};
|
||||
visibility === MessageChannelVisibility.ShareEverything
|
||||
? 'pointer'
|
||||
: 'default'};
|
||||
`;
|
||||
|
||||
const StyledHeading = styled.div<{ unread: boolean }>`
|
||||
@ -78,8 +82,6 @@ const StyledReceivedAt = styled.div`
|
||||
padding: ${({ theme }) => theme.spacing(0, 1)};
|
||||
`;
|
||||
|
||||
export type EmailThreadVisibility = 'metadata' | 'subject' | 'share_everything';
|
||||
|
||||
type EmailThreadPreviewProps = {
|
||||
divider?: boolean;
|
||||
thread: TimelineThread;
|
||||
@ -93,7 +95,7 @@ export const EmailThreadPreview = ({
|
||||
|
||||
const { openEmailThread } = useEmailThread();
|
||||
|
||||
const visibility = thread.visibility as EmailThreadVisibility;
|
||||
const visibility = thread.visibility;
|
||||
|
||||
const senderNames =
|
||||
thread.firstParticipant.displayName +
|
||||
@ -126,7 +128,7 @@ export const EmailThreadPreview = ({
|
||||
.getValue();
|
||||
|
||||
const canOpen =
|
||||
thread.visibility === 'share_everything' &&
|
||||
thread.visibility === MessageChannelVisibility.ShareEverything &&
|
||||
(!clickJustTriggeredEmailDrawerClose ||
|
||||
emailThreadIdWhenEmailThreadWasClosed !== thread.id);
|
||||
|
||||
@ -183,13 +185,15 @@ export const EmailThreadPreview = ({
|
||||
</StyledHeading>
|
||||
|
||||
<StyledSubjectAndBody>
|
||||
{visibility !== 'metadata' && (
|
||||
{visibility !== MessageChannelVisibility.Metadata && (
|
||||
<StyledSubject>{thread.subject}</StyledSubject>
|
||||
)}
|
||||
{visibility === 'share_everything' && (
|
||||
{visibility === MessageChannelVisibility.ShareEverything && (
|
||||
<StyledBody>{thread.lastMessageBody}</StyledBody>
|
||||
)}
|
||||
{visibility !== 'share_everything' && <EmailThreadNotShared />}
|
||||
{visibility !== MessageChannelVisibility.ShareEverything && (
|
||||
<EmailThreadNotShared />
|
||||
)}
|
||||
</StyledSubjectAndBody>
|
||||
<StyledReceivedAt>
|
||||
{formatToHumanReadableDate(thread.lastMessageReceivedAt)}
|
||||
|
||||
Reference in New Issue
Block a user