<commit_before>/** Created by hhj on 3/17/16. */
/* eslint-disable max-len */
import React, { PropTypes } from 'react'
import colors from '../app/colors'
// import FlatButton from 'material-ui/lib/flat-button'
import IconButton from 'material-ui/lib/icon-button'
// import RaisedButton from 'material-ui/lib/raised-button'
// import FloatingButton from 'material-ui/lib/floating-action-button'
import Divider from 'material-ui/lib/divider'
import sortBy from 'lodash/sortBy'
import { List } from 'immutable'
import MarkedLokalita from './MarkedLokalita'
import NepiOpy from './NepiOpy'
import MyIcon from '../lib/MyIcon'
import './PotencialniUmisteni.styl'

export default class PotencialniUmisteni extends React.Component {
  static propTypes = {
    seznamUmisteni: PropTypes.instanceOf(List).isRequired,
    lokalitaHint: PropTypes.object.isRequired,
    umistiZarizeni: PropTypes.func.isRequired,
    deleteAllUmisteni: PropTypes.func.isRequired,
  };

  static defaultProps = {
    seznamUmisteni: List(),
  };

  render() {
    const { seznamUmisteni, lokalitaHint, umistiZarizeni, deleteAllUmisteni } = this.props
    const sortedSeznamUmisteni = sortBy(seznamUmisteni.toArray(), umisteni => -umisteni.lokalita.nepiOpy.size)

    return (
      <div>
        {
          sortedSeznamUmisteni.map(umisteni => <div key={umisteni.id}>
              <div className="umistovani adresa">
                <IconButton tooltip="Umístit!" style={{ padding: '0px' }} onTouchTap={ function () { umistiZarizeni(umisteni) } }>
                  <MyIcon color={colors.blue400}>done</MyIcon>
                </IconButton>
                <IconButton tooltip="Smazat!" onTouchTap={ function () { umistiZarizeni(umisteni) } }>
                  <MyIcon color={colors.blue400}>delete</MyIcon>
                </IconButton>
                <MarkedLokalita lokalitaHint={lokalitaHint} lokalita={umisteni.lokalita} key={umisteni.id} />
                <NepiOpy nepiOpy={umisteni.lokalita.nepiOpy} />
              </div>
              <Divider />
            </div>
          )
        }
        {
          sortedSeznamUmisteni.length > 0 ?
            <div style={{ paddingTop: '1em', display: 'flex', justifyContent: 'center' }}>
              <IconButton tooltip="Smazat všechna umístění" primary onTouchTap={ deleteAllUmisteni }><MyIcon color={colors.red300}>delete</MyIcon></IconButton>
            </div>
            : null
        }
      </div>
    )
  }
}<commit_msg>fix: delete potencialni umisteni does not work now<commit_after>/** Created by hhj on 3/17/16. */
/* eslint-disable max-len */
import React, { PropTypes } from 'react'
import colors from '../app/colors'
// import FlatButton from 'material-ui/lib/flat-button'
import IconButton from 'material-ui/lib/icon-button'
// import RaisedButton from 'material-ui/lib/raised-button'
// import FloatingButton from 'material-ui/lib/floating-action-button'
import Divider from 'material-ui/lib/divider'
import sortBy from 'lodash/sortBy'
import { List } from 'immutable'
import MarkedLokalita from './MarkedLokalita'
import NepiOpy from './NepiOpy'
import MyIcon from '../lib/MyIcon'
import './PotencialniUmisteni.styl'

export default class PotencialniUmisteni extends React.Component {
  static propTypes = {
    seznamUmisteni: PropTypes.instanceOf(List).isRequired,
    lokalitaHint: PropTypes.object.isRequired,
    umistiZarizeni: PropTypes.func.isRequired,
    deleteAllUmisteni: PropTypes.func.isRequired,
  };

  static defaultProps = {
    seznamUmisteni: List(),
  };

  render() {
    const { seznamUmisteni, lokalitaHint, umistiZarizeni, deleteAllUmisteni } = this.props
    const sortedSeznamUmisteni = sortBy(seznamUmisteni.toArray(), umisteni => -umisteni.lokalita.nepiOpy.size)

    return (
      <div>
        {
          sortedSeznamUmisteni.map(umisteni => <div key={umisteni.id}>
              <div className="umistovani adresa">
                <IconButton tooltip="Umístit!" style={{ padding: '0px' }} onTouchTap={ function () { umistiZarizeni(umisteni) } }>
                  <MyIcon color={colors.blue400}>done</MyIcon>
                </IconButton>
                {/* 
                <IconButton tooltip="Smazat!" onTouchTap={ function () { umistiZarizeni(umisteni) } }>
                  <MyIcon color={colors.blue400}>delete</MyIcon>
                </IconButton>
                */}
                <MarkedLokalita lokalitaHint={lokalitaHint} lokalita={umisteni.lokalita} key={umisteni.id} />
                <NepiOpy nepiOpy={umisteni.lokalita.nepiOpy} />
              </div>
              <Divider />
            </div>
          )
        }
        {
          sortedSeznamUmisteni.length > 0 ?
            <div style={{ paddingTop: '1em', display: 'flex', justifyContent: 'center' }}>
              <IconButton tooltip="Smazat všechna umístění" primary onTouchTap={ deleteAllUmisteni }><MyIcon color={colors.red300}>delete</MyIcon></IconButton>
            </div>
            : null
        }
      </div>
    )
  }
}
{'fraction_non_alphanumeric': 0.12614954018392643, 'fraction_numerical': 0.006797281087564974, 'mean_word_length': 2.7307979120059658, 'pattern_counts': {'":': 0, '<': 49, '<?xml version=': 0, '>': 55, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2642001', 'n_tokens_mistral': 1678, 'n_tokens_neox': 1637, 'n_words': 305}