Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | 5x 161x 161x 24x 24x 21x 24x 24x 161x 7x 7x 161x 17x | import React, { useState } from "react";
import { Modal, Button, Form } from "react-bootstrap";
const ReviewModeratorModal = ({ isOpen, onClose, status, onSubmit }) => {
// Stryker disable next-line StringLiteral
const [moderatorComment, setModeratorComment] = useState("");
const handleSubmit = (e) => {
e.preventDefault();
if (status === "APPROVED" || status === "REJECTED") {
onSubmit({ status, moderatorComment });
}
// Stryker disable next-line StringLiteral
setModeratorComment("");
onClose();
};
const handleClose = () => {
// Stryker disable next-line StringLiteral
setModeratorComment("");
onClose();
};
const isApproved = status === "APPROVED";
return (
<Modal
data-testid={"review-moderator-modal"}
show={isOpen}
onHide={handleClose}
>
<Modal.Body>
<Form onSubmit={handleSubmit}>
<Form.Group
data-testid="review-moderator-modal-closeGroup"
// Stryker disable all
style={{ display: "flex", justifyContent: "right" }}
// Stryker restore all
></Form.Group>
<Form.Group>
<Form.Label>
{/* Stryker disable next-line StringLiteral */}
You are about to{" "}
<strong>
{status === "APPROVED" ? "APPROVE" : "REJECT"}
</strong>{" "}
this review. Please add a moderator comment below.
</Form.Label>
</Form.Group>
<Form.Group>
<Form.Control
data-testid="review-moderation-modal-comment"
as="textarea"
rows={4}
placeholder="Enter moderator comment..."
value={moderatorComment}
onChange={(e) => setModeratorComment(e.target.value)}
/>
</Form.Group>
</Form>
</Modal.Body>
<Modal.Footer
data-testid={"review-moderator-modal-footer"}
// Stryker disable all
style={{ borderTop: "0px" }}
// Stryker restore all
>
<Button
data-testid={"review-moderator-modal-cancel"}
variant="secondary"
onClick={handleClose}
>
Cancel
</Button>
<Button
data-testid="review-moderation-modal-submit"
variant={isApproved ? "success" : "danger"}
onClick={handleSubmit}
>
{isApproved ? "Approve" : "Reject"}
</Button>
</Modal.Footer>
</Modal>
);
};
export default ReviewModeratorModal;
|