Move subscriptions into the user detail sidebar column.

Tighten subscription action button layout so the card fits the narrower column.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Yared Yemane 2026-07-10 05:06:43 -07:00
parent 042df899e1
commit f6ad0d3cb5
2 changed files with 21 additions and 32 deletions

View File

@ -147,7 +147,6 @@ function LoadingSkeleton() {
<div className="h-72 animate-pulse rounded-2xl bg-grayScale-100" /> <div className="h-72 animate-pulse rounded-2xl bg-grayScale-100" />
</div> </div>
</div> </div>
<div className="h-64 animate-pulse rounded-2xl bg-grayScale-100" />
</div> </div>
); );
} }
@ -444,6 +443,16 @@ export function UserDetailPage() {
/> />
</CardContent> </CardContent>
</Card> </Card>
<UserSubscriptionsSection
userId={Number(id)}
userRole={user.role}
userName={[user.first_name, user.last_name].filter(Boolean).join(" ") || user.email}
subscriptions={subscriptions}
loading={subscriptionsLoading}
error={subscriptionsError}
onRefresh={() => void refreshSubscriptions()}
/>
</div> </div>
<div className="min-w-0 space-y-6"> <div className="min-w-0 space-y-6">
@ -550,16 +559,6 @@ export function UserDetailPage() {
</div> </div>
</div> </div>
<UserSubscriptionsSection
userId={Number(id)}
userRole={user.role}
userName={[user.first_name, user.last_name].filter(Boolean).join(" ") || user.email}
subscriptions={subscriptions}
loading={subscriptionsLoading}
error={subscriptionsError}
onRefresh={() => void refreshSubscriptions()}
/>
{confirmDialog && ( {confirmDialog && (
<div className="fixed inset-0 z-50 flex items-center justify-center bg-black/40 backdrop-blur-sm"> <div className="fixed inset-0 z-50 flex items-center justify-center bg-black/40 backdrop-blur-sm">
<div className="mx-4 w-full max-w-sm rounded-xl bg-white shadow-2xl"> <div className="mx-4 w-full max-w-sm rounded-xl bg-white shadow-2xl">

View File

@ -189,11 +189,11 @@ function SubscriptionManageCard({
</div> </div>
</div> </div>
<div className="mt-6 space-y-2.5"> <div className="mt-6 flex flex-col gap-2">
{canExtend ? ( {canExtend ? (
<Button <Button
type="button" type="button"
className="h-11 w-full rounded-xl bg-brand-500 text-sm font-semibold text-white hover:bg-brand-600 disabled:pointer-events-auto disabled:cursor-not-allowed disabled:opacity-50" className="h-10 w-full rounded-xl bg-brand-500 text-sm font-semibold text-white hover:bg-brand-600 disabled:pointer-events-auto disabled:cursor-not-allowed disabled:opacity-50"
disabled={!extendEnabled} disabled={!extendEnabled}
title={ title={
!extendEnabled !extendEnabled
@ -208,16 +208,11 @@ function SubscriptionManageCard({
) : null} ) : null}
{(canGrant || canCancel) && ( {(canGrant || canCancel) && (
<div <div className="flex flex-wrap gap-2">
className={cn(
"grid gap-2.5",
canGrant && canCancel ? "grid-cols-2" : "grid-cols-1",
)}
>
{canGrant ? ( {canGrant ? (
<Button <Button
type="button" type="button"
className="h-11 rounded-xl bg-grayScale-100 text-sm font-semibold text-grayScale-700 hover:bg-grayScale-200 disabled:pointer-events-auto disabled:cursor-not-allowed disabled:opacity-50" className="h-10 min-w-0 flex-1 rounded-xl bg-grayScale-100 text-sm font-semibold text-grayScale-700 hover:bg-grayScale-200 disabled:pointer-events-auto disabled:cursor-not-allowed disabled:opacity-50"
disabled={!markAsPaidEnabled} disabled={!markAsPaidEnabled}
title={ title={
!markAsPaidEnabled !markAsPaidEnabled
@ -233,7 +228,7 @@ function SubscriptionManageCard({
<Button <Button
type="button" type="button"
variant="outline" variant="outline"
className="h-11 rounded-xl border-grayScale-200 bg-white text-sm font-semibold text-grayScale-700 hover:bg-grayScale-50 disabled:pointer-events-auto disabled:cursor-not-allowed disabled:opacity-50" className="h-10 min-w-0 flex-1 rounded-xl border-grayScale-200 bg-white text-sm font-semibold text-grayScale-700 hover:bg-grayScale-50 disabled:pointer-events-auto disabled:cursor-not-allowed disabled:opacity-50"
disabled={!cancelEnabled} disabled={!cancelEnabled}
title={ title={
!cancelEnabled !cancelEnabled
@ -281,11 +276,11 @@ function EmptySubscriptionCard({
<div className="mt-4 border-t border-grayScale-100 pt-4"> <div className="mt-4 border-t border-grayScale-100 pt-4">
<p className="text-sm text-grayScale-500">No active subscription for this learner.</p> <p className="text-sm text-grayScale-500">No active subscription for this learner.</p>
</div> </div>
<div className="mt-6 space-y-2.5"> <div className="mt-6 flex flex-col gap-2">
{canExtend ? ( {canExtend ? (
<Button <Button
type="button" type="button"
className="h-11 w-full rounded-xl bg-brand-500 text-sm font-semibold text-white hover:bg-brand-600 disabled:pointer-events-auto disabled:cursor-not-allowed disabled:opacity-50" className="h-10 w-full rounded-xl bg-brand-500 text-sm font-semibold text-white hover:bg-brand-600 disabled:pointer-events-auto disabled:cursor-not-allowed disabled:opacity-50"
disabled disabled
title="Extend is only available when this learner has an active subscription." title="Extend is only available when this learner has an active subscription."
> >
@ -294,16 +289,11 @@ function EmptySubscriptionCard({
</Button> </Button>
) : null} ) : null}
{(canGrant || canCancel) && ( {(canGrant || canCancel) && (
<div <div className="flex flex-wrap gap-2">
className={cn(
"grid gap-2.5",
canGrant && canCancel ? "grid-cols-2" : "grid-cols-1",
)}
>
{canGrant ? ( {canGrant ? (
<Button <Button
type="button" type="button"
className="h-11 rounded-xl bg-brand-500 text-sm font-semibold text-white hover:bg-brand-600" className="h-10 min-w-0 flex-1 rounded-xl bg-brand-500 text-sm font-semibold text-white hover:bg-brand-600"
onClick={onGrant} onClick={onGrant}
> >
Mark as Paid Mark as Paid
@ -313,7 +303,7 @@ function EmptySubscriptionCard({
<Button <Button
type="button" type="button"
variant="outline" variant="outline"
className="h-11 rounded-xl border-grayScale-200 bg-white text-sm font-semibold text-grayScale-700 disabled:pointer-events-auto disabled:cursor-not-allowed disabled:opacity-50" className="h-10 min-w-0 flex-1 rounded-xl border-grayScale-200 bg-white text-sm font-semibold text-grayScale-700 disabled:pointer-events-auto disabled:cursor-not-allowed disabled:opacity-50"
disabled disabled
title="Cancel is only available when this learner has an active subscription." title="Cancel is only available when this learner has an active subscription."
> >
@ -375,7 +365,7 @@ export function UserSubscriptionsSection({
return ( return (
<> <>
<div className="w-full max-w-md space-y-4"> <div className="w-full space-y-4">
{loading ? ( {loading ? (
<Card className="rounded-2xl border border-grayScale-200 shadow-sm"> <Card className="rounded-2xl border border-grayScale-200 shadow-sm">
<CardContent className="flex items-center gap-2 p-6 text-sm text-grayScale-400"> <CardContent className="flex items-center gap-2 p-6 text-sm text-grayScale-400">