From 09f467bfb36e89e6922d3add3e255351a5e6cabc Mon Sep 17 00:00:00 2001 From: c0mrade Date: Thu, 19 Mar 2026 21:33:16 +0300 Subject: [PATCH] feat: show per-subscription mini-cards on Dashboard with tariff name, traffic, devices, date --- src/pages/Dashboard.tsx | 65 ++++++++++++++++++++++++++++++++--------- 1 file changed, 52 insertions(+), 13 deletions(-) diff --git a/src/pages/Dashboard.tsx b/src/pages/Dashboard.tsx index 911d36b..653679c 100644 --- a/src/pages/Dashboard.tsx +++ b/src/pages/Dashboard.tsx @@ -275,21 +275,60 @@ export default function Dashboard() { {/* Pending Gift Activations */} {pendingGifts && pendingGifts.length > 0 && } - {/* Multi-tariff: show link to subscriptions list */} - {isMultiTariff && ( - -
-
+ {/* Multi-tariff: show mini-cards for each subscription */} + {isMultiTariff && multiSubData?.subscriptions && ( +
+
+ {t('dashboard.subscriptions', 'Подписки')} -
-
- {multiSubCount > 1 - ? `${multiSubCount} ${t('dashboard.activeTariffs', 'активных тарифов')}` - : t('dashboard.manageSubscriptions', 'Управление подписками')} -
+ + + {t('dashboard.manageAll', 'Управление')} → +
- - + {multiSubData.subscriptions.map((sub) => { + const isActive = sub.status === 'active' || sub.status === 'trial'; + const trafficDisplay = + sub.traffic_limit_gb === 0 + ? '∞' + : `${sub.traffic_used_gb.toFixed(1)} / ${sub.traffic_limit_gb} ГБ`; + const endDate = sub.end_date + ? new Date(sub.end_date).toLocaleDateString('ru-RU', { + day: '2-digit', + month: '2-digit', + year: 'numeric', + }) + : '—'; + return ( + +
+
+ + {sub.tariff_name || 'Подписка'} +
+
+ 📊 {trafficDisplay} + 📱 {sub.device_limit} + 📅 {endDate} +
+
+ + + ); + })} + + + {t('subscriptions.buyAnother', 'Купить ещё тариф')} + +
)} {/* Subscription Status Card — hidden in multi-tariff (managed via /subscriptions) */}