Fix Vite fast refresh warning (#13176)

12:28:18 PM [vite] (client) hmr invalidate
/src/modules/onboarding/components/onboardingSyncEmailsOptions.tsx Could
not Fast Refresh ("onboardingSyncEmailsOptions" export is incompatible).
Learn more at
https://github.com/vitejs/vite-plugin-react-swc#consistent-components-exports

<img width="1464" height="359" alt="Screenshot 2025-07-11 at 13 41 41"
src="https://github.com/user-attachments/assets/c6fc75a4-f638-4002-815d-b92e3e7fd7a8"
/>
This commit is contained in:
Félix Malfait
2025-07-11 16:01:02 +02:00
committed by GitHub
parent 0a93468b95
commit c3bd73a947
4 changed files with 81 additions and 50 deletions

View File

@ -1,5 +1,7 @@
import { onboardingSyncEmailsOptions } from '@/onboarding/components/onboardingSyncEmailsOptions'; import { ONBOARDING_SYNC_EMAILS_OPTIONS } from '@/onboarding/constants/OnboardingSyncEmailsOptions';
import { SettingsAccountsRadioSettingsCard } from '@/settings/accounts/components/SettingsAccountsRadioSettingsCard'; import { SettingsAccountsRadioSettingsCard } from '@/settings/accounts/components/SettingsAccountsRadioSettingsCard';
import { SettingsAccountsVisibilityIcon } from '@/settings/accounts/components/SettingsAccountsVisibilityIcon';
import styled from '@emotion/styled';
import { MessageChannelVisibility } from '~/generated/graphql'; import { MessageChannelVisibility } from '~/generated/graphql';
type OnboardingSyncEmailsSettingsCardProps = { type OnboardingSyncEmailsSettingsCardProps = {
@ -7,14 +9,31 @@ type OnboardingSyncEmailsSettingsCardProps = {
value?: MessageChannelVisibility; value?: MessageChannelVisibility;
}; };
const StyledCardMedia = styled(SettingsAccountsVisibilityIcon)`
width: ${({ theme }) => theme.spacing(10)};
`;
export const OnboardingSyncEmailsSettingsCard = ({ export const OnboardingSyncEmailsSettingsCard = ({
onChange, onChange,
value = MessageChannelVisibility.SHARE_EVERYTHING, value = MessageChannelVisibility.SHARE_EVERYTHING,
}: OnboardingSyncEmailsSettingsCardProps) => ( }: OnboardingSyncEmailsSettingsCardProps) => {
<SettingsAccountsRadioSettingsCard const optionsWithCardMedia = ONBOARDING_SYNC_EMAILS_OPTIONS.map((option) => ({
name="sync-emails-visiblity" ...option,
options={onboardingSyncEmailsOptions} cardMedia: (
value={value} <StyledCardMedia
onChange={onChange} metadata={option.cardMediaProps.metadata}
/> subject={option.cardMediaProps.subject}
); body={option.cardMediaProps.body}
/>
),
}));
return (
<SettingsAccountsRadioSettingsCard
name="sync-emails-visibility"
options={optionsWithCardMedia}
value={value}
onChange={onChange}
/>
);
};

View File

@ -1,36 +0,0 @@
import { SettingsAccountsVisibilityIcon } from '@/settings/accounts/components/SettingsAccountsVisibilityIcon';
import styled from '@emotion/styled';
import { msg } from '@lingui/core/macro';
import { MessageChannelVisibility } from '~/generated/graphql';
const StyledCardMedia = styled(SettingsAccountsVisibilityIcon)`
width: ${({ theme }) => theme.spacing(10)};
`;
export const onboardingSyncEmailsOptions = [
{
title: msg`Everything`,
description: msg`Your emails and events content will be shared with your team.`,
value: MessageChannelVisibility.SHARE_EVERYTHING,
cardMedia: (
<StyledCardMedia metadata="active" subject="active" body="active" />
),
},
{
title: msg`Subject and metadata`,
description: msg`Your email subjects and meeting titles will be shared with your team.`,
value: MessageChannelVisibility.SUBJECT,
cardMedia: (
<StyledCardMedia metadata="active" subject="active" body="inactive" />
),
},
{
title: msg`Metadata`,
description: msg`Only the timestamp & participants will be shared with your team.`,
value: MessageChannelVisibility.METADATA,
cardMedia: (
<StyledCardMedia metadata="active" subject="inactive" body="inactive" />
),
},
];

View File

@ -0,0 +1,48 @@
import { msg } from '@lingui/core/macro';
import { MessageChannelVisibility } from '~/generated/graphql';
type OnboardingEmailVisibilityProps = {
metadata: 'active' | 'inactive';
subject: 'active' | 'inactive';
body: 'active' | 'inactive';
};
const everythingProps: OnboardingEmailVisibilityProps = {
metadata: 'active',
subject: 'active',
body: 'active',
};
const subjectMetadataProps: OnboardingEmailVisibilityProps = {
metadata: 'active',
subject: 'active',
body: 'inactive',
};
const metadataOnlyProps: OnboardingEmailVisibilityProps = {
metadata: 'active',
subject: 'inactive',
body: 'inactive',
};
export const ONBOARDING_SYNC_EMAILS_OPTIONS = [
{
title: msg`Everything`,
description: msg`Your emails and events content will be shared with your team.`,
value: MessageChannelVisibility.SHARE_EVERYTHING,
cardMediaProps: everythingProps,
},
{
title: msg`Subject and metadata`,
description: msg`Your email subjects and meeting titles will be shared with your team.`,
value: MessageChannelVisibility.SUBJECT,
cardMediaProps: subjectMetadataProps,
},
{
title: msg`Metadata`,
description: msg`Only the timestamp & participants will be shared with your team.`,
value: MessageChannelVisibility.METADATA,
cardMediaProps: metadataOnlyProps,
},
];

View File

@ -57,7 +57,7 @@ export const MESSAGE_CHANNEL_DATA_SEEDS: MessageChannelDataSeed[] = [
type: 'email', type: 'email',
connectedAccountId: CONNECTED_ACCOUNT_DATA_SEED_IDS.TIM, connectedAccountId: CONNECTED_ACCOUNT_DATA_SEED_IDS.TIM,
handle: 'tim@apple.dev', handle: 'tim@apple.dev',
isSyncEnabled: false, isSyncEnabled: true,
visibility: MessageChannelVisibility.SHARE_EVERYTHING, visibility: MessageChannelVisibility.SHARE_EVERYTHING,
syncStage: MessageChannelSyncStage.FULL_MESSAGE_LIST_FETCH_PENDING, syncStage: MessageChannelSyncStage.FULL_MESSAGE_LIST_FETCH_PENDING,
}, },
@ -70,7 +70,7 @@ export const MESSAGE_CHANNEL_DATA_SEEDS: MessageChannelDataSeed[] = [
type: 'email', type: 'email',
connectedAccountId: CONNECTED_ACCOUNT_DATA_SEED_IDS.JONY, connectedAccountId: CONNECTED_ACCOUNT_DATA_SEED_IDS.JONY,
handle: 'jony.ive@apple.dev', handle: 'jony.ive@apple.dev',
isSyncEnabled: false, isSyncEnabled: true,
visibility: MessageChannelVisibility.SHARE_EVERYTHING, visibility: MessageChannelVisibility.SHARE_EVERYTHING,
syncStage: MessageChannelSyncStage.FULL_MESSAGE_LIST_FETCH_PENDING, syncStage: MessageChannelSyncStage.FULL_MESSAGE_LIST_FETCH_PENDING,
}, },
@ -83,7 +83,7 @@ export const MESSAGE_CHANNEL_DATA_SEEDS: MessageChannelDataSeed[] = [
type: 'email', type: 'email',
connectedAccountId: CONNECTED_ACCOUNT_DATA_SEED_IDS.PHIL, connectedAccountId: CONNECTED_ACCOUNT_DATA_SEED_IDS.PHIL,
handle: 'phil.schiler@apple.dev', handle: 'phil.schiler@apple.dev',
isSyncEnabled: false, isSyncEnabled: true,
visibility: MessageChannelVisibility.SHARE_EVERYTHING, visibility: MessageChannelVisibility.SHARE_EVERYTHING,
syncStage: MessageChannelSyncStage.FULL_MESSAGE_LIST_FETCH_PENDING, syncStage: MessageChannelSyncStage.FULL_MESSAGE_LIST_FETCH_PENDING,
}, },
@ -96,7 +96,7 @@ export const MESSAGE_CHANNEL_DATA_SEEDS: MessageChannelDataSeed[] = [
type: 'email', type: 'email',
connectedAccountId: CONNECTED_ACCOUNT_DATA_SEED_IDS.TIM, // Use TIM's connected account for shared inbox connectedAccountId: CONNECTED_ACCOUNT_DATA_SEED_IDS.TIM, // Use TIM's connected account for shared inbox
handle: 'support@apple.dev', handle: 'support@apple.dev',
isSyncEnabled: false, isSyncEnabled: true,
visibility: MessageChannelVisibility.SHARE_EVERYTHING, visibility: MessageChannelVisibility.SHARE_EVERYTHING,
syncStage: MessageChannelSyncStage.FULL_MESSAGE_LIST_FETCH_PENDING, syncStage: MessageChannelSyncStage.FULL_MESSAGE_LIST_FETCH_PENDING,
}, },
@ -109,7 +109,7 @@ export const MESSAGE_CHANNEL_DATA_SEEDS: MessageChannelDataSeed[] = [
type: 'email', type: 'email',
connectedAccountId: CONNECTED_ACCOUNT_DATA_SEED_IDS.TIM, // Use TIM's connected account for shared inbox connectedAccountId: CONNECTED_ACCOUNT_DATA_SEED_IDS.TIM, // Use TIM's connected account for shared inbox
handle: 'sales@apple.dev', handle: 'sales@apple.dev',
isSyncEnabled: false, isSyncEnabled: true,
visibility: MessageChannelVisibility.SHARE_EVERYTHING, visibility: MessageChannelVisibility.SHARE_EVERYTHING,
syncStage: MessageChannelSyncStage.FULL_MESSAGE_LIST_FETCH_PENDING, syncStage: MessageChannelSyncStage.FULL_MESSAGE_LIST_FETCH_PENDING,
}, },