<commit_before>import React from 'react';
import PureRenderMixin from 'react-addons-pure-render-mixin';

import LocalClient from '../stores/local-client.stores.jsx';

export default class AlternateMenu extends React.PureComponent {
	constructor(props) {
		super(props);
	}

	render() {

		const alternates = _.map(this.props.alternates, (alt, index) => {
			return <Alternate id={index} alt={alt} key={index} unicode={this.props.unicode}/>;
		});

		return (
			<div className="canvas-menu-item alternate-menu">
				<div className="alternate-menu-list">
					{alternates}
				</div>
				<div className="alternate-menu-label">Alternates</div>
			</div>
		);
	}
}

class Alternate extends React.PureComponent {
	constructor(props) {
		super(props);
		this.selectAlternate = this.selectAlternate.bind(this);
		this.img = '';
	}

	componentWillMount() {
		this.client = LocalClient.instance();
	}

	componentWillReceiveProps(nextProps) {
		if (nextProps.alt && nextProps.alt.altImg) {
			this.img = `assets/images/${nextProps.alt.altImg}`;
		}
	}

	selectAlternate() {
		this.client.dispatchAction('/set-alternate', {unicode: this.props.unicode, glyphName: this.props.alt.name, relatedGlyphs: this.props.alt.src.relatedGlyphs});
	}

	render() {
		return (
			<div className="alternate" onClick={this.selectAlternate}>
				<img src={this.img}/>
			</div>
		);
	}
}<commit_msg>fix #505<commit_after>import React from 'react';

import LocalClient from '../stores/local-client.stores.jsx';

export default class AlternateMenu extends React.PureComponent {
	constructor(props) {
		super(props);
	}

	render() {

		const alternates = _.map(this.props.alternates, (alt, index) => {
			const img = `assets/images/${alt.altImg}`;

			return <Alternate id={index} alt={alt} img={img} key={index} unicode={this.props.unicode}/>;
		});

		return (
			<div className="canvas-menu-item alternate-menu">
				<div className="alternate-menu-list">
					{alternates}
				</div>
				<div className="alternate-menu-label">Alternates</div>
			</div>
		);
	}
}

class Alternate extends React.PureComponent {
	constructor(props) {
		super(props);
		this.selectAlternate = this.selectAlternate.bind(this);
	}

	componentWillMount() {
		this.client = LocalClient.instance();
	}

	selectAlternate() {
		this.client.dispatchAction('/set-alternate', {unicode: this.props.unicode, glyphName: this.props.alt.name, relatedGlyphs: this.props.alt.src.relatedGlyphs});
	}

	render() {
		return (
			<div className="alternate" onClick={this.selectAlternate}>
				<img src={this.props.img}/>
			</div>
		);
	}
}
{'fraction_non_alphanumeric': 0.161804745235317, 'fraction_numerical': 0.0011668611435239206, 'mean_word_length': 4.217038539553752, 'pattern_counts': {'":': 0, '<': 23, '<?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': '4664553', 'n_tokens_mistral': 983, 'n_tokens_neox': 863, 'n_words': 148}