| 1 | import type { Metadata } from 'next' |
| 2 | import { headers } |
| 3 | import { redirect } |
| 4 | import { projectsService } |
| 5 | import { teamService } |
| 6 | import { createMetadata } |
| 7 | import { auth } |
| 8 | import { resolveOrgContext } |
| 9 | import { TeamsPageClient } |
| 10 | |
| 11 | export const metadata: |
| 12 | title: 'Teams', |
| 13 | description: 'Manage workspace members, roles, and team groups.', |
| 14 | openGraph: { |
| 15 | images: ['/api/og?page=Team'], |
| 16 | }, |
| 17 | twitter: { |
| 18 | images: ['/api/og?page=Team'], |
| 19 | }, |
| 20 | }) |
| 21 | |
| 22 | export default async function |
| 23 | const { org |
| 24 | const { organization, |
| 25 | |
| 26 | if ( |
| 27 | !( |
| 28 | role.authorize({ |
| 29 | role.authorize({ |
| 30 | ) |
| 31 | ) { |
| 32 | redirect( |
| 33 | `/error/403?message=${encodeURIComponent('You do not have permission to view teams |
| 34 | ) |
| 35 | } |
| 36 | |
| 37 | const canManage = |
| 38 | |
| 39 | const [orgMembers, |
| 40 | await Promise.all |
| 41 | teamService.getOrgMembers(organization |
| 42 | teamService.getOrgTeamsWithMembers(organization |
| 43 | canManage |
| 44 | ? auth.api. |
| 45 | headers: await headers |
| 46 | query: { organizationId: organization |
| 47 | }) |
| 48 | : Promise.resolve([]) |
| 49 | projectsService.getSettings(organization |
| 50 | ]) |
| 51 | |
| 52 | const pendingInvitations = |
| 53 | (i) => |
| 54 | ) |
| 55 | |
| 56 | return ( |
| 57 | <TeamsPageClient |
| 58 | canManage={canManage} |
| 59 | currentMemberId={orgMember.id |
| 60 | defaultCurrency={orgSettings.payCurrency |
| 61 | defaultMemberRate={orgSettings.payRate |
| 62 | invitations={pendingInvitations} |
| 63 | members={orgMembers} |
| 64 | organizationId={organization.id |
| 65 | orgSlug={org} |
| 66 | teams={orgTeams} |
| 67 | /> |
| 68 | ) |
| 69 | } |