diff --git a/src/components/PromoDiscountBadge.tsx b/src/components/PromoDiscountBadge.tsx index a0d005a..8f4f845 100644 --- a/src/components/PromoDiscountBadge.tsx +++ b/src/components/PromoDiscountBadge.tsx @@ -16,7 +16,7 @@ const ClockIcon = () => ( ) -const formatTimeLeft = (expiresAt: string): string => { +const formatTimeLeft = (expiresAt: string, t: (key: string) => string): string => { const now = new Date() const expires = new Date(expiresAt) const diffMs = expires.getTime() - now.getTime() @@ -28,12 +28,12 @@ const formatTimeLeft = (expiresAt: string): string => { if (hours > 24) { const days = Math.floor(hours / 24) - return `${days}д` + return `${days}${t('promo.time.days')}` } if (hours > 0) { - return `${hours}ч ${minutes}м` + return `${hours}${t('promo.time.hours')} ${minutes}${t('promo.time.minutes')}` } - return `${minutes}м` + return `${minutes}${t('promo.time.minutes')}` } export default function PromoDiscountBadge() { @@ -65,7 +65,7 @@ export default function PromoDiscountBadge() { return null } - const timeLeft = activeDiscount.expires_at ? formatTimeLeft(activeDiscount.expires_at) : null + const timeLeft = activeDiscount.expires_at ? formatTimeLeft(activeDiscount.expires_at, t) : null const handleClick = () => { setIsOpen(!isOpen) @@ -96,56 +96,57 @@ export default function PromoDiscountBadge() { - {/* Dropdown */} + {/* Dropdown - mobile: fixed centered, desktop: absolute right */} {isOpen && ( -
+ {t('promo.discountDescription')} +
+ + {/* Time remaining */} + {timeLeft && ( +- {t('promo.discountDescription', 'Your personal discount is applied to subscription purchases')} -
- - {/* Time remaining */} - {timeLeft && ( -