Redirect to home if subscribed
This commit is contained in:
parent
c72e1e9e39
commit
544f26f019
@ -20,6 +20,7 @@ function Navbar({ isOpen, closeMenu }: NavbarProps): JSX.Element {
|
|||||||
const combinedClassNames = ['navbar', isOpen && 'navbar--open'].filter(Boolean).join(' ')
|
const combinedClassNames = ['navbar', isOpen && 'navbar--open'].filter(Boolean).join(' ')
|
||||||
|
|
||||||
const handleLogout = () => {
|
const handleLogout = () => {
|
||||||
|
localStorage.removeItem('palmistry.firstUnpassedStep');
|
||||||
navigate(routes.client.birthday())
|
navigate(routes.client.birthday())
|
||||||
logout()
|
logout()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -223,9 +223,11 @@ export default function PaymentScreen() {
|
|||||||
|
|
||||||
<style>{`.palmistry-payment-modal { max-height: calc(100dvh - 40px) }`}</style>
|
<style>{`.palmistry-payment-modal { max-height: calc(100dvh - 40px) }`}</style>
|
||||||
|
|
||||||
<div className="payment-screen__widget">
|
{activeSubPlanFromStore && (
|
||||||
<PaymentModal />
|
<div className="payment-screen__widget">
|
||||||
</div>
|
<PaymentModal />
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,7 +18,6 @@ export default function StepPaywall() {
|
|||||||
}, [storedEmail]);
|
}, [storedEmail]);
|
||||||
|
|
||||||
const onNext = () => {
|
const onNext = () => {
|
||||||
steps.saveToStorage('firstUnpassedStep', Step.Payment);
|
|
||||||
navigate('/palmistry/payment');
|
navigate('/palmistry/payment');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,13 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { AnimatePresence, motion } from 'framer-motion';
|
import { AnimatePresence, motion } from 'framer-motion';
|
||||||
import { useLocation } from 'react-router-dom';
|
import { useLocation } from 'react-router-dom';
|
||||||
|
import { useSelector } from "react-redux";
|
||||||
|
import { useNavigate } from 'react-router-dom';
|
||||||
|
|
||||||
import './steps-manager.css';
|
import './steps-manager.css';
|
||||||
|
|
||||||
|
import routes from '@/routes';
|
||||||
|
import { selectors } from "@/store";
|
||||||
import Progressbar from '@/components/palmistry/progress-bar/progress-bar';
|
import Progressbar from '@/components/palmistry/progress-bar/progress-bar';
|
||||||
import PalmistryContainer from '@/components/palmistry/palmistry-container/palmistry-container';
|
import PalmistryContainer from '@/components/palmistry/palmistry-container/palmistry-container';
|
||||||
import useSteps, { Step } from '@/hooks/palmistry/use-steps';
|
import useSteps, { Step } from '@/hooks/palmistry/use-steps';
|
||||||
@ -46,6 +50,8 @@ const animationDuration = 0.2;
|
|||||||
export default function StepsManager() {
|
export default function StepsManager() {
|
||||||
const steps = useSteps();
|
const steps = useSteps();
|
||||||
const { pathname } = useLocation();
|
const { pathname } = useLocation();
|
||||||
|
const subscriptionStatus = useSelector(selectors.selectStatus);
|
||||||
|
const navigate = useNavigate();
|
||||||
|
|
||||||
const [modalIsOpen, setModalIsOpen] = React.useState(false);
|
const [modalIsOpen, setModalIsOpen] = React.useState(false);
|
||||||
|
|
||||||
@ -55,6 +61,12 @@ export default function StepsManager() {
|
|||||||
steps.goFirstUnpassedStep();
|
steps.goFirstUnpassedStep();
|
||||||
}, [steps.isInited]);
|
}, [steps.isInited]);
|
||||||
|
|
||||||
|
React.useEffect(() => {
|
||||||
|
if (subscriptionStatus === "subscribed") {
|
||||||
|
navigate(routes.client.home());
|
||||||
|
}
|
||||||
|
}, [subscriptionStatus]);
|
||||||
|
|
||||||
const motionDivClassName = [
|
const motionDivClassName = [
|
||||||
'steps-manager__motion-div',
|
'steps-manager__motion-div',
|
||||||
modalIsOpen ? 'steps-manager__motion-div_no-transform' : '',
|
modalIsOpen ? 'steps-manager__motion-div_no-transform' : '',
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user