1
1
import { useState } from "react"
2
2
import { Button , Modal , Space , Input } from "antd"
3
3
4
- import { Review } from "../models"
4
+ import { Review , ReviewStatusEnum } from "../models"
5
5
6
6
const { TextArea } = Input
7
7
8
8
interface ReviewModalProps {
9
9
review : Review
10
10
onClickApprove ( comment : string ) : void
11
+ onClickApproveAndDeploy ( comment : string ) : void
11
12
onClickReject ( comment : string ) : void
12
13
}
13
14
@@ -29,6 +30,11 @@ export default function ReviewModal(props: ReviewModalProps): JSX.Element {
29
30
setIsModalVisible ( false )
30
31
}
31
32
33
+ const onClickApproveAndDeploy = ( ) => {
34
+ props . onClickApproveAndDeploy ( comment )
35
+ setIsModalVisible ( false )
36
+ }
37
+
32
38
const onClickReject = ( ) => {
33
39
props . onClickReject ( comment )
34
40
setIsModalVisible ( false )
@@ -46,16 +52,22 @@ export default function ReviewModal(props: ReviewModalProps): JSX.Element {
46
52
onCancel = { onClickCancel }
47
53
footer = {
48
54
< Space >
49
- < Button onClick = { onClickReject } > Reject</ Button >
55
+ < Button type = "primary" danger onClick = { onClickReject } > Reject</ Button >
56
+ < Button type = "primary" onClick = { onClickApproveAndDeploy } > Approve and Deploy</ Button >
50
57
< Button type = "primary" onClick = { onClickApprove } > Approve</ Button >
51
58
</ Space >
52
59
}
53
60
>
54
61
< TextArea rows = { 3 } onChange = { onChangeComment } value = { comment } />
55
62
</ Modal >
56
- < Button type = "primary" onClick = { showModal } >
57
- Review
58
- </ Button >
63
+ { ( props . review . status === ReviewStatusEnum . Pending ) ?
64
+ < Button type = "primary" onClick = { showModal } >
65
+ Review
66
+ </ Button > :
67
+ < Button onClick = { showModal } >
68
+ Reviewed
69
+ </ Button >
70
+ }
59
71
</ >
60
72
)
61
73
0 commit comments