<commit_before><commit_msg>initial SystemMessage<commit_after>import React from 'react';
import PropTypes from 'prop-types';
import withRouter from 'react-router-dom/withRouter';

class SystemMessage extends React.Component {
	componentWillReceiveProps({ location }) {
		// look for new location.search (querystring) and check for sysmsg param
		if (location.search !== this.props.location.search) {
			const newParams = new URLSearchParams(location.search);
			const sysmsg = newParams.get('sysmsg');
			if (sysmsg && sysmsg !== this.state.sysmsg) {
				this.setState(() => ({ sysmsg }));
			}
		}
	}
	render() {
		const { sysMessages } = this.props;
		const { sysmsg } = this.state;
		return sysMessages[sysmsg];
	}
}

SystemMessage.propTypes = {
	location: PropTypes.object.isRequired, // provided by withRouter
	sysMessages: PropTypes.object.isRequired,
};
export default withRouter(SystemMessage);
{'fraction_non_alphanumeric': 0.12638580931263857, 'fraction_numerical': 0.0, 'mean_word_length': 4.751592356687898, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '2560173', 'n_tokens_mistral': 281, 'n_tokens_neox': 266, 'n_words': 65}