<commit_before>import React from "react"

export default class Package extends React.Component{
  static get contextTypes(){
    return {router: React.PropTypes.object.isRequired}
  }
  lineStyle(){
    return {padding:"6px 18px 6px 18px",height:"auto"}
  }
  handleClick(key){
    if(key){ //Key exists only on longList items
      this.context.router.push(`/ui/repos/${this.props.repo}/packages/${this.props.name}?key=${encodeURIComponent(key)}`);
    }else{
      this.context.router.push(`/ui/repos/${this.props.repo}/packages/${this.props.name}`);
    }
  }
  buildItem(pack,index){
    var style = {
      height:"auto",
      cursor:"pointer",
      color: (pack.key && pack.key == this.props.activeKey)? "#ffffff":null
    }
    var classes = `package-line${(pack.key && pack.key == this.props.activeKey)?" mdl-color--primary":""}`
    return (<tr key={index} style={style} className={classes} onClick={(this.expand)?null:this.handleClick.bind(this,pack.key)}>
        <td style={this.lineStyle()} className="mdl-data-table__cell--non-numeric">{pack.arch}</td>
        <td style={this.lineStyle()} className="mdl-data-table__cell--non-numeric">{(index ==0)?this.props.name:""}</td>
        <td style={this.lineStyle()} className="mdl-data-table__cell--non-numeric">{pack.version}</td>
    </tr>)
  }
  getArchs(){
    return this.props.infos.reduce((archs,info)=>{
      if(archs.indexOf(info.arch) == -1){
        archs = archs + ((archs === "")?"":", ")+info.arch;
      }
      return archs;
    },"");
  }
  longList(){
    var elements = []
    for(let i=0;i<this.props.infos.length;i++){
      elements.push(this.buildItem(this.props.infos[i],i));
    }
    return (<tbody>{elements}</tbody>);
  }
  shortList(){
    return this.buildItem({version:this.props.infos[0].version,arch:this.getArchs()},0)
  }
  render(){<commit_msg>update colors for selected package in list<commit_after>import React from "react"

export default class Package extends React.Component{
  static get contextTypes(){
    return {router: React.PropTypes.object.isRequired}
  }
  lineStyle(){
    return {padding:"6px 18px 6px 18px",height:"auto"}
  }
  handleClick(key){
    if(key){ //Key exists only on longList items
      this.context.router.push(`/ui/repos/${this.props.repo}/packages/${this.props.name}?key=${encodeURIComponent(key)}`);
    }else{
      this.context.router.push(`/ui/repos/${this.props.repo}/packages/${this.props.name}`);
    }
  }
  buildItem(pack,index){
    var style = {
      height:"auto",
      cursor:"pointer",
      fontWeight: (pack.key && pack.key == this.props.activeKey)? "600":"inherit"
    }
    var classes = `package-line${(pack.key && pack.key == this.props.activeKey)?" mdl-color-text--primary":""}`
    return (<tr key={index} style={style} className={classes} onClick={(this.expand)?null:this.handleClick.bind(this,pack.key)}>
        <td style={this.lineStyle()} className="mdl-data-table__cell--non-numeric">{pack.arch}</td>
        <td style={this.lineStyle()} className="mdl-data-table__cell--non-numeric">{(index ==0)?this.props.name:""}</td>
        <td style={this.lineStyle()} className="mdl-data-table__cell--non-numeric">{pack.version}</td>
    </tr>)
  }
  getArchs(){
    return this.props.infos.reduce((archs,info)=>{
      if(archs.indexOf(info.arch) == -1){
        archs = archs + ((archs === "")?"":", ")+info.arch;
      }
      return archs;
    },"");
  }
  longList(){
    var elements = []
    for(let i=0;i<this.props.infos.length;i++){
      elements.push(this.buildItem(this.props.infos[i],i));
    }
    return (<tbody>{elements}</tbody>);
  }
  shortList(){
    return this.buildItem({version:this.props.infos[0].version,arch:this.getArchs()},0)
  }
  render(){
{'fraction_non_alphanumeric': 0.20300751879699247, 'fraction_numerical': 0.006713211600429645, 'mean_word_length': 3.7151898734177213, 'pattern_counts': {'":': 6, '<': 25, '<?xml version=': 0, '>': 25, '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': '7628680', 'n_tokens_mistral': 1274, 'n_tokens_neox': 1270, 'n_words': 183}