@@ -17,11 +17,13 @@ import { isUndefined } from "src/utils";
17
17
import { Phases } from "components/Phase" ;
18
18
19
19
import { IBaseMaintenanceButton } from "." ;
20
+ import { Link } from "react-router-dom" ;
20
21
21
22
const StyledButton = styled ( Button ) `
22
23
width: 100%;
23
24
` ;
24
25
26
+ const StyledLabel = styled . label `` ;
25
27
interface IDrawButton extends IBaseMaintenanceButton {
26
28
numberOfVotes ?: string ;
27
29
period ?: string ;
@@ -40,6 +42,11 @@ const DrawButton: React.FC<IDrawButton> = ({ id, numberOfVotes, setIsOpen, perio
40
42
[ maintenanceData , isDrawn , phase , period ]
41
43
) ;
42
44
45
+ const needToPassPhase = useMemo (
46
+ ( ) => ! isUndefined ( maintenanceData ) && ! isDrawn && period === Period . Evidence && phase !== Phases . drawing ,
47
+ [ maintenanceData , isDrawn , phase , period ]
48
+ ) ;
49
+
43
50
const {
44
51
data : drawConfig ,
45
52
isLoading : isLoadingConfig ,
@@ -68,7 +75,17 @@ const DrawButton: React.FC<IDrawButton> = ({ id, numberOfVotes, setIsOpen, perio
68
75
setIsOpen ( false ) ;
69
76
} ) ;
70
77
} ;
71
- return < StyledButton text = "Draw" small isLoading = { isLoading } disabled = { isDisabled } onClick = { handleClick } /> ;
78
+ return (
79
+ < >
80
+ { needToPassPhase ? (
81
+ < StyledLabel >
82
+ Jurors can be drawn in < small > drawing</ small > phase.
83
+ < br /> Pass phase < Link to = "/courts/1/purpose/#maintenance" > here</ Link > .
84
+ </ StyledLabel >
85
+ ) : null }
86
+ < StyledButton text = "Draw" small isLoading = { isLoading } disabled = { isDisabled } onClick = { handleClick } />
87
+ </ >
88
+ ) ;
72
89
} ;
73
90
74
91
export default DrawButton ;
0 commit comments