| 1 | import type { Metadata } from 'next' |
| 2 | import { redirect } |
| 3 | import { projectsService } |
| 4 | import { createMetadata } |
| 5 | import { resolveOrgContext } |
| 6 | import { ProjectsClient } |
| 7 | |
| 8 | export const metadata: |
| 9 | title: 'Projects', |
| 10 | description: "View all of your workspace's projects.", |
| 11 | openGraph: { |
| 12 | images: ['/api/og?page=Projects'], |
| 13 | }, |
| 14 | twitter: { |
| 15 | images: ['/api/og?page=Projects'], |
| 16 | }, |
| 17 | }) |
| 18 | |
| 19 | export default async function |
| 20 | params, |
| 21 | searchParams, |
| 22 | }: PageProps< |
| 23 | const { org |
| 24 | const { organization, |
| 25 | const { newProject |
| 26 | if (!role.authorize |
| 27 | return redirect( |
| 28 | `/error?message=${encodeURIComponent('You do not have permission to view projects |
| 29 | ) |
| 30 | } |
| 31 | |
| 32 | const canCreate = |
| 33 | const projectList = |
| 34 | organization.id, |
| 35 | orgMember |
| 36 | ) |
| 37 | |
| 38 | return ( |
| 39 | <ProjectsClient |
| 40 | canCreate={canCreate} |
| 41 | openNewProjectDialog={newProject === |
| 42 | organizationId={organization.id |
| 43 | orgSlug={org} |
| 44 | projects={projectList} |
| 45 | /> |
| 46 | ) |
| 47 | } |