From 73a9da6a4e308c5d0226f6a267db626bf27d2d1d Mon Sep 17 00:00:00 2001 From: gofnnp Date: Fri, 29 Sep 2023 23:27:57 +0400 Subject: [PATCH] feat: background blur compatibility, subscription page text from translation v2 --- src/components/Compatibility/index.tsx | 41 +++++++++++++++++-- .../Compatibility/styles.module.css | 18 ++++++++ src/components/SubscriptionPage/index.tsx | 14 +++---- 3 files changed, 62 insertions(+), 11 deletions(-) diff --git a/src/components/Compatibility/index.tsx b/src/components/Compatibility/index.tsx index 1129db0..c129916 100644 --- a/src/components/Compatibility/index.tsx +++ b/src/components/Compatibility/index.tsx @@ -2,7 +2,7 @@ import { useTranslation } from "react-i18next"; import MainButton from "../MainButton"; import Title from "../Title"; import styles from "./styles.module.css"; -import { useCallback, useState } from "react"; +import { useCallback, useEffect, useState } from "react"; import NameInput from "./nameInput"; import DatePicker from "./DatePicker"; import { IDate } from "@/services/date"; @@ -12,6 +12,12 @@ import routes from "@/routes"; import { useDispatch, useSelector } from "react-redux"; import { actions, selectors } from "@/store"; import { EPathsFromHome } from "@/store/siteConfig"; +import { + getCategoryIdByZodiacSign, + getZodiacSignByDate, +} from "@/services/zodiac-sign"; +import { Asset } from "@/api/resources/Assets"; +import { getRandomArbitrary } from "@/services/random-value"; function CompatibilityPage(): JSX.Element { const { t, i18n } = useTranslation(); @@ -25,6 +31,31 @@ function CompatibilityPage(): JSX.Element { const [compatCategory, setCompatCategory] = useState(1); const homeConfig = useSelector(selectors.selectHome); const showNavbarFooter = homeConfig.isShowNavbar; + const birthdate = useSelector(selectors.selectBirthdate); + const zodiacSign = getZodiacSignByDate(birthdate); + const [asset, setAsset] = useState(); + const api = useApi(); + const locale = i18n.language; + + const assetsData = useCallback(async () => { + const { asset_categories } = await api.getAssetCategories({ locale }); + const categoryId = getCategoryIdByZodiacSign(zodiacSign, asset_categories); + const { assets } = await api.getAssets({ + category: String(categoryId || "1"), + }); + return assets; + }, [api, locale, zodiacSign]); + + const { + data: assets, + // isPending + } = useApiCall(assetsData); + + useEffect(() => { + if (assets) { + setAsset(assets[getRandomArbitrary(0, assets?.length || 0)]); + } + }, [assets]); const handleNext = () => { if (isDisabled) return; @@ -66,8 +97,6 @@ function CompatibilityPage(): JSX.Element { return navigate(routes.client.home()); }; - const api = useApi(); - const locale = i18n.language; const loadData = useCallback(() => { return api .getAiCompatCategories({ locale }) @@ -98,8 +127,12 @@ function CompatibilityPage(): JSX.Element { return (
+
{!showNavbarFooter && (
)} diff --git a/src/components/Compatibility/styles.module.css b/src/components/Compatibility/styles.module.css index f1476e5..904791e 100644 --- a/src/components/Compatibility/styles.module.css +++ b/src/components/Compatibility/styles.module.css @@ -4,8 +4,12 @@ flex: auto; background-color: #121212; align-items: flex-start; + background-position: center; + /* background-size: cover; */ + background-repeat: no-repeat; } + .cross { position: absolute; top: 24px; @@ -42,6 +46,20 @@ .content { width: 100%; + position: relative; + z-index: 2; +} + +.blurring { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + background-color: #00000045; + -webkit-backdrop-filter: blur(100px); + backdrop-filter: blur(100px); + z-index: 1; } .title { diff --git a/src/components/SubscriptionPage/index.tsx b/src/components/SubscriptionPage/index.tsx index 5c0bb83..1addcd2 100644 --- a/src/components/SubscriptionPage/index.tsx +++ b/src/components/SubscriptionPage/index.tsx @@ -17,17 +17,17 @@ import { useState } from "react"; const currency = Currency.USD; const locale = Locale.EN; const itemPriceId = "aura-membership-2-week-USD"; -const paymentItems = [ - { - title: "Per 7-Day Trial For", - price: 1.0, - description: "2-Week Plan", - }, -]; function SubscriptionPage(): JSX.Element { const [isOpenModal, setIsOpenModal] = useState(false); const { t } = useTranslation(); + const paymentItems = [ + { + title: "Per 7-Day Trial For", + price: 1.0, + description: t("au.2week_plan.web"), + }, + ]; const navigate = useNavigate(); const email = useSelector(selectors.selectEmail); const itemPrice = useSelector(selectors.selectPlanById(itemPriceId));