| 1 | 'use client' |
| 2 | |
| 3 | import { UsersRound } from 'lucide-react' |
| 4 | import { |
| 5 | Empty, |
| 6 | EmptyDescription, |
| 7 | EmptyHeader, |
| 8 | EmptyMedia, |
| 9 | EmptyTitle, |
| 10 | } from '@/components/ui/empty' |
| 11 | import type { OrgMember, |
| 12 | import CreateTeamDialog from './create-team-dialog |
| 13 | import TeamCard from './team-card |
| 14 | |
| 15 | export default function TeamsSection |
| 16 | organizationId, |
| 17 | teams, |
| 18 | members, |
| 19 | canManage, |
| 20 | showCreateDialog, |
| 21 | onShowCreateDialogChange, |
| 22 | }: { |
| 23 | organizationId: string |
| 24 | orgSlug: string |
| 25 | teams: OrgTeamWithMembers |
| 26 | members: OrgMember |
| 27 | canManage: boolean |
| 28 | showCreateDialog: boolean |
| 29 | onShowCreateDialogChange: (open |
| 30 | }) { |
| 31 | if (teams.length |
| 32 | return ( |
| 33 | <Empty> |
| 34 | <EmptyHeader> |
| 35 | <EmptyMedia variant=' |
| 36 | <UsersRound /> |
| 37 | </EmptyMedia> |
| 38 | <EmptyTitle>No teams yet</EmptyTitle |
| 39 | <EmptyDescription> |
| 40 | Teams help you organize members and assign them to projects |
| 41 | together. |
| 42 | </EmptyDescription> |
| 43 | </EmptyHeader> |
| 44 | </Empty> |
| 45 | ) |
| 46 | } |
| 47 | |
| 48 | return ( |
| 49 | <> |
| 50 | {teams.length === |
| 51 | <Empty> |
| 52 | <EmptyHeader> |
| 53 | <EmptyMedia variant=' |
| 54 | <UsersRound /> |
| 55 | </EmptyMedia> |
| 56 | <EmptyTitle>No teams yet</EmptyTitle |
| 57 | <EmptyDescription> |
| 58 | Create a team to organize your workspace members. |
| 59 | </EmptyDescription> |
| 60 | </EmptyHeader> |
| 61 | </Empty> |
| 62 | ) : ( |
| 63 | <div className='space-y-4 |
| 64 | {teams.map(( |
| 65 | <TeamCard |
| 66 | canManage={canManage} |
| 67 | isLastTeam={teams.length |
| 68 | key={team.teamId |
| 69 | orgMembers={members} |
| 70 | team={team} |
| 71 | /> |
| 72 | ))} |
| 73 | </div> |
| 74 | )} |
| 75 | |
| 76 | <CreateTeamDialog |
| 77 | onOpenChange={onShowCreateDialogChange} |
| 78 | open={showCreateDialog} |
| 79 | organizationId={organizationId} |
| 80 | /> |
| 81 | </> |
| 82 | ) |
| 83 | } |