| 1 | import type { Metadata } from 'next' |
| 2 | import { headers } |
| 3 | import { projectsService } |
| 4 | import { teamService } |
| 5 | import { createMetadata } |
| 6 | import { auth } |
| 7 | import { requirePermission, resolveOrgContext |
| 8 | import { ClientsPageClient } |
| 9 | |
| 10 | export const metadata: |
| 11 | title: 'Clients', |
| 12 | description: 'Manage client relationships and project access.', |
| 13 | openGraph: { |
| 14 | images: ['/api/og?page=Clients'], |
| 15 | }, |
| 16 | twitter: { |
| 17 | images: ['/api/og?page=Clients'], |
| 18 | }, |
| 19 | }) |
| 20 | |
| 21 | export default async function |
| 22 | params, |
| 23 | }: PageProps< |
| 24 | const { org |
| 25 | const { organization, |
| 26 | |
| 27 | requirePermission( |
| 28 | role, |
| 29 | { member: ['create' |
| 30 | 'You do not have permission to view clients' |
| 31 | ) |
| 32 | |
| 33 | const canManage = |
| 34 | |
| 35 | const [clients, |
| 36 | teamService.getOrgClients(organization |
| 37 | projectsService.listByOrganization(organization |
| 38 | canManage |
| 39 | ? auth.api. |
| 40 | headers: await headers |
| 41 | query: { organizationId: organization |
| 42 | }) |
| 43 | : Promise.resolve([]) |
| 44 | ]) |
| 45 | |
| 46 | const pendingInvitations = |
| 47 | (i) => |
| 48 | ) |
| 49 | |
| 50 | return ( |
| 51 | <ClientsPageClient |
| 52 | canManage={canManage} |
| 53 | clients={clients} |
| 54 | invitations={pendingInvitations} |
| 55 | organizationId={organization.id |
| 56 | orgSlug={org} |
| 57 | projects={orgProjects} |
| 58 | /> |
| 59 | ) |
| 60 | } |