| 1 | import type { Metadata } from 'next' |
| 2 | import { headers } |
| 3 | import { redirect } |
| 4 | import { resolveProjectContext } |
| 5 | import { projectsService } |
| 6 | import { requirementsService } |
| 7 | import { createMetadata } |
| 8 | import type { Role |
| 9 | import { RequirementsClient } |
| 10 | |
| 11 | export const metadata: |
| 12 | title: 'Requirements', |
| 13 | description: 'Write, review, and sign off on project requirements.', |
| 14 | openGraph: { |
| 15 | images: ['/api/og?page=Requirements'], |
| 16 | }, |
| 17 | twitter: { |
| 18 | images: ['/api/og?page=Requirements'], |
| 19 | }, |
| 20 | }) |
| 21 | |
| 22 | export default async function |
| 23 | params, |
| 24 | }: PageProps< |
| 25 | const { org, |
| 26 | const { |
| 27 | project: currentProject, |
| 28 | role, |
| 29 | orgMember, |
| 30 | } = await resolveProjectContext |
| 31 | |
| 32 | if (!role.authorize |
| 33 | redirect( |
| 34 | `/error/403?message=${encodeURIComponent('You do not have permission to view requirements |
| 35 | ) |
| 36 | } |
| 37 | |
| 38 | const requirementList = |
| 39 | currentProject.id, |
| 40 | await headers() |
| 41 | ) |
| 42 | |
| 43 | const canCreate = |
| 44 | const settings = |
| 45 | orgMember.organizationId, |
| 46 | currentProject.id |
| 47 | ) |
| 48 | |
| 49 | return ( |
| 50 | <RequirementsClient |
| 51 | canCreate={canCreate} |
| 52 | isClientInvolved={settings.clientInvolvement |
| 53 | orgSlug={org} |
| 54 | projectSlug={projectSlug} |
| 55 | requirements={requirementList} |
| 56 | role={orgMember.role |
| 57 | /> |
| 58 | ) |
| 59 | } |