Redirect to home if subscribed

This commit is contained in:
Evgenij Ponomarev 2024-03-12 02:28:51 +07:00
parent c72e1e9e39
commit 544f26f019
4 changed files with 18 additions and 4 deletions

View File

@ -20,6 +20,7 @@ function Navbar({ isOpen, closeMenu }: NavbarProps): JSX.Element {
const combinedClassNames = ['navbar', isOpen && 'navbar--open'].filter(Boolean).join(' ')
const handleLogout = () => {
localStorage.removeItem('palmistry.firstUnpassedStep');
navigate(routes.client.birthday())
logout()
}

View File

@ -223,9 +223,11 @@ export default function PaymentScreen() {
<style>{`.palmistry-payment-modal { max-height: calc(100dvh - 40px) }`}</style>
<div className="payment-screen__widget">
<PaymentModal />
</div>
{activeSubPlanFromStore && (
<div className="payment-screen__widget">
<PaymentModal />
</div>
)}
</div>
);
}

View File

@ -18,7 +18,6 @@ export default function StepPaywall() {
}, [storedEmail]);
const onNext = () => {
steps.saveToStorage('firstUnpassedStep', Step.Payment);
navigate('/palmistry/payment');
};

View File

@ -1,9 +1,13 @@
import React from 'react';
import { AnimatePresence, motion } from 'framer-motion';
import { useLocation } from 'react-router-dom';
import { useSelector } from "react-redux";
import { useNavigate } from 'react-router-dom';
import './steps-manager.css';
import routes from '@/routes';
import { selectors } from "@/store";
import Progressbar from '@/components/palmistry/progress-bar/progress-bar';
import PalmistryContainer from '@/components/palmistry/palmistry-container/palmistry-container';
import useSteps, { Step } from '@/hooks/palmistry/use-steps';
@ -46,6 +50,8 @@ const animationDuration = 0.2;
export default function StepsManager() {
const steps = useSteps();
const { pathname } = useLocation();
const subscriptionStatus = useSelector(selectors.selectStatus);
const navigate = useNavigate();
const [modalIsOpen, setModalIsOpen] = React.useState(false);
@ -54,6 +60,12 @@ export default function StepsManager() {
steps.goFirstUnpassedStep();
}, [steps.isInited]);
React.useEffect(() => {
if (subscriptionStatus === "subscribed") {
navigate(routes.client.home());
}
}, [subscriptionStatus]);
const motionDivClassName = [
'steps-manager__motion-div',