@@ -24,6 +24,7 @@ interface CurrentPlanAndBalanceProps {
planTokenLimit: string
planPrice: string
isIndividual: boolean
+ isRecurring: boolean
nextPaymentAt?: string | null
}
@@ -39,10 +40,14 @@ export const CurrentPlanAndBalance = ({
planTokenLimit,
planPrice,
isIndividual,
+ isRecurring,
nextPaymentAt,
}: CurrentPlanAndBalanceProps) => {
const formatterdPlanPrice = formatPlanPrice(planPrice, isIndividual)
const nextPaymentFormatted = formatNextPaymentLabel(nextPaymentAt)
+ const nextPaymentLabel = nextPaymentFormatted
+ ? `${isRecurring ? 'Следующее списание' : 'Дата окончания'}: ${nextPaymentFormatted}`
+ : 'Без даты окончания'
const planTokenLimitNumber = Number(planTokenLimit)
const percentage = planTokenLimitNumber > 0 ? Math.min(100, Math.max(0, (balance / planTokenLimitNumber) * 100)) : 0
@@ -61,11 +66,9 @@ export const CurrentPlanAndBalance = ({
{formatterdPlanPrice}
- {nextPaymentFormatted ? (
-
- Следующее списание: {nextPaymentFormatted}
-
- ) : null}
+
+ {nextPaymentLabel}
+
@@ -31,6 +31,7 @@ const SubscriptionPage: NextPageWithLayout = () => {
individual: isIndividual,
} = useAppSelector((state) => state.user.payment_plan.plan)
const nextPaymentAt = useAppSelector((state) => state.user.payment_plan.next_payment_at)
+ const isRecurring = useAppSelector((state) => state.user.payment_plan?.is_recurring) ?? false
const balance = useAppSelector(balanceSelector)
const dispatch = useAppDispatch()
const { data } = useSession()
@@ -97,6 +98,7 @@ const SubscriptionPage: NextPageWithLayout = () => {
planPrice={planPrice}
planTokenLimit={planTokenLimit}
isIndividual={isIndividual}
+ isRecurring={isRecurring}
nextPaymentAt={nextPaymentAt}
/>
@@ -112,7 +114,7 @@ const SubscriptionPage: NextPageWithLayout = () => {
- {isIndividual ? (
+ {isIndividual || !isRecurring ? (