| 1 | import type { Metadata } from 'next' |
| 2 | import { redirect } |
| 3 | import { resolveProjectContext } |
| 4 | import { projectsService } |
| 5 | import { createMetadata } |
| 6 | import ProposalEditor from '../_components/proposal-editor |
| 7 | |
| 8 | export const metadata: |
| 9 | title: 'New Proposal', |
| 10 | description: 'Draft a new proposal to send to your client.', |
| 11 | openGraph: { |
| 12 | images: ['/api/og?page=Proposals'], |
| 13 | }, |
| 14 | twitter: { |
| 15 | images: ['/api/og?page=Proposals'], |
| 16 | }, |
| 17 | }) |
| 18 | |
| 19 | export default async function |
| 20 | params, |
| 21 | }: PageProps< |
| 22 | const { org, |
| 23 | const { |
| 24 | project: currentProject, |
| 25 | role, |
| 26 | organization, |
| 27 | } = await resolveProjectContext |
| 28 | |
| 29 | if (!role.authorize |
| 30 | redirect( |
| 31 | `/error/403?message=${encodeURIComponent('You do not have permission to create proposals |
| 32 | ) |
| 33 | } |
| 34 | const settings = |
| 35 | organization.id, |
| 36 | currentProject.id |
| 37 | ) |
| 38 | |
| 39 | return ( |
| 40 | <ProposalEditor |
| 41 | defaultCurrency={settings.currency |
| 42 | isClientInvolved={settings.clientInvolvement |
| 43 | mode='create' |
| 44 | orgSlug={org} |
| 45 | projectId={currentProject.id |
| 46 | projectName={currentProject.name |
| 47 | projectSlug={projectSlug} |
| 48 | /> |
| 49 | ) |
| 50 | } |