feat: some edits

This commit is contained in:
Денис Катаев 2024-01-31 18:49:27 +00:00 committed by Victor Ershov
parent 109c616d71
commit 2d6144f0fb
8 changed files with 72 additions and 17 deletions

View File

@ -240,10 +240,7 @@ function App(): JSX.Element {
path={routes.client.emailConfirm()}
element={<EmailConfirmPage />}
/>
<Route
path={routes.client.onboarding()}
element={<OnboardingPage />}
/>
<Route path={routes.client.onboarding()} element={<OnboardingPage />} />
<Route
path={routes.client.trialChoice()}
element={<TrialChoicePage />}
@ -251,7 +248,9 @@ function App(): JSX.Element {
<Route
path={routes.client.trialPayment()}
element={<TrialPaymentPage />}
/>
>
<Route path=":subPlan" element={<TrialPaymentPage />} />
</Route>
{/* Test Routes End */}
<Route

1
src/components/PlacePicker/styles.module.css Normal file → Executable file
View File

@ -10,4 +10,5 @@
border-radius: 25px;
padding: 10px 15px;
line-height: 24px;
font-size: 16px;
}

View File

@ -79,7 +79,7 @@ function TrialChoicePage() {
classNameItemActive={styles["price-item-active"]}
click={handlePriceItem}
/>
<p className={styles["auxiliary-text"]} style={{ maxWidth: "272px" }}>
<p className={styles["auxiliary-text"]} style={{ maxWidth: "75%" }}>
This option will help us support those who need to select the lowest
trial prices!
</p>

View File

@ -41,10 +41,10 @@ function PaymentTable({ subPlan, buttonClick }: IPaymentTableProps) {
<GuardPayments />
<p className={styles.policy}>
You are enrolling in 2 weeks subscription. By continuing you agree that
if you don't cancel prior to the end of the 7-day trial for the $5 you
will automatically be charged $29 every 2 weeks until you cancel in
settings. Learn more about cancellation and refund policy in{" "}
<a href="#">Subscription policy</a>
if you don't cancel prior to the end of the 3-day trial for the $
{getPriceFromTrial(subPlan?.trial)} you will automatically be charged
$19 every 2 weeks until you cancel in settings. Learn more about
cancellation and refund policy in <a href="#">Subscription policy</a>
</p>
</>
);

View File

@ -18,7 +18,7 @@ function PersonalInformation({
<div className={styles["personal-information"]}>
<div className={styles["image-container"]}>
<img
src={`/questionnaire/zodiacs/${gender}/${zodiacSign.toLowerCase()}.webp`}
src={`/questionnaire/zodiacs/${gender}/${zodiacSign?.toLowerCase()}.webp`}
alt={`${gender} ${zodiacSign}`}
/>
</div>

View File

@ -16,7 +16,7 @@ function YourReading({ gender, zodiacSign, buttonClick }: IYourReadingProps) {
</Title>
<div className={styles["image-container"]}>
<img
src={`/questionnaire/zodiacs/${gender}/${zodiacSign.toLowerCase()}.webp`}
src={`/questionnaire/zodiacs/${gender}/${zodiacSign?.toLowerCase()}.webp`}
alt={`${gender} ${zodiacSign}`}
/>
</div>

View File

@ -111,6 +111,7 @@
rgba(251, 251, 255, 0.14) 75%,
rgba(251, 251, 255, 0.196) 89.58%
);
-webkit-backdrop-filter: blur(1.5px);
backdrop-filter: blur(1.5px);
border-radius: 20px;
height: 100%;

View File

@ -6,25 +6,79 @@ import Goal from "./components/Goal";
import PaymentTable from "./components/PaymentTable";
import { useSelector } from "react-redux";
import { selectors } from "@/store";
import { Navigate, useNavigate } from "react-router-dom";
import { Navigate, useNavigate, useParams } from "react-router-dom";
import routes from "@/routes";
import { getZodiacSignByDate } from "@/services/zodiac-sign";
import YourReading from "./components/YourReading";
import Reviews from "./components/Reviews";
import YouGet from "./components/YouGet";
import OftenAsk from "./components/OftenAsk";
import { ISubscriptionPlan } from "@/api/resources/SubscriptionPlans";
import { useEffect, useState } from "react";
import { useApi } from "@/api";
import { getClientLocale } from "@/locales";
import { Locale } from "@/components/PaymentTable";
const locale = getClientLocale() as Locale;
function TrialPaymentPage() {
const api = useApi();
const navigate = useNavigate();
const subPlan = useSelector(selectors.selectActiveSubPlan);
const birthdate = useSelector(selectors.selectBirthdate);
const zodiacSign = getZodiacSignByDate(birthdate);
const { gender, birthPlace } = useSelector(selectors.selectQuestionnaire);
const [subPlans, setSubPlans] = useState<ISubscriptionPlan[]>([]);
const activeSubPlanFromStore = useSelector(selectors.selectActiveSubPlan);
const [activeSubPlan, setActiveSubPlan] = useState<ISubscriptionPlan | null>(
activeSubPlanFromStore
);
const { subPlan } = useParams();
if (!subPlan) {
useEffect(() => {
(async () => {
const { sub_plans } = await api.getSubscriptionPlans({ locale });
const plans = sub_plans
.filter((plan: ISubscriptionPlan) => plan.provider === "stripe")
.sort((a, b) => {
if (!a.trial || !b.trial) {
return 0;
}
if (a?.trial?.price_cents < b?.trial?.price_cents) {
return -1;
}
if (a?.trial?.price_cents > b?.trial?.price_cents) {
return 1;
}
return 0;
});
setSubPlans(plans);
})();
}, [api]);
useEffect(() => {
if (subPlan) {
const targetSubPlan = subPlans.find(
(sub_plan) =>
String(
sub_plan?.trial?.price_cents
? Math.floor((sub_plan?.trial?.price_cents + 1) / 100)
: sub_plan.id.replace(".", "")
) === subPlan
);
if (targetSubPlan) {
setActiveSubPlan(targetSubPlan);
}
}
}, [subPlan, subPlans]);
if (!activeSubPlan) {
return <Navigate to={routes.client.trialChoice()} />;
}
if (!birthdate || !gender || !birthPlace) {
return <Navigate to={routes.client.gender()} />;
}
const handleNext = () => {
navigate(routes.client.paymentStripe());
};
@ -42,7 +96,7 @@ function TrialPaymentPage() {
Your Personalized Clarity & Love Reading is ready!
</Title>
<Goal />
<PaymentTable subPlan={subPlan} buttonClick={handleNext} />
<PaymentTable subPlan={activeSubPlan} buttonClick={handleNext} />
<YourReading
gender={gender}
zodiacSign={zodiacSign}
@ -51,7 +105,7 @@ function TrialPaymentPage() {
<Reviews />
<YouGet />
<OftenAsk />
<PaymentTable subPlan={subPlan} buttonClick={handleNext} />
<PaymentTable subPlan={activeSubPlan} buttonClick={handleNext} />
</section>
);
}