@@ -79,7 +79,19 @@ function AdminTraineeDashboard() {
7979 const [ gitHubStatistics , setGitHubStatistics ] = useState < any > ( { } ) ;
8080 const { traineeData, setAllTrainees } = useTraineesContext ( ) ;
8181 const [ actionTraineeOptions , setActionTraineeOptions ] = useState < any > ( null ) ;
82+ const modalRef = useRef < any > ( null ) ;
8283
84+ useEffect ( ( ) => {
85+ const handleClickOutside = ( event : any ) => {
86+ if ( modalRef . current && ! modalRef . current . contains ( event . target ) ) {
87+ setSelectedRow ( null ) ;
88+ }
89+ } ;
90+ document . addEventListener ( 'mousedown' , handleClickOutside ) ;
91+ return ( ) => {
92+ document . removeEventListener ( 'mousedown' , handleClickOutside ) ;
93+ } ;
94+ } , [ modalRef ] ) ;
8395 function PaperComponent ( props : PaperProps ) {
8496 return (
8597 < Draggable
@@ -278,7 +290,9 @@ function AdminTraineeDashboard() {
278290 onClick = { ( ) => toggleOptions ( row . original . email ) }
279291 />
280292 { selectedRow === row . original . email && (
281- < div className = "dropdown absolute right-4 mt-2 w-64 bg-light-bg max-h-30 dark:bg-dark-bg border border-gray-300 shadow-md z-50 p-4 rounded-lg overflow-hidden" >
293+ < div
294+ ref = { modalRef }
295+ className = "dropdown absolute right-4 mt-2 w-64 bg-light-bg max-h-30 dark:bg-dark-bg border border-gray-300 shadow-md z-50 p-4 rounded-lg overflow-hidden" >
282296 < >
283297 < div className = "mb-4" > </ div >
284298 < div className = "mb-4" >
@@ -1011,7 +1025,7 @@ function AdminTraineeDashboard() {
10111025 data-testid = "removeInviteModel"
10121026 variant = "info"
10131027 size = "sm"
1014- style = "w-[20 %] md:w-1/4 text-sm font-sans"
1028+ style = "w-[40 %] md:w-1/4 text-sm font-sans"
10151029 onClick = { ( ) => handleClose ( ) }
10161030 >
10171031 { t ( 'Close' ) }
@@ -1069,7 +1083,7 @@ function AdminTraineeDashboard() {
10691083 data-testid = "removeInviteModel"
10701084 variant = "info"
10711085 size = "sm"
1072- style = "w-[30 %] md:w-1/4 text-sm font-sans"
1086+ style = "w-[40 %] md:w-1/4 text-sm font-sans"
10731087 onClick = { ( ) => inviteModel ( ) }
10741088 >
10751089 { t ( 'Cancel' ) }
@@ -1078,7 +1092,7 @@ function AdminTraineeDashboard() {
10781092 < Button
10791093 variant = "primary"
10801094 size = "sm"
1081- style = "w-[30 %] md:w-1/4 text-sm font-sans"
1095+ style = "w-[40 %] md:w-1/4 text-sm font-sans"
10821096 onClick = { HandleInvite }
10831097 loading = { buttonLoading }
10841098 >
@@ -1157,15 +1171,15 @@ function AdminTraineeDashboard() {
11571171 data-testid = "removeModel1"
11581172 variant = "info"
11591173 size = "sm"
1160- style = "w-[30 %] md:w-1/4 text-sm font-sans"
1174+ style = "w-[40 %] md:w-1/4 text-sm font-sans"
11611175 onClick = { ( ) => removeEditModel ( ) }
11621176 >
11631177 { t ( 'Cancel' ) }
11641178 </ Button >
11651179 < Button
11661180 variant = "primary"
11671181 size = "sm"
1168- style = "w-[30 %] md:w-1/4 text-sm font-sans"
1182+ style = "w-[40 %] md:w-1/4 text-sm font-sans"
11691183 onClick = { ( ) => {
11701184 setButtonLoading ( true ) ;
11711185 setButtonLoading ( true ) ;
@@ -1215,7 +1229,7 @@ function AdminTraineeDashboard() {
12151229 data-testid = "removeModel2"
12161230 variant = "info"
12171231 size = "sm"
1218- style = "w-[30 %] md:w-1/4 text-sm font-sans"
1232+ style = "w-[40 %] md:w-1/4 text-sm font-sans"
12191233 onClick = { ( ) => removeTraineeMod ( ) }
12201234 >
12211235 { t ( 'Cancel' ) }
@@ -1224,7 +1238,7 @@ function AdminTraineeDashboard() {
12241238 variant = "primary"
12251239 size = "sm"
12261240 data-testid = "removeMemberFromCohort"
1227- style = "w-[30 %] md:w-1/4 text-sm font-sans"
1241+ style = "w-[40 %] md:w-1/4 text-sm font-sans"
12281242 onClick = { ( ) => {
12291243 setButtonLoading ( true ) ;
12301244 if ( deleteEmail && deleteFromCohort ) {
@@ -1302,7 +1316,7 @@ function AdminTraineeDashboard() {
13021316 data-testid = "dropModel"
13031317 variant = "info"
13041318 size = "sm"
1305- style = "w-[30 %] md:w-1/4 text-sm font-sans"
1319+ style = "w-[40 %] md:w-1/4 text-sm font-sans"
13061320 onClick = { ( ) => setDropTraineeModel ( false ) }
13071321 >
13081322 { t ( 'Cancel' ) }
@@ -1312,7 +1326,7 @@ function AdminTraineeDashboard() {
13121326 variant = "primary"
13131327 size = "sm"
13141328 data-testid = "dropMemberFromCohort"
1315- style = "w-[30 %] md:w-1/4 text-sm font-sans"
1329+ style = "w-[40 %] md:w-1/4 text-sm font-sans"
13161330 onClick = { ( ) => {
13171331 setButtonLoading ( true ) ;
13181332
@@ -1403,7 +1417,7 @@ function AdminTraineeDashboard() {
14031417 data-testid = "removeModel"
14041418 variant = "info"
14051419 size = "sm"
1406- style = "w-[30 %] md:w-1/4 text-sm font-sans"
1420+ style = "w-[40 %] md:w-1/4 text-sm font-sans"
14071421 onClick = { ( ) => removeModel ( ) }
14081422 >
14091423 { t ( 'Cancel' ) }
@@ -1412,7 +1426,7 @@ function AdminTraineeDashboard() {
14121426 variant = "primary"
14131427 size = "sm"
14141428 data-testid = "saveButton"
1415- style = "w-[30 %] md:w-1/4 text-sm font-sans"
1429+ style = "w-[40 %] md:w-1/4 text-sm font-sans"
14161430 onClick = { ( ) => {
14171431 if (
14181432 Object . values ( email ) [ 1 ] &&
0 commit comments