mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-28 17:43:47 +00:00
Update Subscription.tsx
This commit is contained in:
@@ -1095,6 +1095,13 @@ export default function Subscription() {
|
|||||||
{/* Tariff List - current tariff first */}
|
{/* Tariff List - current tariff first */}
|
||||||
<div className="grid grid-cols-1 sm:grid-cols-2 gap-4">
|
<div className="grid grid-cols-1 sm:grid-cols-2 gap-4">
|
||||||
{[...tariffs]
|
{[...tariffs]
|
||||||
|
// Hide Trial tariffs for users who already have trial subscription
|
||||||
|
.filter((tariff) => {
|
||||||
|
if (subscription?.is_trial && tariff.name.toLowerCase().includes('trial')) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
})
|
||||||
.sort((a, b) => {
|
.sort((a, b) => {
|
||||||
const aIsCurrent = a.is_current || a.id === subscription?.tariff_id
|
const aIsCurrent = a.is_current || a.id === subscription?.tariff_id
|
||||||
const bIsCurrent = b.is_current || b.id === subscription?.tariff_id
|
const bIsCurrent = b.is_current || b.id === subscription?.tariff_id
|
||||||
@@ -1787,7 +1794,15 @@ export default function Subscription() {
|
|||||||
{/* Step: Server Selection */}
|
{/* Step: Server Selection */}
|
||||||
{currentStep === 'servers' && selectedPeriod?.servers.options && (
|
{currentStep === 'servers' && selectedPeriod?.servers.options && (
|
||||||
<div className="grid grid-cols-2 sm:grid-cols-3 gap-3">
|
<div className="grid grid-cols-2 sm:grid-cols-3 gap-3">
|
||||||
{selectedPeriod.servers.options.map((server) => {
|
{selectedPeriod.servers.options
|
||||||
|
// Hide Trial server for users who already have trial subscription
|
||||||
|
.filter((server) => {
|
||||||
|
if (subscription?.is_trial && server.name.toLowerCase().includes('trial')) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
})
|
||||||
|
.map((server) => {
|
||||||
const hasExistingDiscount = !!(server.discount_percent && server.discount_percent > 0)
|
const hasExistingDiscount = !!(server.discount_percent && server.discount_percent > 0)
|
||||||
const promoServer = applyPromoDiscount(server.price_kopeks, hasExistingDiscount)
|
const promoServer = applyPromoDiscount(server.price_kopeks, hasExistingDiscount)
|
||||||
|
|
||||||
@@ -1822,7 +1837,7 @@ export default function Subscription() {
|
|||||||
<div>
|
<div>
|
||||||
<div className="font-medium text-dark-100">{server.name}</div>
|
<div className="font-medium text-dark-100">{server.name}</div>
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<span className="text-sm text-accent-400">{formatPrice(promoServer.price)}</span>
|
<span className="text-sm text-accent-400">{formatPrice(promoServer.price)}{t('subscription.perMonth')}</span>
|
||||||
{promoServer.original && (
|
{promoServer.original && (
|
||||||
<span className="text-dark-500 text-xs line-through">{formatPrice(promoServer.original)}</span>
|
<span className="text-dark-500 text-xs line-through">{formatPrice(promoServer.original)}</span>
|
||||||
)}
|
)}
|
||||||
@@ -1860,8 +1875,15 @@ export default function Subscription() {
|
|||||||
+
|
+
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div className="text-sm text-dark-500 mt-4">
|
<div className="text-sm text-dark-500 mt-4 text-center space-y-1">
|
||||||
{formatPrice(selectedPeriod.devices.price_per_device_kopeks)} {t('subscription.perDevice')}
|
<div className="text-accent-400">
|
||||||
|
{selectedPeriod.devices.min} {t('subscription.devicesFree')}
|
||||||
|
</div>
|
||||||
|
{selectedPeriod.devices.max > selectedPeriod.devices.min && (
|
||||||
|
<div>
|
||||||
|
{formatPrice(selectedPeriod.devices.price_per_device_kopeks)} {t('subscription.perExtraDevice')}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Reference in New Issue
Block a user