w-aura/src/components/SubPlanInformation/index.tsx
Daniil Chemerkin f5551a0c42 Develop
2024-06-02 00:51:18 +00:00

38 lines
1.0 KiB
TypeScript

import { useTranslation } from "react-i18next";
import styles from "./styles.module.css";
import TotalToday from "./TotalToday";
import ApplePayButton from "../PaymentPage/methods/ApplePayButton";
import { IPaywallProduct } from "@/api/resources/Paywall";
interface ISubPlanInformationProps {
product: IPaywallProduct;
client_secret?: string;
}
const getPrice = (product: IPaywallProduct): string => {
return `$${
(product.trialPrice === 100 ? 99 : product.trialPrice || 0) / 100
}`;
};
function SubPlanInformation({
product,
client_secret,
}: ISubPlanInformationProps): JSX.Element {
const { t } = useTranslation();
return (
<div className={styles.container}>
<TotalToday total={getPrice(product)} />
{client_secret && (
<ApplePayButton activeProduct={product} client_secret={client_secret} />
)}
<p className={styles.description}>
{t("auweb.pay.information").replaceAll("%@", getPrice(product))}.
</p>
</div>
);
}
export default SubPlanInformation;