diff --git a/src/pages/user-management/components/UserSubscriptionsSection.tsx b/src/pages/user-management/components/UserSubscriptionsSection.tsx index 6dbfb7c..0fbe992 100644 --- a/src/pages/user-management/components/UserSubscriptionsSection.tsx +++ b/src/pages/user-management/components/UserSubscriptionsSection.tsx @@ -155,120 +155,137 @@ function ActiveSubscriptionsCard({ onGrant: () => void onCancel: (subscription: UserSubscriptionRecord) => void }) { + const [expanded, setExpanded] = useState(true) const anyActive = subscriptions.some( (subscription) => subscription.is_currently_active || subscription.status.toUpperCase() === "ACTIVE", ) return ( -
-
-
+
+
+
+ + {expanded ? ( + + ) : ( + + )} +
+ -
- {subscriptions.map((subscription) => { - const daysLeft = getDaysLeft(subscription) - const statusUpper = subscription.status.toUpperCase() - const isActive = - subscription.is_currently_active || statusUpper === "ACTIVE" - const cancelEnabled = - canCancel && isActive && statusUpper !== "CANCELLED" + {expanded ? ( +
+
+ {subscriptions.map((subscription) => { + const daysLeft = getDaysLeft(subscription) + const statusUpper = subscription.status.toUpperCase() + const isActive = + subscription.is_currently_active || statusUpper === "ACTIVE" + const cancelEnabled = + canCancel && isActive && statusUpper !== "CANCELLED" - return ( -
-
-
-

- {formatPlanTitle(subscription)} -

-

- {formatPlanCategory(subscription.plan_category)} · Expires{" "} - {formatExpiryDate(subscription)} - {daysLeft != null ? ` · ${formatDaysLeftLabel(daysLeft)}` : ""} -

+ return ( +
+
+
+

+ {formatPlanTitle(subscription)} +

+

+ {formatPlanCategory(subscription.plan_category)} · Expires{" "} + {formatExpiryDate(subscription)} + {daysLeft != null ? ` · ${formatDaysLeftLabel(daysLeft)}` : ""} +

+
+
+ + {canCancel ? ( + + ) : null} +
+
-
- - {canCancel ? ( - - ) : null} -
-
-
- ) - })} -
+ ) + })} +
-
- {canExtend ? ( - - ) : null} +
+ {canExtend ? ( + + ) : null} - {canGrant ? ( - - ) : null} -
+ {canGrant ? ( + + ) : null} +
+
+ ) : null}
) } @@ -288,65 +305,81 @@ function EmptySubscriptionCard({ grantEnabled: boolean onGrant: () => void }) { + const [expanded, setExpanded] = useState(true) const upper = displayStatus.toUpperCase() const tone = upper === "ACTIVE" ? "active" : upper === "PENDING" ? "pending" : "inactive" return ( -
-
+
+
-
-

No active subscription for this learner.

-
-
- {canExtend ? ( - - ) : null} - {(canGrant || canCancel) && ( -
- {canGrant ? ( +
+ + {expanded ? ( + + ) : ( + + )} +
+ + + {expanded ? ( +
+

No active subscription for this learner.

+
+ {canExtend ? ( - ) : null} - {canCancel ? ( - ) : null} + {(canGrant || canCancel) && ( +
+ {canGrant ? ( + + ) : null} + {canCancel ? ( + + ) : null} +
+ )}
- )} -
+
+ ) : null}
) }