File tree Expand file tree Collapse file tree 4 files changed +28
-11
lines changed
frontend/src/components/CreateBoard/RegularBoard Expand file tree Collapse file tree 4 files changed +28
-11
lines changed Original file line number Diff line number Diff line change @@ -11,10 +11,14 @@ import { useSetRecoilState } from 'recoil';
1111import { FormStyled } from './styles' ;
1212
1313type RadioGroupParticipantsProps = {
14+ optionSelected : string ;
1415 handleSelection : ( value : string ) => void ;
1516} ;
1617
17- const RadioGroupParticipants = ( { handleSelection } : RadioGroupParticipantsProps ) => {
18+ const RadioGroupParticipants = ( {
19+ optionSelected,
20+ handleSelection,
21+ } : RadioGroupParticipantsProps ) => {
1822 const setSelectedTeam = useSetRecoilState ( createBoardTeam ) ;
1923
2024 const handleSelect = ( value : string ) => {
@@ -30,6 +34,7 @@ const RadioGroupParticipants = ({ handleSelection }: RadioGroupParticipantsProps
3034 defaultValue = "team"
3135 aria-label = "View density"
3236 onValueChange = { handleSelect }
37+ value = { optionSelected }
3338 >
3439 < Flex >
3540 < RadioGroupItem value = "team" id = "selectTeam" >
Original file line number Diff line number Diff line change @@ -33,12 +33,19 @@ const SelectParticipants = () => {
3333 useEffect ( ( ) => {
3434 const updateCheckedUser = usersList . map ( ( user ) => ( {
3535 ...user ,
36- isChecked : user . _id === session ?. user . id ,
36+ isChecked : user . _id === session ?. user . id || user . isChecked ,
3737 } ) ) ;
3838
3939 const users = updateCheckedUser . flatMap ( ( user ) =>
40- user . _id === session ?. user . id
41- ? [ { role : BoardUserRoles . RESPONSIBLE , user : user . _id , votesCount : 0 } ]
40+ user . isChecked
41+ ? [
42+ {
43+ role :
44+ user . _id === session ?. user . id ? BoardUserRoles . RESPONSIBLE : BoardUserRoles . MEMBER ,
45+ user : user . _id ,
46+ votesCount : 0 ,
47+ } ,
48+ ]
4249 : [ ] ,
4350 ) ;
4451 setUsersList ( updateCheckedUser ) ;
@@ -48,8 +55,6 @@ const SelectParticipants = () => {
4855 users,
4956 board : { ...prev . board , team : null } ,
5057 } ) ) ;
51-
52- // eslint-disable-next-line react-hooks/exhaustive-deps
5358 } , [ ] ) ;
5459
5560 return (
Original file line number Diff line number Diff line change 11import Flex from '@/components/Primitives/Flex' ;
2- import { useState } from 'react' ;
2+ import { Dispatch , SetStateAction } from 'react' ;
33import SelectTeam from '@/components/CreateBoard/RegularBoard/SelectTeam' ;
44import SelectParticipants from './SelectParticipants' ;
55import RadioGroupParticipants from './RadioGroupParticipants' ;
66
7- const ParticipantsTab = ( ) => {
8- const [ optionSelected , setOptionSelected ] = useState ( 'team' ) ;
7+ type Props = { optionSelected : string ; setOptionSelected : Dispatch < SetStateAction < string > > } ;
98
9+ const ParticipantsTab = ( { optionSelected, setOptionSelected } : Props ) => {
1010 const handleChangeOption = ( value : string ) => {
1111 setOptionSelected ( value ) ;
1212 } ;
1313
1414 return (
1515 < Flex direction = "column" css = { { width : '100%' , mb : '$20' , height : '$300' } } gap = "24" >
16- < RadioGroupParticipants handleSelection = { handleChangeOption } />
16+ < RadioGroupParticipants
17+ optionSelected = { optionSelected }
18+ handleSelection = { handleChangeOption }
19+ />
1720 { optionSelected === 'team' ? < SelectTeam /> : < SelectParticipants /> }
1821 </ Flex >
1922 ) ;
Original file line number Diff line number Diff line change @@ -11,11 +11,15 @@ import ParticipantsTab from '../ParticipantsTab';
1111import BoardConfigurations from '../../Configurations/BoardConfigurations' ;
1212
1313const SettingsTabs = ( ) => {
14+ const [ optionSelected , setOptionSelected ] = useState ( 'team' ) ;
15+
1416 const tabList : TabList [ ] = [
1517 {
1618 value : 'participants' ,
1719 label : 'Participants' ,
18- content : < ParticipantsTab /> ,
20+ content : (
21+ < ParticipantsTab optionSelected = { optionSelected } setOptionSelected = { setOptionSelected } />
22+ ) ,
1923 } ,
2024 {
2125 value : 'config' ,
You can’t perform that action at this time.
0 commit comments