<commit_before>/*
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * @Author: <NAME> (<EMAIL>)
 * @Date: 2017-03-03 16:12:19
 * @Last Modified by: <NAME> (<EMAIL>)
 * @Last Modified time: 2017-03-03 16:13:11
 */

import * as React from 'react';
import { StyleSheet, css, StyleDeclaration } from "aphrodite";
import { BanesAndBoonsInfo } from "../../services/session/banesAndBoons";
import { events } from 'camelot-unchained';
import { styleConstants, colors } from '../../styleConstants';

const BANE = 'Bane';
const BOON = 'Boon';

export interface TraitSummaryStyle extends StyleDeclaration {
  addedSummaryContainer: React.CSSProperties;
  traitName: React.CSSProperties;
  traitPoints: React.CSSProperties;
  titleContainer: React.CSSProperties;
  traitDescription: React.CSSProperties;
  traitCategory: React.CSSProperties;
  traitIcon: React.CSSProperties;
  cancelTrait: React.CSSProperties;
}

export interface TraitSummaryProps {
  trait: BanesAndBoonsInfo;
  onCancelClick: Function;
  type: 'Bane' | 'Boon';
  onCancelRankTrait: Function;
  styles: Partial<TraitSummaryStyle>;
}

export const defaultTraitSummaryStyles: TraitSummaryStyle = {
  addedSummaryContainer: {
    position: 'relative',
    padding: '10px',
    marginTop: '15px',
    marginBottom: '15px',
    backgroundColor: 'rgba(49,49,49,0.7)',
    ...styleConstants.marginRight
  },

  traitName: {
    fontSize: '1.1em',
    marginBottom: 0,
    marginTop: 0
  },

  traitPoints: {
    margin: 0,
    color: 'orange'
  },

  titleContainer: {
    display: 'flex',
    alignItems: 'flex-start',
    justifyContent: 'space-between'
  },

  traitDescription: {
    color: '#CCC'
  },

  traitCategory: {
    color: '#777',
    marginTop: 0,
    marginBottom: '2px'
  },

  traitIcon: {
    width: '80px',
    height: '80px',
    border: '2px solid #ccc'
  },

  cancelTrait: {
    cursor: 'pointer',
    border: '1px solid #595959',
    padding: '2px 5px',
    textAlign: 'center',
    backgroundColor: 'rgba(49,49,49,0.7)',
    transition: 'background-color 0.5s',
    ':hover': {
      backgroundColor: '#a0241b'
    },
    ':active': {
      boxShadow: 'inset 0 0 5px rgba(0,0,0,0.5)'
    }
  }
};

class TraitSummary extends React.Component<TraitSummaryProps, {}> {
  private onCancelClick = () => {
    const { trait, onCancelClick, onCancelRankTrait } = this.props;
    events.fire('play-sound', 'select');
    if (trait.ranks) {
      if (trait.rank === 0) onCancelClick(trait);
      onCancelRankTrait(trait);
    } else {
      onCancelClick(trait);
    }
  };
  render() {
    const { trait, type, styles } = this.props;
    console.log(trait);
    const ss = StyleSheet.create(defaultTraitSummaryStyles);
    const custom = StyleSheet.create(styles || {});
    return (
      <div className={css(ss.addedSummaryContainer, custom.addedSummaryContainer)}>
        <div className={css(ss.titleContainer, custom.titleContainer)}>
          <div>
            <p className={css(ss.traitName, custom.traitName)}
             style={{ color: type === BOON ? colors.boonPrimary : colors.banePrimary }}>
              {trait.name}
            </p>
            <p className={css(ss.traitPoints, custom.traitPoints)}>
              Points: {type === BOON && '+'}{trait.points}
            </p>
            <p className={css(ss.traitCategory, custom.traitCategory)}>{trait.required ? 'Required' : trait.category} {type}</p>
          </div>
          <img className={css(ss.traitIcon, custom.traitIcon)} src={trait.icon} />
        </div>
        <p className={css(ss.traitDescription, custom.traitDescription)}>{trait.description}</p>
        {!trait.required && <div className={css(ss.cancelTrait)} onClick={this.onCancelClick}>
          Remove
        </div>}
      </div>
    )
  }
}

export default TraitSummary;
<commit_msg>Got rid of unneeded console log in b&b<commit_after>/*
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * @Author: <NAME> (<EMAIL>)
 * @Date: 2017-03-03 16:12:19
 * @Last Modified by: <NAME> (<EMAIL>)
 * @Last Modified time: 2017-03-03 16:13:11
 */

