From 029f08207eff861bf2f997d2ead6960cf9d7a23b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A1tia=20Antunes?= Date: Thu, 5 Jan 2023 12:19:39 +0000 Subject: [PATCH] fix: fix add responsibles field to boardData (#799) --- .../Teams/Team/ListCardMembers/index.tsx | 24 +++++++++++++++++-- frontend/src/pages/boards/newRegularBoard.tsx | 9 +++++++ 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/Teams/Team/ListCardMembers/index.tsx b/frontend/src/components/Teams/Team/ListCardMembers/index.tsx index d064d50f8..a05c8c603 100644 --- a/frontend/src/components/Teams/Team/ListCardMembers/index.tsx +++ b/frontend/src/components/Teams/Team/ListCardMembers/index.tsx @@ -1,4 +1,4 @@ -import React, { useEffect, useRef, useState } from 'react'; +import React, { MouseEvent, useEffect, useRef, useState } from 'react'; import { useSession } from 'next-auth/react'; import { useRecoilValue } from 'recoil'; @@ -8,6 +8,8 @@ import { membersListState } from '@/store/team/atom/team.atom'; import { TeamUserRoles } from '@/utils/enums/team.user.roles'; import CardMember from '@/components/Teams/CreateTeam/CardMember'; +import { ButtonAddMember } from '@/components/Primitives/Dialog/styles'; +import Icon from '@/components/icons/Icon'; import { ListMembers } from '../../CreateTeam/ListMembers'; import { ScrollableContent } from './styles'; @@ -26,6 +28,11 @@ const TeamMembersList = ({ handleMembersList }: TeamMemberListProps) => { const user = membersList.find((member) => member.user._id === session?.user.id); + const handleOpen = (event: MouseEvent) => { + event.preventDefault(); + setIsOpen(true); + }; + useEffect(() => { if (didMountRef.current && !isOpen) { handleMembersList(); @@ -44,7 +51,19 @@ const TeamMembersList = ({ handleMembersList }: TeamMemberListProps) => { Team Members {(!isTeamMember || isSAdmin) && ( - + + {' '} + + Add/remove members + + )} @@ -59,6 +78,7 @@ const TeamMembersList = ({ handleMembersList }: TeamMemberListProps) => { /> ))} + ); }; diff --git a/frontend/src/pages/boards/newRegularBoard.tsx b/frontend/src/pages/boards/newRegularBoard.tsx index adeefefaa..77828c9eb 100644 --- a/frontend/src/pages/boards/newRegularBoard.tsx +++ b/frontend/src/pages/boards/newRegularBoard.tsx @@ -167,6 +167,14 @@ const NewRegularBoard: NextPage = () => { */ const saveBoard = (title?: string, maxVotes?: number, slackEnable?: boolean) => { const users: BoardUserDto[] = []; + const responsibles: string[] = []; + + const responsible = boardState.users.find((user) => user.role === BoardUserRoles.RESPONSIBLE); + + if (!isEmpty(responsible)) { + responsibles.push(responsible.user); + } + if (isEmpty(boardState.users) && session) { users.push({ role: BoardUserRoles.RESPONSIBLE, user: session?.user.id }); } @@ -180,6 +188,7 @@ const NewRegularBoard: NextPage = () => { slackEnable, maxUsers: boardState.count.maxUsersCount, recurrent: false, + responsibles, }); };