Skip to content

Commit

Permalink
Merge d3afd05 into a0e3257
Browse files Browse the repository at this point in the history
  • Loading branch information
Gregor Albrecht committed Jan 7, 2017
2 parents a0e3257 + d3afd05 commit 1a5497b
Show file tree
Hide file tree
Showing 179 changed files with 74 additions and 5,145 deletions.
80 changes: 16 additions & 64 deletions app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,10 @@
* This is the entry file for the application, only setup and boilerplate
* code.
*/

// Needed for redux-saga es6 generator support
import 'babel-polyfill';

/* eslint-disable import/no-unresolved, import/extensions */
// Load the favicon, the manifest.json file and the .htaccess file
import 'file?name=[name].[ext]!./favicon.ico';
// Load the manifest.json file and the .htaccess file
import '!file?name=[name].[ext]!./manifest.json';
import 'file?name=[name].[ext]!./.htaccess';
/* eslint-enable import/no-unresolved, import/extensions */
Expand All @@ -21,30 +18,11 @@ import ReactDOM from 'react-dom';
import { Provider } from 'react-redux';
import { applyRouterMiddleware, Router, browserHistory } from 'react-router';
import { syncHistoryWithStore } from 'react-router-redux';
import FontFaceObserver from 'fontfaceobserver';
import { useScroll } from 'react-router-scroll';
import configureStore from './store';

// Import Language Provider
import LanguageProvider from 'containers/LanguageProvider';

// Import CSS reset and Global Styles
// Import the CSS reset, which HtmlWebpackPlugin transfers to the build folder
import 'sanitize.css/sanitize.css';
import './global-styles';

// Observe loading of Open Sans (to remove open sans, remove the <link> tag in
// the index.html file and this observer)
const openSansObserver = new FontFaceObserver('Open Sans', {});

// When Open Sans is loaded, add a font-family using Open Sans to the body
openSansObserver.load().then(() => {
document.body.classList.add('fontLoaded');
}, () => {
document.body.classList.remove('fontLoaded');
});

// Import i18n messages
import { translationMessages } from './i18n';

// Create redux store with history
// this uses the singleton browserHistory provided by react-router
Expand All @@ -69,54 +47,28 @@ const rootRoute = {
childRoutes: createRoutes(store),
};

const render = (messages) => {

const render = () => {
ReactDOM.render(
<Provider store={store}>
<LanguageProvider messages={messages}>
<Router
history={history}
routes={rootRoute}
render={
// Scroll to top when going to a new page, imitating default browser
// behaviour
applyRouterMiddleware(useScroll())
}
/>
</LanguageProvider>
<Router
history={history}
routes={rootRoute}
render={
// Scroll to top when going to a new page, imitating default browser
// behaviour
applyRouterMiddleware(useScroll())
}
/>
</Provider>,
document.getElementById('app')
);
};

// Hot reloadable translation json files
if (module.hot) {
// modules.hot.accept does not accept dynamic dependencies,
// have to be constants at compile-time
module.hot.accept('./i18n', () => {
render(translationMessages);
});
}

// Chunked polyfill for browsers without Intl support
if (!window.Intl) {
(new Promise((resolve) => {
resolve(System.import('intl'));
}))
.then(() => Promise.all([
System.import('intl/locale-data/jsonp/en.js'),
System.import('intl/locale-data/jsonp/de.js'),
]))
.then(() => render(translationMessages))
.catch((err) => {
throw err;
});
} else {
render(translationMessages);
}
render();

// Install ServiceWorker and AppCache in the end since
// it's not most important operation and if main code fails,
// we do not want it installed
if (process.env.NODE_ENV === 'production') {
require('offline-plugin/runtime').install(); // eslint-disable-line global-require
}
import { install } from 'offline-plugin/runtime';
install();
15 changes: 0 additions & 15 deletions app/components/A/index.js

This file was deleted.

52 changes: 0 additions & 52 deletions app/components/A/tests/index.test.js

This file was deleted.

7 changes: 0 additions & 7 deletions app/components/Button/A.js

This file was deleted.

7 changes: 0 additions & 7 deletions app/components/Button/StyledButton.js

This file was deleted.

9 changes: 0 additions & 9 deletions app/components/Button/Wrapper.js

This file was deleted.

26 changes: 0 additions & 26 deletions app/components/Button/buttonStyles.js

This file was deleted.

46 changes: 0 additions & 46 deletions app/components/Button/index.js

This file was deleted.

28 changes: 0 additions & 28 deletions app/components/Button/tests/A.test.js

This file was deleted.

28 changes: 0 additions & 28 deletions app/components/Button/tests/StyledButton.test.js

This file was deleted.

28 changes: 0 additions & 28 deletions app/components/Button/tests/Wrapper.test.js

This file was deleted.

Loading

0 comments on commit 1a5497b

Please sign in to comment.