<commit_before>import React, { Children, cloneElement } from 'react';
import { Link, Router, Route, browserHistory, IndexRoute } from 'react-router';
import ReactDOM from 'react-dom';
import FieldType from './field';

const Types = {
	Boolean: require('../types/boolean/test/explorer'),
	// CodeField.js:38 CodeMirror is undefined
	// Code: require('../types/code/test/explorer'),
	Color: require('../types/color/test/explorer'),
	CloudinaryImage: require('../types/cloudinaryimage/test/explorer'),
	CloudinaryImages: require('../types/cloudinaryimages/test/explorer'),
	Date: require('../types/date/test/explorer'),
	Datearray: require('../types/datearray/test/explorer'),
	Datetime: require('../types/datetime/test/explorer'),
	Email: require('../types/email/test/explorer'),
	Geopoint: require('../types/geopoint/test/explorer'),
	Html: require('../types/html/test/explorer'),
	Key: require('../types/key/test/explorer'),
	Location: require('../types/location/test/explorer'),
	// bootstrap-markdown.js:863 $ (jQuery) is undefined
	// Markdown: require('../types/markdown/test/explorer'),
	Money: require('../types/money/test/explorer'),
	Name: require('../types/name/test/explorer'),
	Number: require('../types/number/test/explorer'),
	Numberarray: require('../types/numberarray/test/explorer'),
	Password: require('../types/password/test/explorer'),
	Select: require('../types/select/test/explorer'),
	Text: require('../types/text/test/explorer'),
	Textarea: require('../types/textarea/test/explorer'),
	Textarray: require('../types/textarray/test/explorer'),
	Url: require('../types/url/test/explorer'),
};

function generateNavSections (arr) {
	const navSections = {};
	arr.forEach((t) => {
		if (!navSections[t.section]) navSections[t.section] = [];
	});
	arr.forEach(t => navSections[t.section].push(t.spec.label));

	return navSections;
}

const navSections = generateNavSections(Object.keys(Types).map(i => Types[i]));

const App = (props) => {
	return (
		<div className="fx-wrapper">
			<div className="fx-sidebar">
				<div className="fx-sidebar__header">
					{props.params.type
						? <Link to="/" className="fx-sidebar__header__link">Exploring</Link>
						: 'Ready'}
					<div className="fx-sidebar__header__border"></div>
				</div>
				{Object.keys(navSections).map(section => {
					let currentSection;
					const types = navSections[section].map(type => {

						if (Types[props.params.type]) {
							currentSection = Types[props.params.type].section;
						}

						const itemClassName = props.params.type === type
							? 'fx-sidebar__item fx-sidebar__item--active'
							: 'fx-sidebar__item';
<commit_msg>sort the sidebar nav sections<commit_after>import React, { Children, cloneElement } from 'react';
import { Link, Router, Route, browserHistory, IndexRoute } from 'react-router';
import ReactDOM from 'react-dom';
import FieldType from './field';

const Types = {
	Boolean: require('../types/boolean/test/explorer'),
	// CodeField.js:38 CodeMirror is undefined
	// Code: require('../types/code/test/explorer'),
	Color: require('../types/color/test/explorer'),
	CloudinaryImage: require('../types/cloudinaryimage/test/explorer'),
	CloudinaryImages: require('../types/cloudinaryimages/test/explorer'),
	Date: require('../types/date/test/explorer'),
	Datearray: require('../types/datearray/test/explorer'),
	Datetime: require('../types/datetime/test/explorer'),
	Email: require('../types/email/test/explorer'),
	Geopoint: require('../types/geopoint/test/explorer'),
	Html: require('../types/html/test/explorer'),
	Key: require('../types/key/test/explorer'),
	Location: require('../types/location/test/explorer'),
	// bootstrap-markdown.js:863 $ (jQuery) is undefined
	// Markdown: require('../types/markdown/test/explorer'),
	Money: require('../types/money/test/explorer'),
	Name: require('../types/name/test/explorer'),
	Number: require('../types/number/test/explorer'),
	Numberarray: require('../types/numberarray/test/explorer'),
	Password: require('../types/password/test/explorer'),
	Select: require('../types/select/test/explorer'),
	Text: require('../types/text/test/explorer'),
	Textarea: require('../types/textarea/test/explorer'),
	Textarray: require('../types/textarray/test/explorer'),
	Url: require('../types/url/test/explorer'),
};

function generateNavSections (arr) {
	const navSections = {};
	arr.forEach((t) => {
		if (!navSections[t.section]) navSections[t.section] = [];
	});
	arr.forEach(t => navSections[t.section].push(t.spec.label));

	return navSections;
}

const navSections = generateNavSections(Object.keys(Types).map(i => Types[i]));

const App = (props) => {
	return (
		<div className="fx-wrapper">
			<div className="fx-sidebar">
				<div className="fx-sidebar__header">
					{props.params.type
						? <Link to="/" className="fx-sidebar__header__link">Exploring</Link>
						: 'Ready'}
					<div className="fx-sidebar__header__border"></div>
				</div>
				{Object.keys(navSections).sort().map(section => {
					let currentSection;
					const types = navSections[section].map(type => {

						if (Types[props.params.type]) {
							currentSection = Types[props.params.type].section;
						}

						const itemClassName = props.params.type === type
							? 'fx-sidebar__item fx-sidebar__item--active'
							: 'fx-sidebar__item';

{'fraction_non_alphanumeric': 0.19183519183519185, 'fraction_numerical': 0.00189000189000189, 'mean_word_length': 4.281437125748503, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 31, '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': '3709170', 'n_tokens_mistral': 1846, 'n_tokens_neox': 1676, 'n_words': 268}