<commit_before>import baseTheme from 'material-ui/styles/baseThemes/lightBaseTheme';
import getMuiTheme from 'material-ui/styles/getMuiTheme';
import MenuItem from 'material-ui/MenuItem';
import Divider from 'material-ui/Divider';
import Drawer from 'material-ui/Drawer';
import injectTapEventPlugin from 'react-tap-event-plugin';
import AvatarIcon from '/imports/avatar/client/ui/AvatarIcon.jsx';
import Tenants from '/imports/collections/tenants';

injectTapEventPlugin();

LeftMenu = React.createClass({

	propTypes: {
		open: React.PropTypes.bool.isRequired,
		closeLeftMenu: React.PropTypes.func.isRequired,
	},

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

	mixins: [ReactMeteorData],

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

	getMeteorData() {
		return {
			currentUser: Meteor.users.findOne({ _id: Meteor.userId() }),
			tenant: Tenants.findOne({ _id: Session.get('tenantId') })
		};
	},

	scrollToAbout(e) {
		$('html, body').animate({ scrollTop: $('#about').height() - 100 }, 300);

		this.props.closeLeftMenu();
		e.preventDefault();
	},

	render() {
		let username = '';
		const userIsLoggedIn = Meteor.user();
		const { tenant } = this.data;

		if (userIsLoggedIn) {
			if (this.data.currentUser.profile && this.data.currentUser.profile.name) {
				username = this.data.currentUser.profile.name;
			} else {
				username = this.data.currentUser.username;
			}
		}

		return (
			<div>
				<Drawer
					open={this.props.open}
					docked={false}
					onRequestChange={this.props.closeLeftMenu}
					className="md-sidenav-left"
				>
					<div className="sidenav-top">
						{userIsLoggedIn ?
							<a href="/profile">
								<div className="user-image paper-shadow">
									<AvatarIcon avatar={this.data.currentUser && this.data.currentUser.profile ? this.data.currentUser.profile.avatarUrl : '/images/default_user.jpg'} />
								</div>
							</a>
							: ''
						}
						<a href="/profile">
							<span className="user-fullname">
								{username}
							</span>
						</a>
					</div>
					{tenant && !tenant.isAnnotation && Roles.userIsInRole(Meteor.userId(), ['editor', 'admin', 'commenter']) ?
						<div>
							<MenuItem
								href="http://ahcip-admin.chs.harvard.edu"
								target="_blank"
								primaryText="Admin"
								onClick={this.props.closeLeftMenu}
							/>
							<MenuItem
								href="/commentary/add"
								primaryText="Add Comment"
								onClick={this.props.closeLeftMenu}
							/>
							<MenuItem
								href="/keywords/add"<commit_msg>only show admin link in left menu to users with admin role<commit_after>import baseTheme from 'material-ui/styles/baseThemes/lightBaseTheme';
import getMuiTheme from 'material-ui/styles/getMuiTheme';
import MenuItem from 'material-ui/MenuItem';
import Divider from 'material-ui/Divider';
import Drawer from 'material-ui/Drawer';
import injectTapEventPlugin from 'react-tap-event-plugin';
import AvatarIcon from '/imports/avatar/client/ui/AvatarIcon.jsx';
import Tenants from '/imports/collections/tenants';

injectTapEventPlugin();

LeftMenu = React.createClass({

	propTypes: {
		open: React.PropTypes.bool.isRequired,
		closeLeftMenu: React.PropTypes.func.isRequired,
	},

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

	mixins: [ReactMeteorData],

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

	getMeteorData() {
		return {
			currentUser: Meteor.users.findOne({ _id: Meteor.userId() }),
			tenant: Tenants.findOne({ _id: Session.get('tenantId') })
		};
	},

	scrollToAbout(e) {
		$('html, body').animate({ scrollTop: $('#about').height() - 100 }, 300);

		this.props.closeLeftMenu();
		e.preventDefault();
	},

	render() {
		let username = '';
		const userIsLoggedIn = Meteor.user();
		const { tenant } = this.data;

		if (userIsLoggedIn) {
			if (this.data.currentUser.profile && this.data.currentUser.profile.name) {
				username = this.data.currentUser.profile.name;
			} else {
				username = this.data.currentUser.username;
			}
		}

		return (
			<div>
				<Drawer
					open={this.props.open}
					docked={false}
					onRequestChange={this.props.closeLeftMenu}
					className="md-sidenav-left"
				>
					<div className="sidenav-top">
						{userIsLoggedIn ?
							<a href="/profile">
								<div className="user-image paper-shadow">
									<AvatarIcon avatar={this.data.currentUser && this.data.currentUser.profile ? this.data.currentUser.profile.avatarUrl : '/images/default_user.jpg'} />
								</div>
							</a>
							: ''
						}
						<a href="/profile">
							<span className="user-fullname">
								{username}
							</span>
						</a>
					</div>
					{tenant && !tenant.isAnnotation && Roles.userIsInRole(Meteor.userId(), ['editor', 'admin', 'commenter']) ?
						<div>
							{tenant && !tenant.isAnnotation && Roles.userIsInRole(Meteor.userId(), ['admin']) ?
								<MenuItem
									href="http://ahcip-admin.chs.harvard.edu"
									target="_blank"
									primaryText="Admin"
									onClick={this.props.closeLeftMenu}
								/>
							: ''}
							<MenuItem
								href="/commentary/add"
								primaryText="Add Comment"
								onClick={this.props.closeLeftMenu}
							/>
							<MenuItem
								href="/keywords/add"
{'fraction_non_alphanumeric': 0.1514691943127962, 'fraction_numerical': 0.002274881516587678, 'mean_word_length': 3.134796238244514, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 35, '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': '742663', 'n_tokens_mistral': 2248, 'n_tokens_neox': 1723, 'n_words': 286}