From dbc6ecdcc85dd6419e4319f3632a5093c8dbb785 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=B5=D0=BD=D0=B8=D1=81=20=D0=9A=D0=B0=D1=82=D0=B0?= =?UTF-8?q?=D0=B5=D0=B2?= Date: Wed, 6 Dec 2023 02:12:25 +0000 Subject: [PATCH] Clone --- src/components/CompatResultPage/index.tsx | 6 +++-- src/components/HomePage/index.tsx | 4 ++- src/components/PriceItem/index.tsx | 31 +++++++++++------------ src/components/SubscriptionPage/index.tsx | 7 +++++ src/store/user.ts | 2 +- 5 files changed, 30 insertions(+), 20 deletions(-) diff --git a/src/components/CompatResultPage/index.tsx b/src/components/CompatResultPage/index.tsx index bc07024..abe7088 100644 --- a/src/components/CompatResultPage/index.tsx +++ b/src/components/CompatResultPage/index.tsx @@ -12,7 +12,7 @@ import FullScreenModal from "../FullScreenModal"; import CompatibilityLoading from "../CompatibilityLoading"; function CompatResultPage(): JSX.Element { - const token = useSelector(selectors.selectToken) + const token = useSelector(selectors.selectToken); const { t } = useTranslation(); const navigate = useNavigate(); const api = useApi(); @@ -60,8 +60,10 @@ function CompatResultPage(): JSX.Element { const aICompat = await api.getAiCompat(data); if (aICompat.compat.body_pending) { const loadAIRequest = async () => { + const id = aICompat.compat.body_check_path.split("/")[5].split(".")[0]; + const url = `/api/v2/ai/requests/${id}.json`; const aIRequest = await api.getAiRequest({ - body_check_path: aICompat.compat.body_check_path, + body_check_path: url, token, }); if (aIRequest.ai_request.state !== "ready") { diff --git a/src/components/HomePage/index.tsx b/src/components/HomePage/index.tsx index 44a4339..7f3ebd6 100644 --- a/src/components/HomePage/index.tsx +++ b/src/components/HomePage/index.tsx @@ -64,6 +64,8 @@ function HomePage(): JSX.Element { const compatibilities = useSelector(selectors.selectCompatibilities); + const user = useSelector(selectors.selectUser); + const [isShowOnboardingHome, setIsShowOnboardingHome] = useState( !onboardingConfigHome?.isShown ); @@ -336,7 +338,7 @@ function HomePage(): JSX.Element { {predictionMoonsPeriods.map((item, index) => ( { handleNameHoroscope(item); diff --git a/src/components/PriceItem/index.tsx b/src/components/PriceItem/index.tsx index 0b48af5..7eec7c5 100644 --- a/src/components/PriceItem/index.tsx +++ b/src/components/PriceItem/index.tsx @@ -5,35 +5,34 @@ import styles from "./styles.module.css"; const currency = Currency.USD; const locale = Locale.EN; - - interface PriceItemProps { - id: string, - value: number, + id: string; + value: number; active: boolean; click: (id: string) => void; } -function PriceItem({ - id, - value, - active, - click, -}: PriceItemProps): JSX.Element { - const _price = new Price(roundToWhole(value), currency, locale); - +function PriceItem({ id, value, active, click }: PriceItemProps): JSX.Element { + const _price = new Price( + roundToWhole(value === 1 ? 0.99 : value), + currency, + locale + ); + const compatClassName = () => { - const isPopular = id === 'stripe.7'; + const isPopular = id === "stripe.7"; const isActive = active; - return `${styles.container} ${isPopular ? styles.popular : ""} ${isActive ? styles.active : ""}`; + return `${styles.container} ${isPopular ? styles.popular : ""} ${ + isActive ? styles.active : "" + }`; }; const itemClick = () => { click(id); - } + }; return ( -
+
{removeAfterDot(_price.format())}
); diff --git a/src/components/SubscriptionPage/index.tsx b/src/components/SubscriptionPage/index.tsx index a4725d2..58861be 100644 --- a/src/components/SubscriptionPage/index.tsx +++ b/src/components/SubscriptionPage/index.tsx @@ -100,6 +100,13 @@ function SubscriptionPage(): JSX.Element { if (updatedUser?.user) { dispatch(actions.user.update(updatedUser.user)); } + if (name) { + dispatch( + actions.user.update({ + username: name, + }) + ); + } dispatch(actions.status.update("registred")); dispatch( actions.payment.update({ diff --git a/src/store/user.ts b/src/store/user.ts index f1c332d..983e32b 100644 --- a/src/store/user.ts +++ b/src/store/user.ts @@ -5,7 +5,7 @@ import { getClientLocale, getClientTimezone } from '../locales' const initialState: User.User = { id: undefined, - username: null, + username: "I Am", email: '', locale: getClientLocale(), state: '',