2017-02-24 14:13:10 +02:00
|
|
|
import { IntlProvider } from 'react-intl-redux';
|
|
|
|
import { BrowserRouter } from 'react-router-dom';
|
|
|
|
import { Provider } from 'react-redux';
|
2017-02-20 18:15:36 +02:00
|
|
|
import a11y from 'react-a11y';
|
|
|
|
import ReactDOM from 'react-dom';
|
|
|
|
import React from 'react';
|
2017-02-24 14:13:10 +02:00
|
|
|
|
|
|
|
import App from '@containers/app';
|
2017-03-20 19:43:26 +02:00
|
|
|
// import MockState from './mock-state.json';
|
|
|
|
import MockStateTesting from './mock-state-testing.json';
|
2017-03-17 21:27:15 +02:00
|
|
|
import Datasets from './datasets.json';
|
2017-02-24 14:13:10 +02:00
|
|
|
import Store from '@state/store';
|
2016-10-20 04:14:26 +03:00
|
|
|
|
2016-10-25 22:36:05 +03:00
|
|
|
if (process.env.NODE_ENV !== 'production') {
|
|
|
|
a11y(React, {
|
|
|
|
ReactDOM
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2017-03-20 19:43:26 +02:00
|
|
|
// TODO want ot be able to switch whic mock state to use
|
|
|
|
// based on a query string
|
|
|
|
const mockState = MockStateTesting;
|
|
|
|
|
2017-03-17 21:27:15 +02:00
|
|
|
// TMP - ensure datasets are at least 2 hrs long - START
|
|
|
|
import getTwoHourDatasets from './utils/two-hour-metric-datasets';
|
|
|
|
const twoHourLongDatasets = getTwoHourDatasets(Datasets);
|
|
|
|
// TMP - ensure datasets are at least 2 hrs long - END
|
|
|
|
|
|
|
|
// TMP - plug fake metric data - START
|
2017-03-20 19:43:26 +02:00
|
|
|
const datasets = mockState.metrics.data.datasets.map((dataset, index) => {
|
2017-03-17 21:27:15 +02:00
|
|
|
const keyIndex = index%2 ? 0 : 1;
|
|
|
|
const key = Object.keys(twoHourLongDatasets)[keyIndex];
|
|
|
|
return {
|
|
|
|
...dataset,
|
|
|
|
data: twoHourLongDatasets[key]
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
2017-03-20 19:43:26 +02:00
|
|
|
mockState.metrics.data.datasets = datasets;
|
2017-03-17 21:27:15 +02:00
|
|
|
// TMP - plug fake metric data - END
|
|
|
|
|
2017-02-20 18:15:36 +02:00
|
|
|
ReactDOM.render(
|
2017-03-20 19:43:26 +02:00
|
|
|
<Provider store={Store(mockState)}>
|
2017-02-24 14:13:10 +02:00
|
|
|
<IntlProvider>
|
|
|
|
<BrowserRouter>
|
|
|
|
<App />
|
|
|
|
</BrowserRouter>
|
|
|
|
</IntlProvider>
|
|
|
|
</Provider>,
|
2017-02-20 18:15:36 +02:00
|
|
|
document.getElementById('root')
|
|
|
|
);
|