{"size": 4498, "ext": "js", "max_stars_repo_path": "src/utils/case_utils/case_columns.js", "max_stars_repo_name": "Lambda-School-Labs/human-rights-first-asylim-fe-a", "max_stars_repo_stars_event_min_datetime": "2021-01-28T16:06:25.000Z", "max_stars_repo_stars_event_max_datetime": "2021-09-27T19:43:39.000Z", "max_issues_repo_path": "src/utils/case_utils/case_columns.js", "max_issues_repo_name": "asylum-hrf-project/FrontEnd", "max_issues_repo_issues_event_min_datetime": "2020-12-09T22:36:35.000Z", "max_issues_repo_issues_event_max_datetime": "2021-10-18T23:00:20.000Z", "max_forks_repo_path": "src/utils/case_utils/case_columns.js", "max_forks_repo_name": "asylum-hrf-project/FrontEnd", "max_forks_repo_forks_event_min_datetime": "2021-01-02T22:38:08.000Z", "max_forks_repo_forks_event_max_datetime": "2021-10-04T18:18:38.000Z"}
{"max_stars_count": 8, "max_issues_count": 67, "max_forks_count": 57, "avg_line_length": 28.6496815287, "max_line_length": 79, "alphanum_fraction": 0.6002667852}
import React from 'react';

import { formatDate } from '../format_date_util';
export function case_columns(
  getColumnSearchProps,
  match_tag_value_with_column_key,
  Link,
  popUpDetails,
  FileTextOutlined,
  FilePdfOutlined
) {
  const columns = [
    {
      title: 'Case Details',
      dataIndex: 'case_row',
      key: 'x',
      render: text => <FileTextOutlined onClick={() => popUpDetails(text)} />,
    },
    {
      title: 'Case Date',
      dataIndex: 'decision_date',
      key: 'decision_date',
      sorter: (a, b) => a.decision_date.localeCompare(b.decision_date),
      sortDirections: ['descend', 'ascend'],
      ...getColumnSearchProps(
        'decision_date',
        match_tag_value_with_column_key.key
      ),
      render: text => formatDate(text),
    },
    {
      title: 'Judge Name',
      dataIndex: 'judge_name',
      key: 'judge_name',
      sorter: (a, b) => a.last_name.localeCompare(b.last_name),
      sortDirections: ['descend', 'ascend'],
      ...getColumnSearchProps(
        'judge_name',
        match_tag_value_with_column_key.key
      ),
      render: (text, record) => (
        <Link to={`/judge/${record.judge_id}`}>{text}</Link>
      ),
    },
    {
      title: 'Origin City',
      dataIndex: 'case_origin_city',
      key: 'case_origin_city',
      sorter: (a, b) => a.case_origin_city.localeCompare(b.case_origin_city),
      sortDirections: ['descend', 'ascend'],
      ...getColumnSearchProps(
        'case_origin_city',
        match_tag_value_with_column_key.key
      ),
    },
    {
      title: 'Origin State',
      dataIndex: 'case_origin_state',
      key: 'case_origin_state',
      sorter: (a, b) => a.case_origin_state.localeCompare(b.case_origin_state),
      sortDirections: ['descend', 'ascend'],
      ...getColumnSearchProps(
        'case_origin_state',
        match_tag_value_with_column_key.key
      ),
    },
    {

      title: 'Filed within One Year',
      dataIndex: 'check_for_one_year',
      key: 'check_for_one_year',
      sorter: (a, b) =>
        a.check_for_one_year.localeCompare(b.check_for_one_year),
      sortDirections: ['descend', 'ascend'],
      ...getColumnSearchProps(
        'check_for_one_year',
        match_tag_value_with_column_key.key
      ),
    },
    {
      title: 'Protected Grounds',
      dataIndex: 'protected_grounds',
      key: 'protected_grounds',
      sorter: (a, b) => a.protected_grounds.localeCompare(b.protected_grounds),
      sortDirections: ['descend', 'ascend'],
      ...getColumnSearchProps(
        'protected_grounds',
        match_tag_value_with_column_key.key
      ),
    },
    {
      title: 'Outcome',
      dataIndex: 'outcome',
      key: 'outcome',
      sorter: (a, b) => a.outcome.localeCompare(b.outcome),
      sortDirections: ['descend', 'ascend'],
      ...getColumnSearchProps('outcome', match_tag_value_with_column_key.key),
    },
    {
      title: 'Country of Origin',
      dataIndex: 'country_of_origin',
      key: 'country_of_origin',
      sorter: (a, b) => a.country_of_origin.localeCompare(b.country_of_origin),
      sortDirections: ['descend', 'ascend'],
      ...getColumnSearchProps(
        'country_of_origin',
        match_tag_value_with_column_key.key
      ),
    },
    {
      title: 'Applicant Gender',
      dataIndex: 'gender',
      key: 'gender',
      sorter: (a, b) => a.gender.localeCompare(b.gender),
      sortDirections: ['descend', 'ascend'],
      ...getColumnSearchProps('gender', match_tag_value_with_column_key.key),
    },
    {
      title: 'Persecution Experienced',
      dataIndex: 'type_of_persecution',
      key: 'type_of_persecution',
      sorter: (a, b) =>
        a.type_of_persecution.localeCompare(b.type_of_persecution),
      sortDirections: ['descend', 'ascend'],
      ...getColumnSearchProps(
        'type_of_persecution',
        match_tag_value_with_column_key.key
      ),
    },
    {
      title: 'Applicant Language',
      dataIndex: 'applicant_language',
      key: 'applicant_language',
      sorter: (a, b) =>
        a.applicant_language.localeCompare(b.applicant_language),
      sortDirections: ['descend', 'ascend'],
      ...getColumnSearchProps(
        'applicant_language',
        match_tag_value_with_column_key.key
      ),
    },
    {
      title: 'Download PDF',
      dataIndex: 'url',
      key: 'url',
      render: text => (
        <a href={text}>
          {' '}
          <FilePdfOutlined />
        </a>
      ),
    },
  ];

  return columns;
}
