{"size": 2408, "ext": "js", "max_stars_repo_path": "src/components/TaskFilters/TaskReviewStatusFilter.js", "max_stars_repo_name": "mvexel/maproulette3", "max_stars_repo_stars_event_min_datetime": "2018-05-14T02:58:14.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-01T05:01:53.000Z", "max_issues_repo_path": "src/components/TaskFilters/TaskReviewStatusFilter.js", "max_issues_repo_name": "mvexel/maproulette3", "max_issues_repo_issues_event_min_datetime": "2018-05-11T05:29:07.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-31T22:25:14.000Z", "max_forks_repo_path": "src/components/TaskFilters/TaskReviewStatusFilter.js", "max_forks_repo_name": "mvexel/maproulette3", "max_forks_repo_forks_event_min_datetime": "2018-07-08T22:36:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-18T21:17:11.000Z"}
{"max_stars_count": 78, "max_issues_count": 478, "max_forks_count": 29, "avg_line_length": 35.4117647059, "max_line_length": 85, "alphanum_fraction": 0.551910299}
import React, { Component } from 'react'
import { FormattedMessage } from 'react-intl'
import FilterDropdown from './FilterDropdown'
import _map from 'lodash/map'
import { TaskReviewStatusWithUnset,
        messagesByReviewStatus,
        TaskMetaReviewStatusWithUnset,
        messagesByMetaReviewStatus }
      from '../../services/Task/TaskReview/TaskReviewStatus'
import messages from './Messages'


/**
 * TaskReviewStatusFilter builds a dropdown for searching by task review status
 *
 * @author [Kelli Rotstan](https://github.com/krotstan)
 */
export default class TaskReviewStatusFilter extends Component {
  render() {

    const metaReviewStatusFilter =
      !this.props.metaReviewEnabled ? {} : {
        secondaryFilterLabel:
          this.props.intl.formatMessage(messages.filterByReviewStatusLabel),
        secondaryFilters:
          _map(TaskMetaReviewStatusWithUnset, status => (
            <li key={`meta-${status}`}>
              <label className="mr-flex mr-items-center">
                <input
                  className="mr-checkbox-toggle mr-mr-2"
                  type="checkbox"
                  checked={this.props.includeMetaReviewStatuses[status]}
                  onChange={(e) =>
                    this.props.toggleIncludedMetaReviewStatus(status,
                                                              e.nativeEvent.shiftKey)
                  } />
                <FormattedMessage {...messagesByMetaReviewStatus[status]} />
              </label>
            </li>
          ))
        }

    return (
      <FilterDropdown
        title={<FormattedMessage {...messages.filterByReviewStatusLabel} />}
        filters={
          _map(TaskReviewStatusWithUnset, status => (
            <li key={status}>
              <label className="mr-flex mr-items-center">
                <input
                  className="mr-checkbox-toggle mr-mr-2"
                  type="checkbox"
                  checked={this.props.includeTaskReviewStatuses[status]}
                  onChange={(e) =>
                    this.props.toggleIncludedTaskReviewStatus(status,
                                                              e.nativeEvent.shiftKey)
                  } />
                <FormattedMessage {...messagesByReviewStatus[status]} />
              </label>
            </li>
          ))
        }
        {...metaReviewStatusFilter}
      />
    )
  }
}
