"use client"; import Image from "next/image"; import { useTranslations } from "next-intl"; import clsx from "clsx"; import { Button, Card, Spinner, Typography } from "@/components/ui"; import { getFormattedPrice } from "@/shared/utils/price"; import { Currency } from "@/types"; import styles from "./VideoGuideCard.module.scss"; interface VideoGuideCardProps { name: string; description: string; imageUrl: string; duration: string; price: number; oldPrice: number; discount: number; isPurchased: boolean; isCheckoutLoading?: boolean; isProcessingPurchase?: boolean; onPurchaseClick?: () => void; className?: string; } export default function VideoGuideCard(props: VideoGuideCardProps) { const { name, description, imageUrl, duration, price, oldPrice, discount, isPurchased, isCheckoutLoading, isProcessingPurchase, onPurchaseClick, className, } = props; const tCommon = useTranslations("Dashboard.videoGuides"); const currency = Currency.USD; // Если идет обработка покупки - показываем только лоадер на всей карточке if (isProcessingPurchase) { return ( ); } return ( {/* Image with Play Icon */} {/* Content */} {/* Top Section */} {name} {description} {isPurchased && ( )} {/* Bottom Section */} {!isPurchased ? ( <> {duration} {discount}% OFF{" "} {getFormattedPrice(oldPrice, currency)} { e.preventDefault(); e.stopPropagation(); onPurchaseClick?.(); }} disabled={isCheckoutLoading} > {isCheckoutLoading ? ( ) : ( tCommon("purchaseFor", { price: getFormattedPrice(price, currency), }) )} > ) : ( {duration} )} ); }