<commit_before>/*global require: false, module: false, window: false */
'use strict';
var React = require('react');
var MenuItem = require('react-bootstrap/lib/MenuItem');
var _ = require('../underscore_ext');
var xenaQuery = require('../xenaQuery'); // XXX does this belong here?

function onAbout(dsID) {
	var [host, dataset] = xenaQuery.parse_host(dsID);
	var url = `../datapages/?dataset=${encodeURIComponent(dataset)}&host=${encodeURIComponent(host)}`;
	window.open(url);
}

var getAbout = (dsID, text) => (
	<MenuItem key={dsID} onSelect={() => onAbout(dsID)}>{text} </MenuItem>);

function aboutDatasetMenu({dsIDs, label}) {
	if (dsIDs.length === 0) {
		return null;
	} else if (dsIDs.length === 1) {
		return getAbout(dsIDs[0], 'About the Dataset');
	}
	return [
		<MenuItem key='d0' divider/>,
		<MenuItem key='header' header>About the Datasets</MenuItem>,
		..._.map(dsIDs, dsID => getAbout(dsID, label(dsID))),<commit_msg>Parameterize root url for 'about dataset'<commit_after>/*global require: false, module: false, window: false */
'use strict';
var React = require('react');
var MenuItem = require('react-bootstrap/lib/MenuItem');
var _ = require('../underscore_ext');
var xenaQuery = require('../xenaQuery'); // XXX does this belong here?

function onAbout(dsID, root) {
	var [host, dataset] = xenaQuery.parse_host(dsID);
	var url = `${root}/datapages/?dataset=${encodeURIComponent(dataset)}&host=${encodeURIComponent(host)}`;
	window.open(url);
}

var getAbout = (dsID, root, text) => (
	<MenuItem key={dsID} onSelect={() => onAbout(dsID, root)}>{text} </MenuItem>);

function aboutDatasetMenu({dsIDs, label}, root = '..') {
	if (dsIDs.length === 0) {
		return null;
	} else if (dsIDs.length === 1) {
		return getAbout(dsIDs[0], root, 'About the Dataset');
	}
	return [
		<MenuItem key='d0' divider/>,
		<MenuItem key='header' header>About the Datasets</MenuItem>,
		..._.map(dsIDs, dsID => getAbout(dsID, label(dsID))),
{'fraction_non_alphanumeric': 0.19266528925619836, 'fraction_numerical': 0.004132231404958678, 'mean_word_length': 5.350819672131148, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 19, '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': '4011799', 'n_tokens_mistral': 669, 'n_tokens_neox': 665, 'n_words': 157}