<commit_before>/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

import { connect } from 'react-redux';
import DashboardComponent from '../components/DashboardComponent';
import { State } from '../types/redux/state';

/* Passes the current redux state of the dashboard, and turns it into props for the React
 * component, which is what will be visible on the page. Makes it possible to access
 * your reducer state objects from within your React components.
 *
 * Returns the all of the elements in the dashboard.
 * */

import { changeGraphZoomIfNeeded } from '../actions/graph';
import { Dispatch } from '../types/redux/actions';
import { TimeInterval } from '../../../common/TimeInterval';


function mapStateToProps(state: State) {
	// TODO this is a hack to get the unit state set up correctly.
	// It is not really safe to set to an arbitrary value but
	// the Unit route is not done yet.
	state.graph.selectedUnit = 1;
	return {
		chartToRender: state.graph.chartToRender,
		lineLoading: state.readings.line.isFetching,
		barLoading: state.readings.bar.isFetching,
		compareLoading: state.readings.bar.isFetching,
		mapLoading: state.maps.isLoading,
		optionsVisibility: state.graph.optionsVisibility,
		selectedTimeInterval: state.graph.timeInterval
	};
}


function mapDispatchToProps(dispatch: Dispatch) {
	return {
		changeTimeInterval: (timeInterval: TimeInterval) => dispatch(changeGraphZoomIfNeeded(timeInterval))
	};
}

export default connect(mapStateToProps, mapDispatchToProps)(DashboardComponent);<commit_msg>remove setting of unit to fixed value<commit_after>/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

import { connect } from 'react-redux';
import DashboardComponent from '../components/DashboardComponent';
import { State } from '../types/redux/state';

/* Passes the current redux state of the dashboard, and turns it into props for the React
 * component, which is what will be visible on the page. Makes it possible to access
 * your reducer state objects from within your React components.
 *
 * Returns the all of the elements in the dashboard.
 * */

import { changeGraphZoomIfNeeded } from '../actions/graph';
import { Dispatch } from '../types/redux/actions';
import { TimeInterval } from '../../../common/TimeInterval';


function mapStateToProps(state: State) {
	return {
		chartToRender: state.graph.chartToRender,
		lineLoading: state.readings.line.isFetching,
		barLoading: state.readings.bar.isFetching,
		compareLoading: state.readings.bar.isFetching,
		mapLoading: state.maps.isLoading,
		optionsVisibility: state.graph.optionsVisibility,
		selectedTimeInterval: state.graph.timeInterval
	};
}


function mapDispatchToProps(dispatch: Dispatch) {
	return {
		changeTimeInterval: (timeInterval: TimeInterval) => dispatch(changeGraphZoomIfNeeded(timeInterval))
	};
}

export default connect(mapStateToProps, mapDispatchToProps)(DashboardComponent);
{'fraction_non_alphanumeric': 0.10125, 'fraction_numerical': 0.0028125, 'mean_word_length': 4.434634974533107, 'pattern_counts': {'":': 0, '<': 3, '<?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': '2005010', 'n_tokens_mistral': 920, 'n_tokens_neox': 896, 'n_words': 315}