feat(auth): enhance logo behavior and simplify billing logic (#11574)
Added default domain redirection functionality to the Logo component, leveraging UndecoratedLink for navigation when default logos are used. Removed metered product billing feature flag logic in the billing webhook subscription service to simplify and streamline the codebase. Fix https://github.com/twentyhq/core-team-issues/issues/783
This commit is contained in:
@ -1,6 +1,9 @@
|
|||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
import { isNonEmptyString } from '@sniptt/guards';
|
import { isNonEmptyString } from '@sniptt/guards';
|
||||||
import { REACT_APP_SERVER_BASE_URL } from '~/config';
|
import { REACT_APP_SERVER_BASE_URL } from '~/config';
|
||||||
|
import { useRedirectToDefaultDomain } from '~/modules/domain-manager/hooks/useRedirectToDefaultDomain';
|
||||||
|
import { AppPath } from '~/modules/types/AppPath';
|
||||||
|
import { UndecoratedLink } from 'twenty-ui/navigation';
|
||||||
import { getImageAbsoluteURI } from 'twenty-shared/utils';
|
import { getImageAbsoluteURI } from 'twenty-shared/utils';
|
||||||
|
|
||||||
type LogoProps = {
|
type LogoProps = {
|
||||||
@ -45,6 +48,7 @@ const StyledPrimaryLogo = styled.div<{ src: string }>`
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
export const Logo = (props: LogoProps) => {
|
export const Logo = (props: LogoProps) => {
|
||||||
|
const { redirectToDefaultDomain } = useRedirectToDefaultDomain();
|
||||||
const defaultPrimaryLogoUrl = `${window.location.origin}/icons/android/android-launchericon-192-192.png`;
|
const defaultPrimaryLogoUrl = `${window.location.origin}/icons/android/android-launchericon-192-192.png`;
|
||||||
|
|
||||||
const primaryLogoUrl = getImageAbsoluteURI({
|
const primaryLogoUrl = getImageAbsoluteURI({
|
||||||
@ -59,9 +63,20 @@ export const Logo = (props: LogoProps) => {
|
|||||||
})
|
})
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
|
const isUsingDefaultLogo = !props.primaryLogo;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<StyledContainer>
|
<StyledContainer>
|
||||||
<StyledPrimaryLogo src={primaryLogoUrl ?? ''} />
|
{isUsingDefaultLogo ? (
|
||||||
|
<UndecoratedLink
|
||||||
|
to={AppPath.SignInUp}
|
||||||
|
onClick={redirectToDefaultDomain}
|
||||||
|
>
|
||||||
|
<StyledPrimaryLogo src={primaryLogoUrl ?? ''} />
|
||||||
|
</UndecoratedLink>
|
||||||
|
) : (
|
||||||
|
<StyledPrimaryLogo src={primaryLogoUrl ?? ''} />
|
||||||
|
)}
|
||||||
{secondaryLogoUrl && (
|
{secondaryLogoUrl && (
|
||||||
<StyledSecondaryLogoContainer>
|
<StyledSecondaryLogoContainer>
|
||||||
<StyledSecondaryLogo src={secondaryLogoUrl} />
|
<StyledSecondaryLogo src={secondaryLogoUrl} />
|
||||||
|
|||||||
Reference in New Issue
Block a user