1
- import React from 'react' ;
1
+ import React , { useEffect , useState } from 'react' ;
2
2
3
3
import { Button } from 'src/app-components/Button/Button' ;
4
4
import { Lang } from 'src/features/language/Lang' ;
@@ -13,6 +13,18 @@ type AwaitingOtherSignaturesPanelProps = {
13
13
14
14
export function AwaitingOtherSignaturesPanel ( { node, hasSigned } : AwaitingOtherSignaturesPanelProps ) {
15
15
const textResourceBindings = useNodeItem ( node , ( i ) => i . textResourceBindings ) ;
16
+ const [ userTriedToSubmit , setUserTriedToSubmit ] = useState < boolean > ( false ) ;
17
+
18
+ useEffect ( ( ) => {
19
+ if ( userTriedToSubmit ) {
20
+ // remove error message after 10 seconds
21
+ const timer = setTimeout ( ( ) => {
22
+ setUserTriedToSubmit ( false ) ;
23
+ } , 10000 ) ;
24
+
25
+ return ( ) => clearTimeout ( timer ) ;
26
+ }
27
+ } , [ userTriedToSubmit ] ) ;
16
28
17
29
const heading =
18
30
textResourceBindings ?. awaitingOtherSignaturesPanelTitle ?? 'signing.awaiting_other_signatures_panel_title' ;
@@ -22,18 +34,20 @@ export function AwaitingOtherSignaturesPanel({ node, hasSigned }: AwaitingOtherS
22
34
const descriptionSigned =
23
35
textResourceBindings ?. awaitingOtherSignaturesPanelDescriptionSigned ??
24
36
'signing.awaiting_other_signatures_panel_description_signed' ;
37
+ const errorMessage = 'signing.awaiting_other_signatures_panel_error_message' ;
25
38
26
39
return (
27
40
< SigningPanel
28
41
node = { node }
29
42
variant = { hasSigned ? 'success' : 'info' }
30
43
heading = { < Lang id = { heading } /> }
31
44
description = { < Lang id = { hasSigned ? descriptionSigned : descriptionNotSigning } /> }
45
+ errorMessage = { userTriedToSubmit ? < Lang id = { errorMessage } /> : undefined }
32
46
actionButton = {
33
47
< Button
34
48
size = 'md'
35
49
color = 'success'
36
- disabled
50
+ onClick = { ( ) => setUserTriedToSubmit ( true ) }
37
51
>
38
52
< Lang id = 'signing.submit_button' />
39
53
</ Button >
0 commit comments