feat: display promo group and active discount banners on gift page

Add promo group banner (green) and active discount banner (orange) to
gift subscription page. PeriodCard now shows original price strikethrough
and discount percentage badge from server-calculated values.
This commit is contained in:
Fringg
2026-03-11 02:58:43 +03:00
parent 6fd76c8dc8
commit 03c9e73a37
2 changed files with 52 additions and 0 deletions

View File

@@ -40,6 +40,9 @@ export interface GiftConfig {
payment_methods: GiftPaymentMethod[];
balance_kopeks: number;
currency_symbol: string;
promo_group_name: string | null;
active_discount_percent: number | null;
active_discount_expires_at: string | null;
}
export interface GiftPurchaseRequest {

View File

@@ -695,6 +695,55 @@ function BuyTabContent({
</div>
)}
{/* Promo group banner */}
{config.promo_group_name && (
<div className="flex items-center gap-3 rounded-xl border border-success-500/30 bg-success-500/10 p-3">
<div className="flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-success-500/20">
<svg
className="h-4 w-4 text-success-400"
fill="none"
viewBox="0 0 24 24"
stroke="currentColor"
strokeWidth={1.5}
strokeLinecap="round"
strokeLinejoin="round"
>
<path d="M9.813 15.904L9 18.75l-.813-2.846a4.5 4.5 0 00-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 003.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 003.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 00-3.09 3.09z" />
</svg>
</div>
<div>
<div className="text-sm font-medium text-success-400">
{t('subscription.promoGroup.yourGroup', { name: config.promo_group_name })}
</div>
<div className="text-xs text-dark-400">
{t('subscription.promoGroup.personalDiscountsApplied')}
</div>
</div>
</div>
)}
{/* Active discount banner */}
{config.active_discount_percent != null && config.active_discount_percent > 0 && (
<div className="flex items-center gap-3 rounded-xl border border-orange-500/30 bg-orange-500/10 p-3">
<div className="flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-orange-500/20">
<svg
className="h-4 w-4 text-orange-400"
fill="none"
viewBox="0 0 24 24"
stroke="currentColor"
strokeWidth={1.5}
strokeLinecap="round"
strokeLinejoin="round"
>
<path d="M9.813 15.904L9 18.75l-.813-2.846a4.5 4.5 0 00-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 003.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 003.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 00-3.09 3.09z" />
</svg>
</div>
<div className="text-sm font-medium text-orange-400">
{t('promo.discountApplied')} -{config.active_discount_percent}%
</div>
</div>
)}
{/* Period selection */}
{periodsForDisplay.length > 0 && (
<div>