The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Add placeholder to signinup modal's secondary logo (#12079)
nitin8334fe952827
diff --git a/packages/twenty-front/src/modules/auth/components/Logo.tsx b/packages/twenty-front/src/modules/auth/components/Logo.tsxindex d938daf0918..bb4ea47bade 100644--- a/packages/twenty-front/src/modules/auth/components/Logo.tsx+++ b/packages/twenty-front/src/modules/auth/components/Logo.tsx@@ -1,6 +1,7 @@import styled from '@emotion/styled';import { isNonEmptyString } from '@sniptt/guards';-import { getImageAbsoluteURI } from 'twenty-shared/utils';+import { getImageAbsoluteURI, isDefined } from 'twenty-shared/utils';+import { Avatar } from 'twenty-ui/display';import { UndecoratedLink } from 'twenty-ui/navigation';import { REACT_APP_SERVER_BASE_URL } from '~/config';import { useRedirectToDefaultDomain } from '~/modules/domain-manager/hooks/useRedirectToDefaultDomain';@@ -9,6 +10,7 @@ import { AppPath } from '~/modules/types/AppPath';type LogoProps = {primaryLogo?: string | null;secondaryLogo?: string | null;+ placeholder?: string | null;};const StyledContainer = styled.div`@@ -47,23 +49,27 @@ const StyledPrimaryLogo = styled.div<{ src: string }>`width: 100%;`;-export const Logo = (props: LogoProps) => {+export const Logo = ({+ primaryLogo,+ secondaryLogo,+ placeholder,+}: LogoProps) => {const { redirectToDefaultDomain } = useRedirectToDefaultDomain();const defaultPrimaryLogoUrl = `${window.location.origin}/images/icons/android/android-launchericon-192-192.png`;const primaryLogoUrl = getImageAbsoluteURI({- imageUrl: props.primaryLogo ?? defaultPrimaryLogoUrl,+ imageUrl: primaryLogo ?? defaultPrimaryLogoUrl,baseUrl: REACT_APP_SERVER_BASE_URL,});- const secondaryLogoUrl = isNonEmptyString(props.secondaryLogo)+ const secondaryLogoUrl = isNonEmptyString(secondaryLogo)? getImageAbsoluteURI({- imageUrl: props.secondaryLogo,+ imageUrl: secondaryLogo,baseUrl: REACT_APP_SERVER_BASE_URL,}): null;- const isUsingDefaultLogo = !props.primaryLogo;+ const isUsingDefaultLogo = !isDefined(primaryLogo);return (<StyledContainer>@@ -72,15 +78,26 @@ export const Logo = (props: LogoProps) => {to={AppPath.SignInUp}onClick={redirectToDefaultDomain}>- <StyledPrimaryLogo src={primaryLogoUrl ?? ''} />+ <StyledPrimaryLogo src={primaryLogoUrl} /></UndecoratedLink>) : (- <StyledPrimaryLogo src={primaryLogoUrl ?? ''} />+ <StyledPrimaryLogo src={primaryLogoUrl} />)}- {secondaryLogoUrl && (+ {isDefined(secondaryLogoUrl) ? (<StyledSecondaryLogoContainer><StyledSecondaryLogo src={secondaryLogoUrl} /></StyledSecondaryLogoContainer>+ ) : (+ isDefined(placeholder) && (+ <StyledSecondaryLogoContainer>+ <Avatar+ size="lg"+ placeholder={placeholder}+ type="squared"+ placeholderColorSeed={placeholder}+ />+ </StyledSecondaryLogoContainer>+ ))}</StyledContainer>);diff --git a/packages/twenty-front/src/modules/auth/components/__stories__/Logo.stories.tsx b/packages/twenty-front/src/modules/auth/components/__stories__/Logo.stories.tsxnew file mode 100644index 00000000000..e09ca696875--- /dev/null+++ b/packages/twenty-front/src/modules/auth/components/__stories__/Logo.stories.tsx@@ -0,0 +1,51 @@+import { Meta, StoryObj } from '@storybook/react';++import {+ ComponentDecorator,+ RecoilRootDecorator,+ RouterDecorator,+} from 'twenty-ui/testing';+import { Logo } from '../Logo';++const logoUrl = 'https://picsum.photos/192/192';++const meta: Meta<typeof Logo> = {+ title: 'Modules/Auth/Logo',+ component: Logo,+ decorators: [ComponentDecorator, RecoilRootDecorator, RouterDecorator],+};++export default meta;+type Story = StoryObj<typeof Logo>;++export const WithSecondaryLogo: Story = {+ args: {+ primaryLogo: null,+ secondaryLogo: logoUrl,+ placeholder: 'A',+ },+};++export const WithPlaceholder: Story = {+ args: {+ primaryLogo: null,+ secondaryLogo: null,+ placeholder: 'B',+ },+};++export const WithPrimaryAndSecondaryLogo: Story = {+ args: {+ primaryLogo: logoUrl,+ secondaryLogo: logoUrl,+ placeholder: 'C',+ },+};++export const WithPrimaryLogoAndPlaceholder: Story = {+ args: {+ primaryLogo: logoUrl,+ secondaryLogo: null,+ placeholder: 'D',+ },+};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.tsxindex 4d2aac62d4f..837523ddc47 100644--- a/packages/twenty-front/src/modules/auth/components/__stories__/VerifyEmailEffect.stories.tsx+++ b/packages/twenty-front/src/modules/auth/components/__stories__/VerifyEmailEffect.stories.tsx@@ -18,7 +18,7 @@ const VerifyEmailEffectErrorState = ({ email = '[email protected]' }) => {};const meta: Meta<typeof VerifyEmailEffectErrorState> = {- title: 'Pages/Auth/VerifyEmailEffect',+ title: 'Modules/Auth/VerifyEmailEffect',component: VerifyEmailEffectErrorState,decorators: [(Story) => (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.tsxindex 4c54dba5a53..af9df4878a0 100644--- 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@@ -19,7 +19,7 @@ const RenderWithModal = (};const meta: Meta<typeof EmailVerificationSent> = {- title: 'Pages/Auth/EmailVerificationSent',+ title: 'Modules/Auth/EmailVerificationSent',component: EmailVerificationSent,decorators: [ComponentDecorator, SnackBarDecorator],parameters: {diff --git a/packages/twenty-front/src/pages/auth/PasswordReset.tsx b/packages/twenty-front/src/pages/auth/PasswordReset.tsxindex bc83bf914c6..b5dea0d4836 100644--- a/packages/twenty-front/src/pages/auth/PasswordReset.tsx+++ b/packages/twenty-front/src/pages/auth/PasswordReset.tsx@@ -173,7 +173,10 @@ export const PasswordReset = () => {<Modal.Content isVerticalCentered isHorizontalCentered><StyledMainContainer><AnimatedEaseIn>- <Logo secondaryLogo={workspacePublicData?.logo} />+ <Logo+ secondaryLogo={workspacePublicData?.logo}+ placeholder={workspacePublicData?.displayName}+ /></AnimatedEaseIn><Title animate><Trans>Reset Password</Trans>diff --git a/packages/twenty-front/src/pages/auth/SignInUp.tsx b/packages/twenty-front/src/pages/auth/SignInUp.tsxindex e1889fea8b5..afaeed16d50 100644--- a/packages/twenty-front/src/pages/auth/SignInUp.tsx+++ b/packages/twenty-front/src/pages/auth/SignInUp.tsx@@ -41,7 +41,10 @@ const StandardContent = ({return (<Modal.Content isVerticalCentered isHorizontalCentered><AnimatedEaseIn>- <Logo secondaryLogo={workspacePublicData?.logo} />+ <Logo+ secondaryLogo={workspacePublicData?.logo}+ placeholder={workspacePublicData?.displayName}+ /></AnimatedEaseIn><Title animate>{title}</Title>{signInUpForm}