renderReviewModal()

in assets/src/modules/signup/Home.tsx [356:406]


  renderReviewModal() {
    const { review } = this.state;
    return (
      <Modal
        show={this.state.showReviewModal}
        onHide={() => this.handleToggleReviewModal(false)}
        aria-labelledby="contained-modal-title"
        id="contained-modal">
        <Modal.Header closeButton>
          <Modal.Title id="contained-modal-title">{ review.stationName }</Modal.Title>
        </Modal.Header>
        <Modal.Body>
          <h5 className="modal-prompt">Write a review:</h5>
          <Form>
            <Form.Control as="textarea" rows={4} value={review.review} onChange={this.handleReviewChange} />
          </Form>
        </Modal.Body>
        <Modal.Footer>
          <Button
            type="button"
            variant="danger"
            className="uniform-width"
            disabled={!this.validateReviewForm()}
            onClick={this.handleReviewSubmitClick}>
            {this.state.isUpdating ?
              <span><Spinner size="sm" animation="border" className="mr-2" />Updating</span> :
              <span>Submit</span>}
            </Button>
        </Modal.Footer>
        <Modal.Body>
          {
            this.state.isLoading ?
              <Spinner animation="border" className="center-spinner" /> :
              (this.state.reviews.length === 0) ?
                <div className="text-center">This bike station does not have any reviews.</div> :
                <Table variant="light">
                <thead>
                  <tr>
                    <th>Date</th>
                    <th>Review</th>
                  </tr>
                </thead>
                <tbody>
                  { this.renderReviewsList(this.state.reviews) }
                </tbody>
                </Table>
          }
        </Modal.Body>
      </Modal>
    );
  }