<commit_before>import React from 'react';
import { Link } from 'react-router';
import { api } from '../config';
import T, {
  translate
} from './t';
import RowProperties from './road-table-row-properties';


const RowReadView = ({
  vpromm, properties, hasOSMData, language, shouldShowProperties,
  toggleProperties, showDeleteView, showEditView
}) => {
  return (
    <tr>
      <td className="table-properties-cell-view-buttons">
        <button
          type="button"
          className="collecticon-trash-bin"
          title={translate(language, 'Delete Road')}
          onClick={showDeleteView}
        />
        <button
          type="button"
          className="collecticon-pencil"
          title={translate(language, 'Edit Road')}
          onClick={showEditView}
        />
      </td>

      <td>{
        hasOSMData ? <strong>{vpromm}</strong> : vpromm
      }</td>

      <td className={hasOSMData ? 'added' : 'not-added'}>
        {hasOSMData &&
          <div className='a-table-actions'>

            <Link
              className='a-table-action'
              to={`/${language}/assets/road/${vpromm}/`}
            >
              <T>View</T>
            </Link>

            <Link
              className='a-table-action'
              to={{
                pathname: `/${language}/explore`,
                query: {
                  activeRoad: vpromm
                }
              }}
            >
              <T>Explore</T>
            </Link>

            <a
              className='a-table-action'
              href={`${api}/properties/roads/${vpromm}.geojson`}
              download
            >
              <T>Download</T>
            </a>

          </div>
        }
      </td>

      <td className='table-properties-cell'>
        {
          Object.keys(properties).length !== 0 &&
            <div>
              <button
                type='button'
                className={`button-table-expand ${shouldShowProperties ? 'button-table-expand--show' : 'button-table-expand--hide'}`}
                onClick={toggleProperties}
              >
                <span>{shouldShowProperties ? <T>Hide</T> : <T>Show</T>}</span>
              </button>
              {
                shouldShowProperties &&
                  <RowProperties
                    properties={properties}
                    roadId={vpromm}
                  />
              }
            </div>
        }
      </td>
    </tr>
  );
};

const RowEditView = ({
  vpromm, newRoadId, formIsInvalid, status, error,
  showReadView, updateNewRoadId, confirmEdit
}) => (
  <tr
    className="edit-row"
  >
    <td />
    <td
      colSpan="3"
    >
      <form
        onSubmit={confirmEdit}<commit_msg>Fix properties show-hide chevron direction, closes #325<commit_after>import React from 'react';
import { Link } from 'react-router';
import { api } from '../config';
import T, {
  translate
} from './t';
import RowProperties from './road-table-row-properties';


const RowReadView = ({
  vpromm, properties, hasOSMData, language, shouldShowProperties,
  toggleProperties, showDeleteView, showEditView
}) => {
  return (
    <tr>
      <td className="table-properties-cell-view-buttons">
        <button
          type="button"
          className="collecticon-trash-bin"
          title={translate(language, 'Delete Road')}
          onClick={showDeleteView}
        />
        <button
          type="button"
          className="collecticon-pencil"
          title={translate(language, 'Edit Road')}
          onClick={showEditView}
        />
      </td>

      <td>{
        hasOSMData ? <strong>{vpromm}</strong> : vpromm
      }</td>

      <td className={hasOSMData ? 'added' : 'not-added'}>
        {hasOSMData &&
          <div className='a-table-actions'>

            <Link
              className='a-table-action'
              to={`/${language}/assets/road/${vpromm}/`}
            >
              <T>View</T>
            </Link>

            <Link
              className='a-table-action'
              to={{
                pathname: `/${language}/explore`,
                query: {
                  activeRoad: vpromm
                }
              }}
            >
              <T>Explore</T>
            </Link>

            <a
              className='a-table-action'
              href={`${api}/properties/roads/${vpromm}.geojson`}
              download
            >
              <T>Download</T>
            </a>

          </div>
        }
      </td>

      <td className='table-properties-cell'>
        {
          Object.keys(properties).length !== 0 &&
            <div>
              <button
                type='button'
                className={`button-table-expand ${shouldShowProperties ? 'button-table-expand--hide' : 'button-table-expand--show'}`}
                onClick={toggleProperties}
              >
                <span>{shouldShowProperties ? <T>Hide</T> : <T>Show</T>}</span>
              </button>
              {
                shouldShowProperties &&
                  <RowProperties
                    properties={properties}
                    roadId={vpromm}
                  />
              }
            </div>
        }
      </td>
    </tr>
  );
};

const RowEditView = ({
  vpromm, newRoadId, formIsInvalid, status, error,
  showReadView, updateNewRoadId, confirmEdit
}) => (
  <tr
    className="edit-row"
  >
    <td />
    <td
      colSpan="3"
    >
      <form
        onSubmit={confirmEdit}
{'fraction_non_alphanumeric': 0.1393950437317784, 'fraction_numerical': 0.0012755102040816326, 'mean_word_length': 1.4244699646643109, 'pattern_counts': {'":': 0, '<': 89, '<?xml version=': 0, '>': 91, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1781735', 'n_tokens_mistral': 1564, 'n_tokens_neox': 1519, 'n_words': 255}