diff --git a/packages/twenty-front/src/modules/auth/components/VerifyEmailEffect.tsx b/packages/twenty-front/src/modules/auth/components/VerifyEmailEffect.tsx index 9c104d7a3..7a3969a8f 100644 --- a/packages/twenty-front/src/modules/auth/components/VerifyEmailEffect.tsx +++ b/packages/twenty-front/src/modules/auth/components/VerifyEmailEffect.tsx @@ -5,6 +5,7 @@ import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar'; import { useVerifyLogin } from '@/auth/hooks/useVerifyLogin'; import { useRedirectToWorkspaceDomain } from '@/domain-manager/hooks/useRedirectToWorkspaceDomain'; +import { Modal } from '@/ui/layout/modal/components/Modal'; import { useLingui } from '@lingui/react/macro'; import { useEffect, useState } from 'react'; import { useSearchParams } from 'react-router-dom'; @@ -70,7 +71,11 @@ export const VerifyEmailEffect = () => { }, []); if (isError) { - return ; + return ( + + + + ); } return <>; diff --git a/packages/twenty-front/src/modules/auth/components/__stories__/VerifyEmailEffect.stories.tsx b/packages/twenty-front/src/modules/auth/components/__stories__/VerifyEmailEffect.stories.tsx new file mode 100644 index 000000000..4d2aac62d --- /dev/null +++ b/packages/twenty-front/src/modules/auth/components/__stories__/VerifyEmailEffect.stories.tsx @@ -0,0 +1,75 @@ +import { Meta, StoryObj } from '@storybook/react'; +import { MemoryRouter, Route, Routes } from 'react-router-dom'; +import { RecoilRoot } from 'recoil'; +import { VerifyEmailEffect } from '../VerifyEmailEffect'; + +// Mock component that just renders the error state of VerifyEmailEffect directly +// (since normal VerifyEmailEffect has async logic that's hard to test in Storybook) +import { Modal } from '@/ui/layout/modal/components/Modal'; +import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator'; +import { EmailVerificationSent } from '../../sign-in-up/components/EmailVerificationSent'; + +const VerifyEmailEffectErrorState = ({ email = 'user@example.com' }) => { + return ( + + + + ); +}; + +const meta: Meta = { + title: 'Pages/Auth/VerifyEmailEffect', + component: VerifyEmailEffectErrorState, + decorators: [ + (Story) => ( +
+ + + +
+ ), + SnackBarDecorator, + ], + parameters: { + codeSection: { + docs: 'IMPORTANT: When rendering EmailVerificationSent from VerifyEmailEffect, always wrap it with Modal.Content to maintain consistent styling.', + }, + }, +}; + +export default meta; +type Story = StoryObj; + +export const ErrorState: Story = { + args: { + email: 'user@example.com', + }, +}; + +export const IntegratedExample: StoryObj = { + render: () => ( + + + + } + /> + + + + ), + parameters: { + docs: { + description: { + story: + 'This demonstrates how the component should look when rendered in the app with proper Modal.Content wrapping.', + }, + }, + }, + decorators: [SnackBarDecorator], +}; diff --git a/packages/twenty-front/src/modules/auth/sign-in-up/components/__stories__/EmailVerificationSent.stories.tsx b/packages/twenty-front/src/modules/auth/sign-in-up/components/__stories__/EmailVerificationSent.stories.tsx new file mode 100644 index 000000000..4c54dba5a --- /dev/null +++ b/packages/twenty-front/src/modules/auth/sign-in-up/components/__stories__/EmailVerificationSent.stories.tsx @@ -0,0 +1,48 @@ +import { Meta, StoryObj } from '@storybook/react'; + +import { Modal } from '@/ui/layout/modal/components/Modal'; +import { ComponentDecorator } from 'twenty-ui/testing'; +import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator'; +import { EmailVerificationSent } from '../EmailVerificationSent'; + +// Wrap the component in Modal.Content to reflect how it's used in the app +const RenderWithModal = ( + args: React.ComponentProps, +) => { + return ( + + + + + + ); +}; + +const meta: Meta = { + title: 'Pages/Auth/EmailVerificationSent', + component: EmailVerificationSent, + decorators: [ComponentDecorator, SnackBarDecorator], + parameters: { + codeSection: { + docs: 'This component should always be wrapped with Modal.Content in the app.\n\nCorrect usage:\n```tsx\n\n \n\n```\n', + }, + }, + render: RenderWithModal, +}; + +export default meta; +type Story = StoryObj; + +export const Default: Story = { + args: { + email: 'user@example.com', + isError: false, + }, +}; + +export const Error: Story = { + args: { + email: 'user@example.com', + isError: true, + }, +}; diff --git a/packages/twenty-front/src/pages/auth/SignInUp.tsx b/packages/twenty-front/src/pages/auth/SignInUp.tsx index 70cfcd3df..e1889fea8 100644 --- a/packages/twenty-front/src/pages/auth/SignInUp.tsx +++ b/packages/twenty-front/src/pages/auth/SignInUp.tsx @@ -120,7 +120,11 @@ export const SignInUp = () => { ]); if (signInUpStep === SignInUpStep.EmailVerification) { - return ; + return ( + + + + ); } return (