fix: fix blurring, text hidden, ransom image of zodiac sign, active price item

This commit is contained in:
gofnnp 2023-09-08 06:08:18 +04:00
parent 79362a5981
commit 4ef1093119
4 changed files with 49 additions and 35 deletions

View File

@ -1,6 +1,8 @@
.blurring-substrate { .blurring-substrate {
-webkit-backdrop-filter: blur(14px);
backdrop-filter: blur(14px); backdrop-filter: blur(14px);
width: fit-content; width: fit-content;
height: fit-content;
padding: 8px; padding: 8px;
box-shadow: inset 0px 0px 25px rgba(0,0,0,0.5); box-shadow: inset 0px 0px 25px rgba(0,0,0,0.5);
border-radius: 18px; border-radius: 18px;

View File

@ -5,6 +5,7 @@
max-height: -webkit-fill-available; max-height: -webkit-fill-available;
background-color: #000; background-color: #000;
color: #fff; color: #fff;
overflow-y: scroll;
} }
.title-container { .title-container {

View File

@ -8,6 +8,10 @@ import { useCallback, useEffect, useState } from "react";
import BlurringSubstrate from "../BlurringSubstrate"; import BlurringSubstrate from "../BlurringSubstrate";
import EnergyValues from "../EnergyValues"; import EnergyValues from "../EnergyValues";
import { UserAura } from "@/api/resources/Auras"; import { UserAura } from "@/api/resources/Auras";
import { useSelector } from "react-redux";
import { getCategoryIdByZodiacSign, getZodiacSignByDate } from "@/services/zodiac-sign";
import { selectors } from "@/store";
import { getRandomArbitrary } from "@/services/random-value";
const buttonTextFormatter = (text: string): JSX.Element => { const buttonTextFormatter = (text: string): JSX.Element => {
const sentences = text.split("."); const sentences = text.split(".");
@ -32,17 +36,17 @@ function HomePage(): JSX.Element {
navigate(routes.client.breath()); navigate(routes.client.breath());
}; };
// const { i18n } = useTranslation(); const { i18n } = useTranslation();
// const locale = i18n.language; const locale = i18n.language;
// const birthdate = useSelector(selectors.selectBirthdate); const birthdate = useSelector(selectors.selectBirthdate);
// const zodiacSign = getZodiacSignByDate(birthdate); const zodiacSign = getZodiacSignByDate(birthdate);
const [asset, setAsset] = useState<Asset>(); const [asset, setAsset] = useState<Asset>();
const api = useApi(); const api = useApi();
const assetsData = useCallback(async () => { const assetsData = useCallback(async () => {
// const { asset_categories } = await api.getAssetCategories({ locale }); const { asset_categories } = await api.getAssetCategories({ locale });
// const categoryId = getCategoryIdByZodiacSign(zodiacSign, asset_categories); const categoryId = getCategoryIdByZodiacSign(zodiacSign, asset_categories);
const { assets } = await api.getAssets({ category: String("10" || "1") }); const { assets } = await api.getAssets({ category: String(categoryId || "1") });
return assets; return assets;
}, [api]); }, [api]);
@ -53,7 +57,7 @@ function HomePage(): JSX.Element {
useEffect(() => { useEffect(() => {
if (assets) { if (assets) {
setAsset(assets[13]); setAsset(assets[getRandomArbitrary(0, assets?.length || 0)]);
} }
}, [assets]); }, [assets]);

View File

@ -1,45 +1,52 @@
import { Currency, Locale, Price } from '../PaymentTable' import { Currency, Locale, Price } from "../PaymentTable";
import { IPrice } from '../PriceList' import { IPrice } from "../PriceList";
import styles from './styles.module.css' import styles from "./styles.module.css";
const currency = Currency.USD const currency = Currency.USD;
const locale = Locale.EN const locale = Locale.EN;
const roundToWhole = (value: string | number): number => { const roundToWhole = (value: string | number): number => {
value = Number(value) value = Number(value);
if (value % Math.floor(value) !== 0) { if (value % Math.floor(value) !== 0) {
return value return value;
} }
return Math.floor(value) return Math.floor(value);
} };
const removeAfterDot = (value: string): string => { const removeAfterDot = (value: string): string => {
const _value = Number(value.split('$')[1]) const _value = Number(value.split("$")[1]);
if (_value % Math.floor(_value) !== 0 && _value !== 0) { if (_value % Math.floor(_value) !== 0 && _value !== 0) {
return value return value;
} }
return value.split('.')[0] return value.split(".")[0];
} };
interface PriceItemProps { interface PriceItemProps {
active: boolean active: boolean;
click: () => void click: () => void;
} }
function PriceItem({ id, value, active, click }: IPrice & PriceItemProps): JSX.Element { function PriceItem({
const _price = new Price(roundToWhole(value), currency, locale) id,
value,
active,
click,
}: IPrice & PriceItemProps): JSX.Element {
const _price = new Price(roundToWhole(value), currency, locale);
console.log(id, active);
const compatClassName = () => { const compatClassName = () => {
const isPopular = id === 3 const isPopular = id === 3;
const isActive = active // const isActive = active;
return `${styles.container} ${isPopular ? styles.popular : ''} ${isActive ? styles.active : ''}` return `${styles.container} ${isPopular ? styles.popular : ""}`;
} };
return ( return (
<div onClick={click} className={compatClassName()}> <div onClick={click} className={compatClassName()}>
{removeAfterDot(_price.format())} {removeAfterDot(_price.format())}
</div> </div>
) );
} }
export default PriceItem export default PriceItem;