Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
martmull committed Jun 28, 2024
1 parent fc4e75f commit 7eb4159
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import React from 'react';
import { useNavigate } from 'react-router-dom';
import { css, useTheme } from '@emotion/react';
import styled from '@emotion/styled';
import { IconInfoCircle } from 'twenty-ui';

import { AppPath } from '@/types/AppPath';
import { Button } from '@/ui/input/button/components/Button';

export type InfoAccent = 'blue' | 'danger';
Expand All @@ -11,6 +13,7 @@ export type InfoProps = {
text: string;
buttonTitle?: string;
onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
navigateTo?: AppPath;
};

const StyledTextContainer = styled.div`
Expand Down Expand Up @@ -51,18 +54,20 @@ export const Info = ({
text,
buttonTitle,
onClick,
navigateTo,
}: InfoProps) => {
const theme = useTheme();
const navigate = useNavigate();
return (
<StyledInfo accent={accent}>
<StyledTextContainer>
<StyledIconInfoCircle size={theme.icon.size.md} />
{text}
</StyledTextContainer>
{buttonTitle && onClick && (
{buttonTitle && (onClick || navigateTo) && (
<Button
title={buttonTitle}
onClick={onClick}
onClick={navigateTo ? () => navigate(navigateTo) : onClick}
size={'small'}
variant={'secondary'}
accent={accent}
Expand Down
9 changes: 9 additions & 0 deletions packages/twenty-front/src/pages/onboarding/PaymentSuccess.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
import React from 'react';
import { useTheme } from '@emotion/react';
import styled from '@emotion/styled';
import { useRecoilValue } from 'recoil';
import { IconCheck, RGBA } from 'twenty-ui';

import { SubTitle } from '@/auth/components/SubTitle';
import { Title } from '@/auth/components/Title';
import { currentUserState } from '@/auth/states/currentUserState';
import { AppPath } from '@/types/AppPath';
import { MainButton } from '@/ui/input/button/components/MainButton';
import { UndecoratedLink } from '@/ui/navigation/link/components/UndecoratedLink';
import { AnimatedEaseIn } from '@/ui/utilities/animation/components/AnimatedEaseIn';
import { OnboardingStatus } from '~/generated/graphql';

const StyledCheckContainer = styled.div`
align-items: center;
Expand All @@ -29,8 +32,14 @@ const StyledButtonContainer = styled.div`

export const PaymentSuccess = () => {
const theme = useTheme();
const currentUser = useRecoilValue(currentUserState);
const color =
theme.name === 'light' ? theme.grayScale.gray90 : theme.grayScale.gray10;

if (currentUser?.onboardingStatus === OnboardingStatus.Completed) {
return <></>;
}

return (
<>
<AnimatedEaseIn>
Expand Down
8 changes: 2 additions & 6 deletions packages/twenty-front/src/pages/settings/SettingsBilling.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,6 @@ export const SettingsBilling = () => {
}
};

const openPlanRequired = () => {
window.location.replace(AppPath.PlanRequired);
};

const openSwitchingIntervalModal = () => {
setIsSwitchingIntervalModalOpen(true);
};
Expand Down Expand Up @@ -168,15 +164,15 @@ export const SettingsBilling = () => {
text={'Subscription canceled. Please start a new one'}
buttonTitle={'Subscribe'}
accent={'danger'}
onClick={openPlanRequired}
navigateTo={AppPath.PlanRequired}
/>
)}
{displaySubscribeInfo ? (
<Info
text={'Your workspace does not have an active subscription'}
buttonTitle={'Subscribe'}
accent={'danger'}
onClick={openPlanRequired}
navigateTo={AppPath.PlanRequired}
/>
) : (
<>
Expand Down

0 comments on commit 7eb4159

Please sign in to comment.