import { useTranslations } from "next-intl"; import clsx from "clsx"; import { Card, Icon, IconName, Typography } from "@/components/ui"; import { IFunnelPaymentVariant } from "@/entities/session/funnel/types"; import { getFormattedPrice } from "@/shared/utils/price"; import { Currency } from "@/types"; import styles from "./VideoGuidesOffer.module.scss"; interface VideoGuidesOfferProps { offer: IFunnelPaymentVariant; isActive: boolean; isFirstOffer?: boolean; className?: string; onClick: () => void; } export default function VideoGuidesOffer(props: VideoGuidesOfferProps) { const { offer, isActive, isFirstOffer, className, onClick } = props; const { key, name, description, emoji, price, oldPrice } = offer; const productKey = key.replaceAll(".", "_"); const currency = Currency.USD; const discount = Math.round( (((oldPrice || 0) - price) / (oldPrice || 0)) * 100 ); const t = useTranslations("AdditionalPurchases.video-guides"); return ( {isFirstOffer && (
{discount}% OFF
)}
{name} {description && ( {description} )}
{t("now")}{" "} {getFormattedPrice(price, currency)} {" "} {getFormattedPrice(oldPrice || 0, currency)} {!isFirstOffer && ( {discount}% OFF )}
); }