Skip to content

Commit 5c7d9c5

Browse files
committed
feat(subscription): Enhance subscription page access control and messaging
- Update page metadata title to "Subscription" and refine description - Replace hard redirect with conditional access control check for non-owners/admins - Implement dynamic page heading based on user permissions (Management vs Information) - Add conditional description text that reflects user's subscription access level - Allow all authenticated members to view subscription information while restricting management capabilities to owners and admins
1 parent a2eee8a commit 5c7d9c5

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

  • app/dashboard/company/[slug]/subscription

app/dashboard/company/[slug]/subscription/page.tsx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import { companyService } from '@/lib/services/company-service'
55
import { SubscriptionManagement } from '@/components/subscription/SubscriptionManagement'
66

77
export const metadata: Metadata = {
8-
title: 'Subscription Management | CodeUnia',
9-
description: 'Manage your company subscription and billing',
8+
title: 'Subscription | CodeUnia',
9+
description: 'View your company subscription and billing information',
1010
}
1111

1212
interface PageProps {
@@ -59,17 +59,19 @@ export default async function SubscriptionPage({ params }: PageProps) {
5959
redirect('/dashboard/company')
6060
}
6161

62-
// Only owners and admins can manage subscription
63-
if (!['owner', 'admin'].includes(membership.role)) {
64-
redirect(`/dashboard/company/${slug}`)
65-
}
62+
// Check if user can manage subscription
63+
const canManageSubscription = ['owner', 'admin'].includes(membership.role)
6664

6765
return (
6866
<div className="container mx-auto py-8 px-4 max-w-6xl">
6967
<div className="mb-8">
70-
<h1 className="text-3xl font-bold mb-2">Subscription Management</h1>
68+
<h1 className="text-3xl font-bold mb-2">
69+
{canManageSubscription ? 'Subscription Management' : 'Subscription Information'}
70+
</h1>
7171
<p className="text-muted-foreground">
72-
Manage your subscription plan and view usage details
72+
{canManageSubscription
73+
? 'Manage your subscription plan and view usage details'
74+
: 'View your company subscription plan and usage details'}
7375
</p>
7476
</div>
7577

0 commit comments

Comments
 (0)