<commit_before>import baseTheme from 'material-ui/styles/baseThemes/lightBaseTheme';
import getMuiTheme from 'material-ui/styles/getMuiTheme';
import IconButton from 'material-ui/IconButton';
import FlatButton from 'material-ui/FlatButton';
import RaisedButton from 'material-ui/RaisedButton';

ContextPanel = React.createClass({

	propTypes: {
		open: React.PropTypes.bool.isRequired,
		commentGroup: React.PropTypes.object.isRequired,
		closeContextPanel: React.PropTypes.func.isRequired,
		scrollPosition: React.PropTypes.number.isRequired,
		commentLemmaIndex: React.PropTypes.number.isRequired,
	},

	childContextTypes: {
		muiTheme: React.PropTypes.object.isRequired,
	},

	mixins: [ReactMeteorData],

	getInitialState() {
		const commentGroup = this.props.commentGroup;
		const lineFrom = commentGroup.lineFrom;
		const lineTo = lineFrom + 49;
		return {
			selectedLemmaEdition: '',
			lineFrom,
			lineTo,
			maxLine: 0,
			highlightingVisible: true,
		};
	},

	getChildContext() {
		return { muiTheme: getMuiTheme(baseTheme) };
	},

	componentDidMount() {
		// this.scrollElement('open');
		Meteor.call('getMaxLine', this.props.commentGroup.work.slug,
			this.props.commentGroup.subwork.n, (err, res) => {
				if (err) {
					console.log(err);
				} else if (res) {
					const linePagination = [];
					for (let i = 1; i <= res; i += 100) {
						linePagination.push(i);
					}

					this.setState({
						linePagination,
						maxLine: res,
					});
				}
			}
		);
	},

	componentDidUpdate(prevProps) {
		// this.scrollElement('open');
		const commentGroup = this.props.commentGroup;
		if (commentGroup.ref !== prevProps.commentGroup.ref) {
			this.setState({
				lineFrom: commentGroup.lineFrom,
				lineTo: commentGroup.lineFrom + 49,
			});
		}
	},

	componentWillUnmount() {
		// this.scrollElement('close');
	},<commit_msg>Scrolling to comment group top only on content panel open<commit_after>import baseTheme from 'material-ui/styles/baseThemes/lightBaseTheme';
import getMuiTheme from 'material-ui/styles/getMuiTheme';
import IconButton from 'material-ui/IconButton';
import FlatButton from 'material-ui/FlatButton';
import RaisedButton from 'material-ui/RaisedButton';

ContextPanel = React.createClass({

	propTypes: {
		open: React.PropTypes.bool.isRequired,
		commentGroup: React.PropTypes.object.isRequired,
		closeContextPanel: React.PropTypes.func.isRequired,
		scrollPosition: React.PropTypes.number.isRequired,
		commentLemmaIndex: React.PropTypes.number.isRequired,
	},

	childContextTypes: {
		muiTheme: React.PropTypes.object.isRequired,
	},

	mixins: [ReactMeteorData],

	getInitialState() {
		const commentGroup = this.props.commentGroup;
		const lineFrom = commentGroup.lineFrom;
		const lineTo = lineFrom + 49;
		return {
			selectedLemmaEdition: '',
			lineFrom,
			lineTo,
			maxLine: 0,
			highlightingVisible: true,
		};
	},

	getChildContext() {
		return { muiTheme: getMuiTheme(baseTheme) };
	},

	componentDidMount() {
		this.scrollElement('open');
		Meteor.call('getMaxLine', this.props.commentGroup.work.slug,
			this.props.commentGroup.subwork.n, (err, res) => {
				if (err) {
					console.log(err);
				} else if (res) {
					const linePagination = [];
					for (let i = 1; i <= res; i += 100) {
						linePagination.push(i);
					}

					this.setState({
						linePagination,
						maxLine: res,
					});
				}
			}
		);
	},

	componentDidUpdate(prevProps, prevState) {
		const isLemmEditionChange = prevState.selectedLemmaEdition !== this.state.selectedLemmaEdition;
		const isHighlighngChange = prevState.highlightingVisible !== this.state.highlightingVisible;
		if (!(isLemmEditionChange || isHighlighngChange)) {
			this.scrollElement('open');
		}
		const commentGroup = this.props.commentGroup;
		if (commentGroup.ref !== prevProps.commentGroup.ref) {
			this.setState({
				lineFrom: commentGroup.lineFrom,
				lineTo: commentGroup.lineFrom + 49,
			});
		}
	},
{'fraction_non_alphanumeric': 0.12793667007150153, 'fraction_numerical': 0.004596527068437181, 'mean_word_length': 4.028241335044929, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '6121917', 'n_tokens_mistral': 1518, 'n_tokens_neox': 1280, 'n_words': 229}