import * as React from 'react';
import { StyleSheet, css, StyleDeclaration } from "aphrodite";
import { BanesAndBoonsInfo } from "../../services/session/banesAndBoons";
import { events } from 'camelot-unchained';
import { styleConstants, colors } from '../../styleConstants';

const BANE = 'Bane';
const BOON = 'Boon';

export interface TraitSummaryStyle extends StyleDeclaration {
  addedSummaryContainer: React.CSSProperties;
  traitName: React.CSSProperties;
  traitPoints: React.CSSProperties;
  titleContainer: React.CSSProperties;
  traitDescription: React.CSSProperties;
  traitCategory: React.CSSProperties;
  traitIcon: React.CSSProperties;
  cancelTrait: React.CSSProperties;
}

export interface TraitSummaryProps {
  trait: BanesAndBoonsInfo;
  onCancelClick: Function;
  type: 'Bane' | 'Boon';
  onCancelRankTrait: Function;
  styles: Partial<TraitSummaryStyle>;
}

export const defaultTraitSummaryStyles: TraitSummaryStyle = {
  addedSummaryContainer: {
    position: 'relative',
    padding: '10px',
    marginTop: '15px',
    marginBottom: '15px',
    backgroundColor: 'rgba(49,49,49,0.7)',
    ...styleConstants.marginRight
  },

  traitName: {
    fontSize: '1.1em',
    marginBottom: 0,
    marginTop: 0
  },

  traitPoints: {
    margin: 0,
    color: 'orange'
  },

  titleContainer: {
    display: 'flex',
    alignItems: 'flex-start',
    justifyContent: 'space-between'
  },

  traitDescription: {
    color: '#CCC'
  },

  traitCategory: {
    color: '#777',
    marginTop: 0,
    marginBottom: '2px'
  },

  traitIcon: {
    width: '80px',
    height: '80px',
    border: '2px solid #ccc'
  },

  cancelTrait: {
    cursor: 'pointer',
    border: '1px solid #595959',
    padding: '2px 5px',
    textAlign: 'center',
    backgroundColor: 'rgba(49,49,49,0.7)',
    transition: 'background-color 0.5s',
    ':hover': {
      backgroundColor: '#a0241b'
    },
    ':active': {
      boxShadow: 'inset 0 0 5px rgba(0,0,0,0.5)'
    }
  }
};

class TraitSummary extends React.Component<TraitSummaryProps, {}> {
  private onCancelClick = () => {
    const { trait, onCancelClick, onCancelRankTrait } = this.props;
    events.fire('play-sound', 'select');
    if (trait.ranks) {
      if (trait.rank === 0) onCancelClick(trait);
      onCancelRankTrait(trait);
    } else {
      onCancelClick(trait);
    }
  };
  render() {
    const { trait, type, styles } = this.props;
    const ss = StyleSheet.create(defaultTraitSummaryStyles);
    const custom = StyleSheet.create(styles || {});
    return (
      <div className={css(ss.addedSummaryContainer, custom.addedSummaryContainer)}>
        <div className={css(ss.titleContainer, custom.titleContainer)}>
          <div>
            <p className={css(ss.traitName, custom.traitName)}
             style={{ color: type === BOON ? colors.boonPrimary : colors.banePrimary }}>
              {trait.name}
            </p>
            <p className={css(ss.traitPoints, custom.traitPoints)}>
              Points: {type === BOON && '+'}{trait.points}
            </p>
            <p className={css(ss.traitCategory, custom.traitCategory)}>{trait.required ? 'Required' : trait.category} {type}</p>
          </div>
          <img className={css(ss.traitIcon, custom.traitIcon)} src={trait.icon} />
        </div>
        <p className={css(ss.traitDescription, custom.traitDescription)}>{trait.description}</p>
        {!trait.required && <div className={css(ss.cancelTrait)} onClick={this.onCancelClick}>
          Remove
        </div>}
      </div>
    )
  }
}

export default TraitSummary;

{'fraction_non_alphanumeric': 0.14559919181714864, 'fraction_numerical': 0.023487814117944185, 'mean_word_length': 3.186046511627907, 'pattern_counts': {'":': 0, '<': 49, '<?xml version=': 0, '>': 51, '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': '20200', 'n_tokens_mistral': 2657, 'n_tokens_neox': 2583, 'n_words': 574}