11import { useState } from "react"
22import { Button , Modal , Space , Input } from "antd"
33
4- import { Review } from "../models"
4+ import { Review , ReviewStatusEnum } from "../models"
55
66const { TextArea } = Input
77
88interface ReviewModalProps {
99 review : Review
1010 onClickApprove ( comment : string ) : void
11+ onClickApproveAndDeploy ( comment : string ) : void
1112 onClickReject ( comment : string ) : void
1213}
1314
@@ -29,6 +30,11 @@ export default function ReviewModal(props: ReviewModalProps): JSX.Element {
2930 setIsModalVisible ( false )
3031 }
3132
33+ const onClickApproveAndDeploy = ( ) => {
34+ props . onClickApproveAndDeploy ( comment )
35+ setIsModalVisible ( false )
36+ }
37+
3238 const onClickReject = ( ) => {
3339 props . onClickReject ( comment )
3440 setIsModalVisible ( false )
@@ -46,16 +52,22 @@ export default function ReviewModal(props: ReviewModalProps): JSX.Element {
4652 onCancel = { onClickCancel }
4753 footer = {
4854 < 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 >
5057 < Button type = "primary" onClick = { onClickApprove } > Approve</ Button >
5158 </ Space >
5259 }
5360 >
5461 < TextArea rows = { 3 } onChange = { onChangeComment } value = { comment } />
5562 </ 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+ }
5971 </ >
6072 )
6173
0 commit comments